2222#include " src/operators/operator.h"
2323#include " src/operators/libinjection_utils.h"
2424#include " src/operators/libinjection_adapter.h"
25+ #include " src/utils/string.h"
2526#include " libinjection/src/libinjection_error.h"
2627
2728namespace modsecurity ::operators {
2829
2930bool DetectSQLi::evaluate (Transaction *t, RuleWithActions *rule,
3031 const std::string& input, RuleMessage &ruleMessage) {
32+ const std::string loggable_input =
33+ utils::string::limitTo (80 , utils::string::toHexIfNeeded (input));
3134
3235 std::array<char , 8 > fingerprint{};
3336
@@ -44,7 +47,7 @@ bool DetectSQLi::evaluate(Transaction *t, RuleWithActions *rule,
4447
4548 ms_dbg_a (t, 4 ,
4649 std::string (" detected SQLi using libinjection with fingerprint '" )
47- + fingerprint.data () + " ' at: '" + input + " '" );
50+ + fingerprint.data () + " ' at: '" + loggable_input + " '" );
4851
4952 if (rule != nullptr && rule->hasCaptureAction ()) {
5053 t->m_collections .m_tx_collection ->storeOrUpdateFirst (
@@ -61,7 +64,7 @@ bool DetectSQLi::evaluate(Transaction *t, RuleWithActions *rule,
6164 std::string (" libinjection parser error during SQLi analysis (" )
6265 + libinjectionResultToString (sqli_result)
6366 + " ); treating as match (fail-safe). Input: '"
64- + input + " '" );
67+ + loggable_input + " '" );
6568
6669 if (rule != nullptr && rule->hasCaptureAction ()) {
6770 t->m_collections .m_tx_collection ->storeOrUpdateFirst (
@@ -79,7 +82,7 @@ bool DetectSQLi::evaluate(Transaction *t, RuleWithActions *rule,
7982 case LIBINJECTION_RESULT_FALSE:
8083 ms_dbg_a (t, 9 ,
8184 std::string (" libinjection was not able to find any SQLi in: " )
82- + input );
85+ + loggable_input );
8386 break ;
8487 }
8588
0 commit comments