Skip to content

Fix case-insensitive request header target exclusions - #3616

Open
TejasButani001 wants to merge 1 commit into
owasp-modsecurity:v3/masterfrom
TejasButani001:fix/request-headers-case-insensitive
Open

Fix case-insensitive request header target exclusions#3616
TejasButani001 wants to merge 1 commit into
owasp-modsecurity:v3/masterfrom
TejasButani001:fix/request-headers-case-insensitive

Conversation

@TejasButani001

@TejasButani001 TejasButani001 commented Aug 18, 2026

Copy link
Copy Markdown

Summary

Fix case-sensitive matching of REQUEST_HEADERS target exclusions.

Previously, an exclusion such as:

SecRuleUpdateTargetById 1 !REQUEST_HEADERS:referer

could fail to exclude the corresponding request header when the header name
used a different case.

This change makes REQUEST_HEADERS target exclusion matching case-insensitive.

Testing

Added a regression test covering case-insensitive REQUEST_HEADERS exclusion.

  • 6 regression tests run
  • 6 passed
  • 0 failed

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 750b41bb-6f01-4e21-8d29-c3a72ffaccaf

📥 Commits

Reviewing files that changed from the base of the PR and between 7ea9fef and 5b66b5b.

📒 Files selected for processing (2)
  • src/variables/variable.h
  • test/test-cases/regression/config-update-target-by-id.json

Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change makes non-regex variable target matching case-insensitive. A regression test verifies that lowercase referer excludes the Referer request header from SecRuleUpdateTargetById.

Changes

Case-Insensitive Target Matching

Layer / File(s) Summary
Case-insensitive matching and regression coverage
src/variables/variable.h, test/test-cases/regression/config-update-target-by-id.json
The comparison uppercases collection-qualified non-regex keys. The regression test verifies that REQUEST_HEADERS:Referer is excluded by lowercase referer and returns HTTP 200.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 5b66b

This PR makes a localized case-insensitivity correction with accompanying regression coverage, and no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the case-insensitive request header target exclusion fix tested and implemented by this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@airween

airween commented Aug 18, 2026

Copy link
Copy Markdown
Member

Hi @TejasButani001,

thanks for this PR - will this close #3609?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants