mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Replaces getKeyWithCollection with getName on VariableValue
This commit is contained in:
parent
c5beb0d15a
commit
60d89608be
@ -74,26 +74,27 @@ class VariableValue {
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& getKey() const {
|
||||
return m_key;
|
||||
}
|
||||
|
||||
|
||||
const std::string& getKeyWithCollection() const {
|
||||
const std::string& getName() const noexcept {
|
||||
return m_keyWithCollection;
|
||||
}
|
||||
|
||||
|
||||
const std::string& getCollection() const {
|
||||
return m_collection;
|
||||
}
|
||||
|
||||
|
||||
const std::string& getValue() const {
|
||||
const std::string& getValue() const noexcept {
|
||||
return m_value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const std::string& getKey() const {
|
||||
return m_key;
|
||||
}
|
||||
|
||||
const std::string& getCollection() const {
|
||||
return m_collection;
|
||||
}
|
||||
|
||||
void setValue(const std::string &value) {
|
||||
m_value = value;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ int Lua::getvars(lua_State *L) {
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushstring(L, "name");
|
||||
lua_pushlstring(L, i->getKeyWithCollection().c_str(), i->getKeyWithCollection().size());
|
||||
lua_pushlstring(L, i->getName().c_str(), i->getName().size());
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_pushstring(L, "value");
|
||||
|
@ -87,7 +87,7 @@ std::string Operator::resolveMatchMessage(Transaction *t,
|
||||
std::string ret = m_match_message;
|
||||
|
||||
if (ret.empty() == true) {
|
||||
const std::string &key = v->getKeyWithCollection();
|
||||
const std::string &key = v->getName();
|
||||
const std::string &value = v->getValue();
|
||||
if (m_couldContainsMacro == false) {
|
||||
ret = "Matched \"Operator `" + m_op + "' with parameter `" +
|
||||
|
@ -81,7 +81,7 @@ RuleWithOperator::~RuleWithOperator() {
|
||||
void RuleWithOperator::updateMatchedVars(Transaction *trans,
|
||||
const VariableValue *v,
|
||||
const bpstd::string_view &value) {
|
||||
const std::string &key = v->getKeyWithCollection();
|
||||
const std::string &key = v->getName();
|
||||
ms_dbg_a(trans, 9, "Matched vars updated.");
|
||||
trans->m_variableMatchedVar.set(value, trans->m_variableOffset);
|
||||
trans->m_variableMatchedVarName.set(key, trans->m_variableOffset);
|
||||
@ -113,7 +113,7 @@ bool RuleWithOperator::executeOperatorAt(Transaction *trans,
|
||||
ms_dbg_a(trans, 9, "Target value: \"" \
|
||||
+ utils::string::limitTo(80,
|
||||
utils::string::toHexIfNeeded(value.to_string())) \
|
||||
+ "\" (Variable: " + v->getKeyWithCollection() + ")");
|
||||
+ "\" (Variable: " + v->getName() + ")");
|
||||
|
||||
ret = m_operator->evaluateInternal(trans, this, value, trans->messageGetLast());
|
||||
|
||||
@ -282,7 +282,7 @@ bool RuleWithOperator::evaluate(Transaction *trans) const {
|
||||
std::find_if(trans->m_ruleRemoveTargetById.begin(),
|
||||
trans->m_ruleRemoveTargetById.end(),
|
||||
[&, v, this](std::pair<int, std::string> &m) -> bool {
|
||||
return m.first == getId() && m.second == v->getKeyWithCollection();
|
||||
return m.first == getId() && m.second == v->getName();
|
||||
}) != trans->m_ruleRemoveTargetById.end()
|
||||
) {
|
||||
continue;
|
||||
@ -292,7 +292,7 @@ bool RuleWithOperator::evaluate(Transaction *trans) const {
|
||||
std::find_if(trans->m_ruleRemoveTargetByTag.begin(),
|
||||
trans->m_ruleRemoveTargetByTag.end(),
|
||||
[&, v, trans, this](std::pair<std::string, std::string> &m) -> bool {
|
||||
return containsTag(m.first, trans) && m.second == v->getKeyWithCollection();
|
||||
return containsTag(m.first, trans) && m.second == v->getName();
|
||||
}) != trans->m_ruleRemoveTargetByTag.end()
|
||||
) {
|
||||
continue;
|
||||
|
@ -1563,7 +1563,7 @@ std::string Transaction::toOldAuditLogFormat(int parts,
|
||||
m_variableRequestHeaders.resolve(&l);
|
||||
for (const auto &h : l) {
|
||||
size_t pos = strlen("REQUEST_HEADERS:");
|
||||
audit_log << h->getKeyWithCollection().c_str() + pos << ": ";
|
||||
audit_log << h->getName().c_str() + pos << ": ";
|
||||
audit_log << h->getValue().c_str() << std::endl;
|
||||
}
|
||||
audit_log << std::endl;
|
||||
|
@ -63,7 +63,7 @@ void RemoteUser::evaluate(Transaction *transaction,
|
||||
}
|
||||
transaction->m_variableRemoteUser.assign(std::string(base64, 0, pos));
|
||||
|
||||
auto var = std::make_shared<VariableValue>(&l2[0]->getKeyWithCollection(), &transaction->m_variableRemoteUser);
|
||||
auto var = std::make_shared<VariableValue>(&l2[0]->getName(), &transaction->m_variableRemoteUser);
|
||||
|
||||
for (auto &i : l2[0]->getOrigin()) {
|
||||
var->addOrigin(i);
|
||||
|
@ -701,7 +701,7 @@ class Variables : public std::vector<Variable *> {
|
||||
if (r) {
|
||||
return r->m_r.searchAll(v->getKey()).size() > 0;
|
||||
}
|
||||
return v->getKeyWithCollection() == *m->getVariableKeyWithCollection();
|
||||
return v->getName() == *m->getVariableKeyWithCollection();
|
||||
}) != end();
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user