Skip to content

Commit f999f54

Browse files
victorhoraFelipe Zimmerle
authored andcommitted
Adds support for ctl:requestBodyProcessor=URLENCODED
1 parent dc4382d commit f999f54

File tree

8 files changed

+6578
-6472
lines changed

8 files changed

+6578
-6472
lines changed

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ ACTIONS = \
112112
actions/ctl/rule_engine.cc \
113113
actions/ctl/request_body_processor_json.cc \
114114
actions/ctl/request_body_processor_xml.cc \
115+
actions/ctl/request_body_processor_urlencoded.cc \
115116
actions/ctl/rule_remove_target_by_tag.cc \
116117
actions/ctl/rule_remove_target_by_id.cc \
117118
actions/ctl/rule_remove_by_id.cc \
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* ModSecurity, http://www.modsecurity.org/
3+
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
4+
*
5+
* You may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* If any of the files related to licensing are missing or if you have any
11+
* other questions related to licensing please contact Trustwave Holdings, Inc.
12+
* directly using the email address [email protected].
13+
*
14+
*/
15+
16+
#include "src/actions/ctl/request_body_processor_urlencoded.h"
17+
18+
#include <iostream>
19+
#include <string>
20+
21+
#include "modsecurity/transaction.h"
22+
23+
namespace modsecurity {
24+
namespace actions {
25+
namespace ctl {
26+
27+
28+
bool RequestBodyProcessorURLENCODED::evaluate(Rule *rule,
29+
Transaction *transaction) {
30+
transaction->m_requestBodyProcessor = Transaction::WWWFormUrlEncoded;
31+
transaction->m_variableReqbodyProcessor.set("URLENCODED",
32+
transaction->m_variableOffset);
33+
34+
return true;
35+
}
36+
37+
38+
} // namespace ctl
39+
} // namespace actions
40+
} // namespace modsecurity
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* ModSecurity, http://www.modsecurity.org/
3+
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
4+
*
5+
* You may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* If any of the files related to licensing are missing or if you have any
11+
* other questions related to licensing please contact Trustwave Holdings, Inc.
12+
* directly using the email address [email protected].
13+
*
14+
*/
15+
16+
#include <string>
17+
18+
#include "modsecurity/actions/action.h"
19+
#include "modsecurity/transaction.h"
20+
21+
#ifndef SRC_ACTIONS_CTL_REQUEST_BODY_PROCESSOR_URLENCODED_H_
22+
#define SRC_ACTIONS_CTL_REQUEST_BODY_PROCESSOR_URLENCODED_H_
23+
24+
namespace modsecurity {
25+
namespace actions {
26+
namespace ctl {
27+
28+
29+
class RequestBodyProcessorURLENCODED : public Action {
30+
public:
31+
explicit RequestBodyProcessorURLENCODED(std::string action)
32+
: Action(action, RunTimeOnlyIfMatchKind) { }
33+
34+
bool evaluate(Rule *rule, Transaction *transaction) override;
35+
};
36+
37+
38+
} // namespace ctl
39+
} // namespace actions
40+
} // namespace modsecurity
41+
42+
#endif // SRC_ACTIONS_CTL_REQUEST_BODY_PROCESSOR_URLENCODED_H_

0 commit comments

Comments
 (0)