fw: validate scope inheritance in policies and rules

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
pull/16185/head
Lukas Sismis 2 weeks ago committed by Victor Julien
parent 25ece1ed38
commit 4bafe61ecf

@ -1873,6 +1873,14 @@ static int SigParseActionDo(const char *action_in, const int idx, const bool fw_
return -1; return -1;
} }
*scope_out = scope_flags; *scope_out = scope_flags;
} else if (*scope_out != 0 && (flags & ACTION_PASS)) {
/* No scope given, this action inherits the scope set by the preceding
* actions of a multi-action rule. */
if (*scope_out != ACTION_SCOPE_PACKET && *scope_out != ACTION_SCOPE_FLOW) {
SCLogError("invalid action scope '%s' in action '%s': only 'packet' and 'flow' allowed",
ActionScopeToString((enum ActionScope) * scope_out), action_in);
return -1;
}
} }
/* require explicit action scope for fw rules */ /* require explicit action scope for fw rules */

Loading…
Cancel
Save