mirror of
https://github.com/openappsec/openappsec.git
synced 2026-01-17 16:00:26 +03:00
Jan 06 2026 dev (#387)
* sync code * update code to support brotli * update code to support brotli * update code to support brotli * sync code * fix findBrotli * sync code * sync code * sync code * sync code --------- Co-authored-by: Ned Wright <nedwright@proton.me> Co-authored-by: Daniel Eisenberg <danielei@checkpoint.com>
This commit is contained in:
@@ -22,9 +22,13 @@
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
// Forward declaration for test friend class
|
||||
class TestableRegexPreconditions;
|
||||
|
||||
namespace Waap {
|
||||
class RegexPreconditions
|
||||
{
|
||||
friend class TestableRegexPreconditions; // Allow test access to private methods
|
||||
public:
|
||||
typedef size_t WordIndex;
|
||||
static const WordIndex emptyWordIndex; // special word index used to index the "impossible" empty word
|
||||
@@ -37,8 +41,29 @@ namespace Waap {
|
||||
public:
|
||||
typedef std::unordered_set<WordIndex> PmWordSet;
|
||||
|
||||
struct WordInfo {
|
||||
WordIndex napostNapreWordIndex;
|
||||
WordIndex napostWordIndex;
|
||||
WordIndex napreWordIndex;
|
||||
WordIndex baseWordIndex;
|
||||
std::string wordStr;
|
||||
bool noRegex;
|
||||
|
||||
WordInfo()
|
||||
:
|
||||
napostNapreWordIndex(emptyWordIndex),
|
||||
napostWordIndex(emptyWordIndex),
|
||||
napreWordIndex(emptyWordIndex),
|
||||
baseWordIndex(0),
|
||||
wordStr(),
|
||||
noRegex(false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// The constructor builds internal data from Json object. Once built - the object becomes read-only.
|
||||
RegexPreconditions(const picojson::value::object &jsObj, bool &error);
|
||||
~RegexPreconditions();
|
||||
bool isNoRegexPattern(const std::string &pattern) const;
|
||||
const std::string &getWordStrByWordIndex(WordIndex wordIndex) const;
|
||||
Waap::RegexPreconditions::WordIndex getWordByRegex(const std::string &pattern) const;
|
||||
@@ -61,26 +86,6 @@ namespace Waap {
|
||||
// Aho-Corasick pattern matcher object
|
||||
PMHook m_pmHook;
|
||||
|
||||
struct WordInfo {
|
||||
WordIndex napostNapreWordIndex;
|
||||
WordIndex napostWordIndex;
|
||||
WordIndex napreWordIndex;
|
||||
WordIndex baseWordIndex;
|
||||
std::string wordStr;
|
||||
bool noRegex;
|
||||
|
||||
WordInfo()
|
||||
:
|
||||
napostNapreWordIndex(emptyWordIndex),
|
||||
napostWordIndex(emptyWordIndex),
|
||||
napreWordIndex(emptyWordIndex),
|
||||
baseWordIndex(0),
|
||||
wordStr(),
|
||||
noRegex(false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
WordIndex registerWord(const std::string &wordStr);
|
||||
std::vector<WordInfo> m_pmWordInfo;
|
||||
std::map<std::string, WordIndex> m_wordStrToIndex; // TODO:: remove this into throwaway object, no need to keep
|
||||
|
||||
Reference in New Issue
Block a user