mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 11:16:33 +03:00
Having _NAMES, variables proxied
Some variables share content with others; that is the case for ARGS and ARGS_NAMES. Those are different in value, as ARGS_NAMES holds the key name as value. Instead of duplicating the strings for the different collections, this patch unifies the collection in radix, avoiding memory fragmentation. It is currently doing some fragmentation while resolving the variable, but to be mitigated by shared_ptr is VariableValues, a different change. TODO: place others variables such as COOKIE*NAMES to use the same proxy.
This commit is contained in:
@@ -48,6 +48,7 @@ typedef struct Rules_t RulesSet;
|
||||
#include "modsecurity/variable_value.h"
|
||||
#include "modsecurity/collection/collection.h"
|
||||
#include "modsecurity/variable_origin.h"
|
||||
#include "modsecurity/anchored_set_variable_translation_proxy.h"
|
||||
|
||||
|
||||
#ifndef NO_LOGS
|
||||
@@ -121,10 +122,7 @@ class Operator;
|
||||
class TransactionAnchoredVariables {
|
||||
public:
|
||||
explicit TransactionAnchoredVariables(Transaction *t)
|
||||
: m_variableArgsNames(t, "ARGS_NAMES"),
|
||||
m_variableArgsGetNames(t, "ARGS_GET_NAMES"),
|
||||
m_variableArgsPostNames(t, "ARGS_POST_NAMES"),
|
||||
m_variableRequestHeadersNames(t, "REQUEST_HEADERS_NAMES"),
|
||||
: m_variableRequestHeadersNames(t, "REQUEST_HEADERS_NAMES"),
|
||||
m_variableResponseContentType(t, "RESPONSE_CONTENT_TYPE"),
|
||||
m_variableResponseHeadersNames(t, "RESPONSE_HEADERS_NAMES"),
|
||||
m_variableARGScombinedSize(t, "ARGS_COMBINED_SIZE"),
|
||||
@@ -202,12 +200,12 @@ class TransactionAnchoredVariables {
|
||||
m_variableGeo(t, "GEO"),
|
||||
m_variableRequestCookiesNames(t, "REQUEST_COOKIES_NAMES"),
|
||||
m_variableFilesTmpNames(t, "FILES_TMPNAMES"),
|
||||
m_variableOffset(0)
|
||||
m_variableOffset(0),
|
||||
m_variableArgsNames("ARGS_NAMES", &m_variableArgs),
|
||||
m_variableArgsGetNames("ARGS_GET_NAMES", &m_variableArgsGet),
|
||||
m_variableArgsPostNames("ARGS_POST_NAMES", &m_variableArgsPost)
|
||||
{ }
|
||||
|
||||
AnchoredSetVariable m_variableArgsNames;
|
||||
AnchoredSetVariable m_variableArgsGetNames;
|
||||
AnchoredSetVariable m_variableArgsPostNames;
|
||||
AnchoredSetVariable m_variableRequestHeadersNames;
|
||||
AnchoredVariable m_variableResponseContentType;
|
||||
AnchoredSetVariable m_variableResponseHeadersNames;
|
||||
@@ -285,6 +283,10 @@ class TransactionAnchoredVariables {
|
||||
AnchoredSetVariable m_variableFilesTmpNames;
|
||||
|
||||
int m_variableOffset;
|
||||
|
||||
AnchoredSetVariableTranslationProxy m_variableArgsNames;
|
||||
AnchoredSetVariableTranslationProxy m_variableArgsGetNames;
|
||||
AnchoredSetVariableTranslationProxy m_variableArgsPostNames;
|
||||
};
|
||||
|
||||
class TransactionSecMarkerManagement {
|
||||
|
Reference in New Issue
Block a user