mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 21:36:00 +03:00
Adds support to base64 decode transformation
This commit is contained in:
parent
348cf3bfab
commit
e48f468cbc
@ -24,30 +24,22 @@
|
||||
|
||||
#include "modsecurity/transaction.h"
|
||||
#include "actions/transformations/transformation.h"
|
||||
#include "utils/base64.h"
|
||||
|
||||
|
||||
namespace modsecurity {
|
||||
namespace actions {
|
||||
namespace transformations {
|
||||
|
||||
Base64Decode::Base64Decode(std::string action)
|
||||
: Transformation(action) {
|
||||
this->action_kind = 1;
|
||||
}
|
||||
|
||||
std::string Base64Decode::evaluate(std::string value,
|
||||
Transaction *transaction) {
|
||||
/**
|
||||
* @todo Implement the transformation base64decode
|
||||
*/
|
||||
if (transaction) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(4, "Transformation 64 is not implemented yet.");
|
||||
#endif
|
||||
}
|
||||
return value;
|
||||
std::string ret = Utils::Base64::decode(value);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
} // namespace transformations
|
||||
} // namespace actions
|
||||
} // namespace modsecurity
|
||||
|
@ -30,7 +30,8 @@ namespace transformations {
|
||||
|
||||
class Base64Decode : public Transformation {
|
||||
public:
|
||||
explicit Base64Decode(std::string action);
|
||||
explicit Base64Decode(std::string action) : Transformation(action) { };
|
||||
|
||||
std::string evaluate(std::string exp,
|
||||
Transaction *transaction) override;
|
||||
};
|
||||
|
@ -74,7 +74,7 @@ std::string Transformation::evaluate(std::string value,
|
||||
|
||||
Transformation* Transformation::instantiate(std::string a) {
|
||||
IF_MATCH(base64_decode_ext) { return new Base64DecodeExt(a); }
|
||||
IF_MATCH(base64_decode) { return new Base64Decode(a); }
|
||||
IF_MATCH(base64Decode) { return new Base64Decode(a); }
|
||||
IF_MATCH(cmd_line) { return new CmdLine(a); }
|
||||
IF_MATCH(compress_whitespace) { return new CompressWhitespace(a); }
|
||||
IF_MATCH(cssDecode) { return new CssDecode(a); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user