Repository navigation
Conversation
Only merge rulesets when there are extra rules in the location, otherwise just re-use the ruleset of the parent
|
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! |
|
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. |
|
|
Confirming the issue raised in the review: with this change both I have a variant of this idea that keeps that behaviour: rule sets are created lazily in the three Branch: https://github.com/tomsommer/ModSecurity-nginx/tree/perf/share-rules-set (single commit). Happy for you to cherry-pick it into this PR, or I can open it as a separate PR if the maintainers prefer. Prepared during a performance review of the connector done with Claude Fable 5.1. |
|
Closing in favor of #399, which implements the same idea (share the parent RulesSet with blocks that declare no rules) and also keeps a valid empty RulesSet for enabled configurations with no rules, avoiding the 500 responses raised in the review here. Thanks for the contribution and for your patience. |
|
@airween I don't have permission to close PRs in this repository. Could you close this one, per the comment above? Thanks. |



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