Skip to content

Backport 8.0.x/feat/8770 fw default policy v2 - #16116

Closed
lukashino wants to merge 3 commits into
OISF:main-8.0.xfrom
lukashino:backport-8.0.x/feat/8770-fw-default-policy-v2
Closed

Backport 8.0.x/feat/8770 fw default policy v2#16116
lukashino wants to merge 3 commits into
OISF:main-8.0.xfrom
lukashino:backport-8.0.x/feat/8770-fw-default-policy-v2

Conversation

@lukashino

@lukashino lukashino commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Follow-up of pre-approved #16110

Add a default-policy setting that applies to all hooks below it. For any hook the most specific setting present wins.
Action scopes are now validated against the hook they reach. A global accept:tx arriving at a packet hook is a startup error instead of being applied silently.

Link to ticket: https://redmine.openinfosecfoundation.org/issues/8770

Backport of #16091

Describe changes:
v2:

v1:

  • clean backports except substates (not available in 8)

SV_BRANCH=OISF/suricata-verify#3317

Lukas Sismis added 3 commits August 26, 2026 09:48
Mapping an app-layer progress state to its generic request-/response-
hook alias was hardcoded in multiple places.

This commit adds a wrapper to unify it to a single function.
It returns the config-form (hyphenated) name, or NULL for an
intermediate state.

Ticket: 8770
(cherry picked from commit 1aa0259)
Every hook has a built-in default policy, but expressing anything other
than the built-in meant naming each hook explicitly.
This commit adds a `default-policy` setting that covers all hooks below it.
For any hook the most specific setting present wins.

Ticket: 8770
(cherry picked from commit 0aaa80d)
Validate the resolved scope against the class of hook it is being applied
to and fail at startup if it does not fit.

Ticket: 8770
(cherry picked from commit 092ae27)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backports hierarchical firewall default policies and hook-specific scope validation to Suricata 8.0.x.

Changes:

  • Adds inherited global, packet, app, and protocol defaults.
  • Validates action scopes against packet/app hooks.
  • Documents precedence and reuses generic app-hook naming.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/detect-parse.h Exposes generic hook-name helper.
src/detect-parse.c Implements policy inheritance and validation.
src/detect-engine-analyzer.c Uses shared generic hook names.
doc/userguide/firewall/firewall-design.rst Documents defaults and precedence.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/detect-parse.c
Comment on lines +118 to +122
static const uint8_t fw_packet_hook_scopes[] = {
ACTION_SCOPE_PACKET,
ACTION_SCOPE_HOOK,
ACTION_SCOPE_FLOW,
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.69%. Comparing base (098022a) to head (7834c64).

Additional details and impacted files
@@              Coverage Diff               @@
##           main-8.0.x   #16116      +/-   ##
==============================================
- Coverage       81.71%   81.69%   -0.03%     
==============================================
  Files            1016     1016              
  Lines          277201   277243      +42     
==============================================
- Hits           226509   226480      -29     
- Misses          50692    50763      +71     
Flag Coverage Δ
fuzzcorpus 63.86% <0.00%> (-0.03%) ⬇️
livemode 18.62% <0.00%> (-0.04%) ⬇️
netns 20.14% <54.88%> (-0.02%) ⬇️
pcap 44.48% <0.00%> (-0.02%) ⬇️
suricata-verify 65.18% <89.47%> (-0.06%) ⬇️
unittests 58.58% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suricata-qa

Copy link
Copy Markdown

Information: QA ran without warnings.

Pipeline = 33362

@victorjulien victorjulien added this to the 8.0 milestone Aug 26, 2026
@victorjulien

Copy link
Copy Markdown
Member

Merged in #16123, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants