security/maltrail: don't override the Check Hostheaders setting - #5679
Lux-WorldPC wants to merge 1 commit into
Conversation
The template emitted CHECK_HOST_DOMAINS twice: once from the checkhostheader conditional and again below as a hardcoded false. maltrail's read_config() assigns config[name] = value unguarded while walking the file top to bottom, so the last occurrence won and the GUI toggle never took effect. The hardcoded line predates the option; cdf3620 added the conditional right above it without removing it. Closes opnsense#5489 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Adding the verification I ran, in case it is useful for review. Tested on OPNsense 26.1.11_10 with os-maltrail 1.10_3, through the GUI: Services > Maltrail > Before, with "Check Hostheaders" enabled: maltrail's own parser resolves that to the second occurrence: After this change, same setting: a single AI disclosure, as in the PR description: Claude Opus 5 via Claude Code ran this test and |
Important notices
Before you submit a pull request, we ask you kindly to acknowledge the following:
If AI was used, please disclose:
(
core/settings.py) for the duplicate-key behaviour, and to trace the template history.The fix is the one-line deletion proposed by the reporter in os-maltrail: CHECK_HOST_DOMAINS appears twice #5489. I reviewed and verified
each of those points before opening this PR.
Describe the problem
CHECK_HOST_DOMAINSis emitted twice in the generatedmaltrail.conf: once from thecheckhostheaderconditional, and again a few lines below as a hardcodedfalse.maltrail's
read_config()walks the file top to bottom and ends each iteration with a plainconfig[name] = value, with no guard, so the last occurrence wins. The trailing hardcoded linetherefore always overrides the GUI setting and pins
CHECK_HOST_DOMAINStofalse.The hardcoded line dates back to the initial template. The conditional block was later inserted
directly above it in cdf3620 ("security/maltrail: add hostheader checking", #3144) without removing
it, so Services -> Maltrail -> General -> Check Hostheaders has had no effect since the option was
introduced.
Describe the proposed solution
Drop the leftover hardcoded
CHECK_HOST_DOMAINS falseso the emitted value is the one selected inthe GUI. This is the fix suggested by @thwien in the issue.
Users who had the toggle off are unaffected (the conditional still emits
false); users who had iton now get the
truethey asked for.I left
PLUGIN_REVISIONalone, assuming the bump is done on your side as usual - happy to add it ifyou prefer.
Related issue
Closes #5489