mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Adds support for multipart vars on the parser
This commit is contained in:
47
src/variables/multipart_boundary_quoted.h
Normal file
47
src/variables/multipart_boundary_quoted.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* If any of the files related to licensing are missing or if you have any
|
||||
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||
* directly using the email address security@modsecurity.org.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
#ifndef SRC_VARIABLES_MULTIPART_BOUNDARY_QUOTED_H_
|
||||
#define SRC_VARIABLES_MULTIPART_BOUNDARY_QUOTED_H_
|
||||
|
||||
#include "src/variables/variable.h"
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
class Transaction;
|
||||
namespace Variables {
|
||||
|
||||
class MultipartBoundaryQuoted : public Variable {
|
||||
public:
|
||||
MultipartBoundaryQuoted()
|
||||
: Variable("MULTIPART_BOUNDARY_QUOTED") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) {
|
||||
transaction->m_variableMultipartBoundaryQuoted.evaluate(l);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Variables
|
||||
} // namespace modsecurity
|
||||
|
||||
#endif // SRC_VARIABLES_MULTIPART_BOUNDARY_QUOTED_H_
|
47
src/variables/multipart_boundary_whitespace.h
Normal file
47
src/variables/multipart_boundary_whitespace.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* If any of the files related to licensing are missing or if you have any
|
||||
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||
* directly using the email address security@modsecurity.org.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
#ifndef SRC_VARIABLES_MULTIPART_BOUNDARY_WHITESPACE_H_
|
||||
#define SRC_VARIABLES_MULTIPART_BOUNDARY_WHITESPACE_H_
|
||||
|
||||
#include "src/variables/variable.h"
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
class Transaction;
|
||||
namespace Variables {
|
||||
|
||||
class MultipartBoundaryWhiteSpace : public Variable {
|
||||
public:
|
||||
MultipartBoundaryWhiteSpace()
|
||||
: Variable("MULTIPART_BOUNDARY_WHITESPACE") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) {
|
||||
transaction->m_variableMultipartBoundaryWhiteSpace.evaluate(l);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Variables
|
||||
} // namespace modsecurity
|
||||
|
||||
#endif // SRC_VARIABLES_MULTIPART_BOUNDARY_WHITESPACE_H_
|
47
src/variables/multipart_data_before.h
Normal file
47
src/variables/multipart_data_before.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* If any of the files related to licensing are missing or if you have any
|
||||
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||
* directly using the email address security@modsecurity.org.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
#ifndef SRC_VARIABLES_MULTIPART_DATA_BEFORE_H_
|
||||
#define SRC_VARIABLES_MULTIPART_DATA_BEFORE_H_
|
||||
|
||||
#include "src/variables/variable.h"
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
class Transaction;
|
||||
namespace Variables {
|
||||
|
||||
class MultipartDateBefore : public Variable {
|
||||
public:
|
||||
MultipartDateBefore()
|
||||
: Variable("MULTIPART_DATA_BEFORE") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) {
|
||||
transaction->m_variableMultipartDataBefore.evaluate(l);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Variables
|
||||
} // namespace modsecurity
|
||||
|
||||
#endif // SRC_VARIABLES_MULTIPART_DATA_BEFORE_H_
|
@@ -39,7 +39,7 @@ class MultiPartFileName_DictElement : public Variable {
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_variableMultiPartFileName.resolve(m_dictElement, l);
|
||||
transaction->m_variableMultipartFileName.resolve(m_dictElement, l);
|
||||
}
|
||||
|
||||
std::string m_dictElement;
|
||||
@@ -54,7 +54,7 @@ class MultiPartFileName_NoDictElement : public Variable {
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_variableMultiPartFileName.resolve(l);
|
||||
transaction->m_variableMultipartFileName.resolve(l);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ class MultiPartFileName_DictElementRegexp : public Variable {
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_variableMultiPartFileName.resolveRegularExpression(
|
||||
transaction->m_variableMultipartFileName.resolveRegularExpression(
|
||||
&m_r, l);
|
||||
}
|
||||
|
||||
|
47
src/variables/multipart_invalid_part.h
Normal file
47
src/variables/multipart_invalid_part.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* If any of the files related to licensing are missing or if you have any
|
||||
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||
* directly using the email address security@modsecurity.org.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
#ifndef SRC_VARIABLES_MULTIPART_INVALID_PART_H_
|
||||
#define SRC_VARIABLES_MULTIPART_INVALID_PART_H_
|
||||
|
||||
#include "src/variables/variable.h"
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
class Transaction;
|
||||
namespace Variables {
|
||||
|
||||
class MultipartInvalidPart : public Variable {
|
||||
public:
|
||||
MultipartInvalidPart()
|
||||
: Variable("MULTIPART_INVALID_PART") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) {
|
||||
transaction->m_variableMultipartInvalidPart.evaluate(l);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Variables
|
||||
} // namespace modsecurity
|
||||
|
||||
#endif // SRC_VARIABLES_MULTIPART_INVALID_PART_H_
|
47
src/variables/multipart_lf_line.h
Normal file
47
src/variables/multipart_lf_line.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* If any of the files related to licensing are missing or if you have any
|
||||
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||
* directly using the email address security@modsecurity.org.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
#ifndef SRC_VARIABLES_MULTIPART_LF_LINE_H_
|
||||
#define SRC_VARIABLES_MULTIPART_LF_LINE_H_
|
||||
|
||||
#include "src/variables/variable.h"
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
class Transaction;
|
||||
namespace Variables {
|
||||
|
||||
class MultipartLFLine : public Variable {
|
||||
public:
|
||||
MultipartLFLine()
|
||||
: Variable("MULTIPART_LF_LINE") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) {
|
||||
transaction->m_variableMultipartLFLine.evaluate(l);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Variables
|
||||
} // namespace modsecurity
|
||||
|
||||
#endif // SRC_VARIABLES_MULTIPART_LF_LINE_H_
|
47
src/variables/multipart_missing_semicolon.h
Normal file
47
src/variables/multipart_missing_semicolon.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* If any of the files related to licensing are missing or if you have any
|
||||
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
||||
* directly using the email address security@modsecurity.org.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
#ifndef SRC_VARIABLES_MULTIPART_MISSING_SEMICOLON_H_
|
||||
#define SRC_VARIABLES_MULTIPART_MISSING_SEMICOLON_H_
|
||||
|
||||
#include "src/variables/variable.h"
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
class Transaction;
|
||||
namespace Variables {
|
||||
|
||||
class MultipartMissingSemicolon : public Variable {
|
||||
public:
|
||||
MultipartMissingSemicolon()
|
||||
: Variable("MULTIPART_MISSING_SEMICOLON") { }
|
||||
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) {
|
||||
transaction->m_variableMultipartMissingSemicolon.evaluate(l);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Variables
|
||||
} // namespace modsecurity
|
||||
|
||||
#endif // SRC_VARIABLES_MULTIPART_MISSING_SEMICOLON_H_
|
@@ -39,7 +39,7 @@ class MultiPartName_DictElement : public Variable {
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_variableMultiPartName.resolve(m_dictElement, l);
|
||||
transaction->m_variableMultipartName.resolve(m_dictElement, l);
|
||||
}
|
||||
|
||||
std::string m_dictElement;
|
||||
@@ -54,7 +54,7 @@ class MultiPartName_NoDictElement : public Variable {
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_variableMultiPartName.resolve(l);
|
||||
transaction->m_variableMultipartName.resolve(l);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ class MultiPartName_DictElementRegexp : public Variable {
|
||||
void evaluate(Transaction *transaction,
|
||||
Rule *rule,
|
||||
std::vector<const collection::Variable *> *l) override {
|
||||
transaction->m_variableMultiPartName.resolveRegularExpression(
|
||||
transaction->m_variableMultipartName.resolveRegularExpression(
|
||||
&m_r, l);
|
||||
}
|
||||
|
||||
|
@@ -218,9 +218,9 @@ class Variable {
|
||||
} else if (comp(col, "FILES_TMP_CONTENT")) {
|
||||
t->m_variableFilesTmpContent.resolve(var, l);
|
||||
} else if (comp(col, "MULTIPART_FILENAME")) {
|
||||
t->m_variableMultiPartFileName.resolve(var, l);
|
||||
t->m_variableMultipartFileName.resolve(var, l);
|
||||
} else if (comp(col, "MULTIPART_NAME")) {
|
||||
t->m_variableMultiPartName.resolve(var, l);
|
||||
t->m_variableMultipartName.resolve(var, l);
|
||||
} else if (comp(col, "MATCHED_VARS_NAMES")) {
|
||||
t->m_variableMatchedVarsNames.resolve(var, l);
|
||||
} else if (comp(col, "MATCHED_VARS")) {
|
||||
@@ -383,9 +383,9 @@ class Variable {
|
||||
} else if (comp(col, "FILES_TMP_CONTENT")) {
|
||||
vv = t->m_variableFilesTmpContent.resolveFirst(var);
|
||||
} else if (comp(col, "MULTIPART_FILENAME")) {
|
||||
vv = t->m_variableMultiPartFileName.resolveFirst(var);
|
||||
vv = t->m_variableMultipartFileName.resolveFirst(var);
|
||||
} else if (comp(col, "MULTIPART_NAME")) {
|
||||
vv = t->m_variableMultiPartName.resolveFirst(var);
|
||||
vv = t->m_variableMultipartName.resolveFirst(var);
|
||||
} else if (comp(col, "MATCHED_VARS_NAMES")) {
|
||||
vv = t->m_variableMatchedVarsNames.resolveFirst(var);
|
||||
} else if (comp(col, "MATCHED_VARS")) {
|
||||
|
Reference in New Issue
Block a user