Skip to content

Commit 5b709d9

Browse files
authored
Merge pull request #2866 from grnet/v3/fix-multimatch-tags
Fix tags not being populated in audit log when multiMatch is enabled
2 parents 7ca5719 + d3a6b6a commit 5b709d9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/rule_with_actions.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ void RuleWithActions::executeActionsIndependentOfChainedRuleResult(Transaction *
229229
if (m_msg) {
230230
m_msg->evaluate(this, trans, ruleMessage);
231231
}
232+
for (actions::Tag *a : m_actionsTag) {
233+
a->evaluate(this, trans, ruleMessage);
234+
}
232235
}
233236

234237
}

test/test-cases/regression/auditlog.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,14 @@
253253
"body": ""
254254
},
255255
"expected": {
256-
"audit_log": "\\[msg \"testmsg\"\\]",
256+
"audit_log": "\\[msg \"testmsg\"\\] \\[data \"testdata\"\\] \\[severity \"7\"\\] \\[ver \"\"\\] \\[maturity \"0\"\\] \\[accuracy \"0\"\\] \\[tag \"testtag1\"\\] \\[tag \"testtag2\"\\]",
257257
"error_log": "",
258258
"http_code": 403
259259
},
260260
"rules": [
261261
"SecRuleEngine On",
262262
"SecDefaultAction \"phase:1,nolog,auditlog,deny,status:403\"",
263-
"SecRule ARGS \"@contains test2\" \"id:1557,phase:1,multiMatch,block,log,t:none,t:urlDecode,t:lowercase,msg:'testmsg'\"",
263+
"SecRule ARGS \"@contains test2\" \"id:1557,phase:1,multiMatch,block,log,t:none,t:urlDecode,t:lowercase,msg:'testmsg',logdata:'testdata',severity:'DEBUG',tag:'testtag1',tag:'testtag2'\"",
264264
"SecAuditEngine RelevantOnly",
265265
"SecAuditLogParts ABCFHZ",
266266
"SecAuditLog /tmp/test/modsec_audit_multimatch_1.log",
@@ -302,14 +302,14 @@
302302
"body": ""
303303
},
304304
"expected": {
305-
"audit_log": "\\[msg \"tstmsg\"\\]",
305+
"audit_log": "\\[msg \"testmsg\"\\] \\[data \"testdata\"\\] \\[severity \"7\"\\] \\[ver \"\"\\] \\[maturity \"0\"\\] \\[accuracy \"0\"\\] \\[tag \"testtag1\"\\] \\[tag \"testtag2\"\\]",
306306
"error_log": "",
307307
"http_code": 403
308308
},
309309
"rules": [
310310
"SecRuleEngine On",
311311
"SecDefaultAction \"phase:1,nolog,auditlog,deny,status:403\"",
312-
"SecRule ARGS \"@streq tEst2\" \"id:1558,phase:1,multiMatch,block,log,t:none,t:trim,t:lowercase,msg:'tstmsg'\"",
312+
"SecRule ARGS \"@streq tEst2\" \"id:1558,phase:1,multiMatch,block,log,t:none,t:trim,t:lowercase,msg:'testmsg',logdata:'testdata',severity:'DEBUG',tag:'testtag1',tag:'testtag2'\"",
313313
"SecAuditEngine RelevantOnly",
314314
"SecAuditLogParts ABCFHZ",
315315
"SecAuditLog /tmp/test/modsec_audit_multimatch_2.log",

0 commit comments

Comments
 (0)