Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tag for all SecRules with SecDefaultAction #175

Open
glenn-kusardi opened this issue Oct 24, 2024 · 1 comment
Open

Add tag for all SecRules with SecDefaultAction #175

glenn-kusardi opened this issue Oct 24, 2024 · 1 comment

Comments

@glenn-kusardi
Copy link

I'm trying to add a tag in all SecRules. In @crs-setup.conf this is already outlined in an example for SecDefaultAction:
SecDefaultAction "phase:1,log,auditlog,redirect:'http://%{request_headers.host}/',tag:'Host: %{request_headers.host}'"
SecDefaultAction "phase:2,log,auditlog,redirect:'http://%{request_headers.host}/',tag:'Host: %{request_headers.host}'"

But if I uncomment this lines an error message is returned when restarting Caddy, describing that "SecDefaultAction must not contain metadata actions".

@M4tteoP
Copy link
Member

M4tteoP commented Oct 24, 2024

Hi, this is tricky because of inconsistent documentation.

SecDefaultAction "phase:1,log,auditlog,redirect:'http://%{request_headers.host}/',tag:'Host: %{request_headers.host}'"
SecDefaultAction "phase:2,log,auditlog,redirect:'http://%{request_headers.host}/',tag:'Host: %{request_headers.host}'"

These lines are 8 years old from the crs-setup.conf.example, but accordingly to documentation, both Coraza and Modsecurity are actually not supporting it.

Mentioning both ModSec v2 and v3 docs:

Every SecDefaultAction directive must specify a disruptive action and a processing phase and cannot contain metadata actions.

With metadata actions including tag:

metadata actions (id, rev, msg, tag, severity, logdata)

I'm sharing this conversation in Slack #coreruleset: https://owasp.slack.com/archives/CBKGH8A5P/p1729806584858919, where we can evolve it with Coraza, CRS and Modsec people.

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

No branches or pull requests

2 participants