Skip to content

Commit 80f1ee2

Browse files
Update detect_xss.cc
1 parent 9fa2200 commit 80f1ee2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/operators/detect_xss.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ namespace modsecurity::operators {
2727

2828
bool DetectXSS::evaluate(Transaction *t, RuleWithActions *rule,
2929
const std::string& input, RuleMessage &ruleMessage) {
30+
#ifndef NO_LOGS
3031
const std::string loggable_input =
3132
utils::string::limitTo(80, utils::string::toHexIfNeeded(input));
33+
#endif
3234

3335
const injection_result_t xss_result =
3436
runLibinjectionXSS(input.c_str(), input.length());
@@ -47,21 +49,25 @@ bool DetectXSS::evaluate(Transaction *t, RuleWithActions *rule,
4749
break;
4850

4951
case LIBINJECTION_RESULT_ERROR:
52+
#ifndef NO_LOGS
5053
ms_dbg_a(t, 4,
5154
std::string("libinjection parser error during XSS analysis (")
5255
+ libinjectionResultToString(xss_result)
5356
+ "); treating as match (fail-safe). Input: "
5457
+ loggable_input);
58+
#endif
5559
if (rule != nullptr && rule->hasCaptureAction()) {
5660
t->m_collections.m_tx_collection->storeOrUpdateFirst("0", input);
5761
ms_dbg_a(t, 7, std::string("Added DetectXSS error input TX.0: ") + input);
5862
}
5963
break;
6064

6165
case LIBINJECTION_RESULT_FALSE:
66+
#ifndef NO_LOGS
6267
ms_dbg_a(t, 9,
6368
std::string("libinjection was not able to find any XSS in: ")
6469
+ loggable_input);
70+
#endif
6571
break;
6672
}
6773

0 commit comments

Comments
 (0)