Skip to content

Adjusting rule chain logging; adjusting cookie header parsing #2203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
v3.0.4 - YYYY-MMM-DD (to be released)
-------------------------------------

- Additional adjustment to Cookie header parsing
[@martinhsv]
- Restore chained rule part H logging to be more like 2.9 behaviour
[Issue #2196 - @martinhsv]
- Small fixes in log messages to help debugging the file upload
[Issue #2130 - @airween]
- Fix Cookie header parsing issues
Expand Down
2 changes: 1 addition & 1 deletion src/rule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ bool Rule::evaluate(Transaction *trans,
executeActionsAfterFullMatch(trans, containsBlock, ruleMessage);

/* last rule in the chain. */
bool isItToBeLogged = ruleMessage->m_saveMessage;
bool isItToBeLogged = (ruleMessage->m_saveMessage && (m_chainedRuleParent == nullptr));
if (isItToBeLogged && !m_containsMultiMatchAction) {
/* warn */
trans->m_rulesMessages.push_back(*ruleMessage);
Expand Down
6 changes: 3 additions & 3 deletions src/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,9 @@ int Transaction::addRequestHeader(const std::string& key,

std::vector<std::string> cookies = utils::string::ssplit(value, ';');

// Get rid of any optional whitespace after the cookie-string
// (i.e. after the end of the final cookie-pair)
if (!cookies.empty()) {
// Get rid of any optional whitespace after the cookie-string
// (i.e. after the end of the final cookie-pair)
std::string& final_cookie_pair = cookies.back();
while (!final_cookie_pair.empty() && isspace(final_cookie_pair.back())) {
final_cookie_pair.pop_back();
Expand Down Expand Up @@ -586,7 +586,7 @@ int Transaction::addRequestHeader(const std::string& key,
}

// ltrim the key - following the modsec v2 way
while (ckey.empty() == false && ckey.at(0) == ' ') {
while (ckey.empty() == false && isspace(ckey.at(0))) {
ckey.erase(0, 1);
localOffset++;
}
Expand Down