Add C API to retrieve matched rules from a transaction#3551
Add C API to retrieve matched rules from a transaction#3551airween merged 6 commits intoowasp-modsecurity:v3/masterfrom
Conversation
|
Tests on Windows were failed, could you check them? |
|
@meirdev - thanks for the changes. There are three new issues in Sonarcloud, could you take a look at them? Also, please pick up the recent changes from v3/master. |
There was a problem hiding this comment.
Pull request overview
This PR adds new ModSecurity C API entry points to let connectors query which rules matched during a transaction, intended to support downstream integration needs (referenced by the ModSecurity-nginx PR).
Changes:
- Add
msc_get_matched_rules_count(Transaction*)to return the number of stored rule match/message records on a transaction. - Add
msc_get_matched_rule_id(Transaction*, size_t index)to fetch the rule ID for the N-th stored record. - Update public header to expose the new APIs and include
<stdint.h>forint64_t.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/transaction.cc |
Implements the two new C API functions for matched-rule querying. |
headers/modsecurity/transaction.h |
Exposes the new C API declarations (and adds <stdint.h> include). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@meirdev: and also please take a look at the Copilot suggestions. |
|
Regarding the two remaining issues in SonarCloud: all the other |
Ah, you're totally right - thank you. |
|
@meirdev thank you, merging now. |

references
Required for: owasp-modsecurity/ModSecurity-nginx#374