Support expirevar for in-memory collection

This commit is contained in:
Martin Vierula
2023-09-29 10:58:43 -07:00
parent 135d1fa42b
commit 118e1b3a44
23 changed files with 5305 additions and 5195 deletions

View File

@@ -1,6 +1,6 @@
/*
* ModSecurity, http://www.modsecurity.org/
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
* Copyright (c) 2015 - 2023 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
@@ -13,7 +13,6 @@
*
*/
#include <iostream>
#include <list>
#include <memory>
#include <string>
@@ -106,6 +105,12 @@ class Global_DynamicElement : public Variable {
t->m_rules->m_secWebAppId.m_value);
}
static void setExpiry(Transaction *t, const std::string &k, int32_t expiry_seconds) {
t->m_collections.m_global_collection->setExpiry(k,
t->m_collections.m_global_collection_key,
t->m_rules->m_secWebAppId.m_value, expiry_seconds);
}
static void storeOrUpdateFirst(Transaction *t, const std::string &var,
const std::string &value) {
t->m_collections.m_global_collection->storeOrUpdateFirst(

View File

@@ -1,6 +1,6 @@
/*
* ModSecurity, http://www.modsecurity.org/
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
* Copyright (c) 2015 - 2023 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
@@ -13,7 +13,6 @@
*
*/
#include <iostream>
#include <list>
#include <memory>
#include <string>
@@ -105,6 +104,12 @@ class Ip_DynamicElement : public Variable {
t->m_rules->m_secWebAppId.m_value);
}
static void setExpiry(Transaction *t, const std::string &k, int32_t expiry_seconds) {
t->m_collections.m_ip_collection->setExpiry(k,
t->m_collections.m_ip_collection_key,
t->m_rules->m_secWebAppId.m_value, expiry_seconds);
}
static void storeOrUpdateFirst(Transaction *t, const std::string &var,
const std::string &value) {
t->m_collections.m_ip_collection->storeOrUpdateFirst(

View File

@@ -1,6 +1,6 @@
/*
* ModSecurity, http://www.modsecurity.org/
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
* Copyright (c) 2015 - 2023 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
@@ -13,7 +13,6 @@
*
*/
#include <iostream>
#include <list>
#include <memory>
#include <string>
@@ -105,6 +104,13 @@ class Resource_DynamicElement : public Variable {
t->m_rules->m_secWebAppId.m_value);
}
static void setExpiry(Transaction *t, const std::string &k, int32_t expiry_seconds) {
t->m_collections.m_resource_collection->setExpiry(k,
t->m_collections.m_resource_collection_key,
t->m_rules->m_secWebAppId.m_value, expiry_seconds);
}
static void storeOrUpdateFirst(Transaction *t, const std::string &var,
const std::string &value) {
t->m_collections.m_resource_collection->storeOrUpdateFirst(

View File

@@ -1,6 +1,6 @@
/*
* ModSecurity, http://www.modsecurity.org/
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
* Copyright (c) 2015 - 2023 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
@@ -13,7 +13,6 @@
*
*/
#include <iostream>
#include <list>
#include <memory>
#include <string>
@@ -105,6 +104,12 @@ class Session_DynamicElement : public Variable {
t->m_collections.m_ip_collection_key);
}
static void setExpiry(Transaction *t, const std::string &k, int32_t expiry_seconds) {
t->m_collections.m_session_collection->setExpiry(k,
t->m_collections.m_session_collection_key,
t->m_rules->m_secWebAppId.m_value, expiry_seconds);
}
static void storeOrUpdateFirst(Transaction *t, const std::string &var,
const std::string &value) {
t->m_collections.m_session_collection->storeOrUpdateFirst(

View File

@@ -1,6 +1,6 @@
/*
* ModSecurity, http://www.modsecurity.org/
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
* Copyright (c) 2015 - 2023 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
@@ -13,7 +13,6 @@
*
*/
#include <iostream>
#include <list>
#include <memory>
#include <string>
@@ -105,6 +104,12 @@ class User_DynamicElement : public Variable {
t->m_rules->m_secWebAppId.m_value);
}
static void setExpiry(Transaction *t, const std::string &k, int32_t expiry_seconds) {
t->m_collections.m_user_collection->setExpiry(k,
t->m_collections.m_user_collection_key,
t->m_rules->m_secWebAppId.m_value, expiry_seconds);
}
static void storeOrUpdateFirst(Transaction *t, const std::string &var,
const std::string &value) {
t->m_collections.m_user_collection->storeOrUpdateFirst(