Skip to content

Reuse already initialized rule set for each location#291

Open
k1k wants to merge 1 commit into
owasp-modsecurity:masterfrom
k1k:reuse_rules_across_locations
Open

Reuse already initialized rule set for each location#291
k1k wants to merge 1 commit into
owasp-modsecurity:masterfrom
k1k:reuse_rules_across_locations

Conversation

@k1k

@k1k k1k commented Nov 16, 2022

Copy link
Copy Markdown

Only merge rule-sets when there are extra rules in the location, otherwise just re-use the rule-set of the parent

Only merge rulesets when there are extra rules in the location,
otherwise just re-use the ruleset of the parent
@airween

airween commented Apr 16, 2024

Copy link
Copy Markdown
Member

Hi @k1k, we've added a CI workflow to this repository. Could you pick up the modifications and send your patch again? It would be fine to run those tests - thanks!

@HanadaLee

Copy link
Copy Markdown

The lazy/shared ruleset approach is reasonable, but it changes the behavior of modsecurity on without any loaded rules. Both parent and child rulesets can remain NULL, ngx_http_modsecurity_create_ctx() then returns NULL, and the rewrite handler turns that into HTTP 500. Previously every location had a valid empty RulesSet.

Please preserve the empty-ruleset behavior for enabled configurations. Also, the DDEBUG dumps currently run before the new NULL checks, while msc_rules_dump() dereferences its argument unconditionally, causing debug builds to crash during configuration merging.

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.

3 participants