fw: validate scope inheritance in policies and rules + pass&config action updates v3 - #16138
fw: validate scope inheritance in policies and rules + pass&config action updates v3#16138lukashino wants to merge 4 commits into
Conversation
A secondary action given without an explicit scope inherits the scope of the primary action, but was never validated against the scopes it supports itself. `pass` only supports packet and flow scope but the inheritance was never verified. Ticket: 8954
Previously, hook sequences in both rules and default policies allowed `pass` to be combined with incompatible hooks (e.g. reject or drop). This commit clamps pass to accept only. Ticket: 8954
There was a problem hiding this comment.
Pull request overview
This PR tightens firewall action validation in detect-parse.c to enforce correct scope/action combinations (notably around pass scope inheritance and config usage), and updates the user guide to document the config firewall action.
Changes:
- Enforce that
passcan only be used as a secondary action when the primary firewall action isaccept, and restrictpassscope inheritance topacket/flow. - Disallow
configas a default policy action infirewall.policies. - Document the
configfirewall action in the firewall design user guide.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/detect-parse.c | Adds parser validations for pass usage/scope inheritance and rejects config in default policies. |
| doc/userguide/firewall/firewall-design.rst | Adds documentation for the config firewall action in the action overview. |
Suppressed comments (1)
src/detect-parse.c:4220
- This introduces a new policy-level validation (
configis rejected as a default policy action). Please add unit tests that cover parsingfirewall.policieswithconfig:packet(expected failure) and a representative valid policy action list (expected success), so this behavior stays enforced across future refactors.
if (action & ACTION_CONFIG) {
SCLogError("%s: 'config' is not a valid default policy action", policy_name);
return -1;
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16138 +/- ##
=======================================
Coverage 83.05% 83.05%
=======================================
Files 1004 1004
Lines 277407 277418 +11
=======================================
+ Hits 230410 230420 +10
- Misses 46997 46998 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Information: QA ran without warnings. Pipeline = 33427 |
|
Merged in #16185, thanks! |
Follow-up of #16132
Link to ticket: https://redmine.openinfosecfoundation.org/issues/8954
Describe changes:
v3:
configaction disallowed to be used in policiesconfigaction in the FW overview action enumerationv2:
passonly is used next toacceptprimary actionv1:
passonly inherits packet and flow scopesSV_BRANCH=OISF/suricata-verify#3331