mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-29 11:16:30 +03:00
Apr 27th Update
This commit is contained in:
@@ -18,7 +18,9 @@ class I_LocalPolicyMgmtGen
|
||||
{
|
||||
public:
|
||||
virtual std::string parsePolicy(const std::string &policy_version) = 0;
|
||||
virtual const std::string & getPolicyPath(void) const = 0;
|
||||
virtual const std::string & getAgentPolicyPath(void) const = 0;
|
||||
virtual const std::string & getLocalPolicyPath(void) const = 0;
|
||||
virtual void setPolicyPath(const std::string &new_local_policy_path) = 0;
|
||||
|
||||
protected:
|
||||
~I_LocalPolicyMgmtGen() {}
|
||||
|
@@ -27,12 +27,13 @@ class PMPattern
|
||||
{
|
||||
public:
|
||||
PMPattern() {}
|
||||
PMPattern(const std::string &pat, bool start, bool end, uint index = 0)
|
||||
PMPattern(const std::string &pat, bool start, bool end, uint index = 0, bool noRegex = false)
|
||||
:
|
||||
pattern(pat),
|
||||
match_start(start),
|
||||
match_end(end),
|
||||
index(index)
|
||||
index(index),
|
||||
noRegex(noRegex)
|
||||
{}
|
||||
|
||||
bool operator<(const PMPattern &other) const;
|
||||
@@ -44,18 +45,20 @@ public:
|
||||
size_t size() const { return pattern.size(); }
|
||||
bool empty() const { return pattern.empty(); }
|
||||
uint getIndex() const { return index; }
|
||||
bool isNoRegex() const { return noRegex; }
|
||||
|
||||
private:
|
||||
std::string pattern;
|
||||
bool match_start = false;
|
||||
bool match_end = false;
|
||||
uint index;
|
||||
bool noRegex = false;
|
||||
};
|
||||
|
||||
class I_PMScan
|
||||
{
|
||||
public:
|
||||
using CBFunction = std::function<void(uint, const PMPattern &)>;
|
||||
using CBFunction = std::function<void(uint, const PMPattern &, bool)>;
|
||||
|
||||
virtual std::set<PMPattern> scanBuf(const Buffer &buf) const = 0;
|
||||
virtual std::set<std::pair<uint, uint>> scanBufWithOffset(const Buffer &buf) const = 0;
|
||||
|
@@ -47,6 +47,10 @@ public:
|
||||
const bool last_iteration = false
|
||||
) = 0;
|
||||
|
||||
virtual bool doesFailedServicesExist() = 0;
|
||||
|
||||
virtual void clearFailedServices() = 0;
|
||||
|
||||
virtual bool isServiceInstalled(const std::string &service_name) = 0;
|
||||
|
||||
virtual void registerServiceConfig(
|
||||
|
33
components/include/layer_7_access_control.h
Normal file
33
components/include/layer_7_access_control.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef __LAYER_7_ACCESS_CONTROL_H__
|
||||
#define __LAYER_7_ACCESS_CONTROL_H__
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "singleton.h"
|
||||
#include "i_mainloop.h"
|
||||
#include "component.h"
|
||||
#include "i_intelligence_is_v2.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class Layer7AccessControl
|
||||
:
|
||||
public Component,
|
||||
Singleton::Consume<I_MainLoop>,
|
||||
Singleton::Consume<I_TimeGet>,
|
||||
Singleton::Consume<I_Intelligence_IS_V2>,
|
||||
Singleton::Consume<I_Environment>
|
||||
{
|
||||
public:
|
||||
Layer7AccessControl();
|
||||
~Layer7AccessControl();
|
||||
|
||||
void init() override;
|
||||
void fini() override;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> pimpl;
|
||||
};
|
||||
|
||||
#endif // __LAYER_7_ACCESS_CONTROL_H__
|
19
components/include/mock/mock_http_manager.h
Executable file
19
components/include/mock/mock_http_manager.h
Executable file
@@ -0,0 +1,19 @@
|
||||
#ifndef __MOCK_HTTP_MANAGER_H__
|
||||
#define __MOCK_HTTP_MANAGER_H__
|
||||
|
||||
#include "i_http_manager.h"
|
||||
#include "cptest.h"
|
||||
|
||||
class MockHttpManager : public Singleton::Provide<I_HttpManager>::From<MockProvider<I_HttpManager>>
|
||||
{
|
||||
public:
|
||||
MOCK_METHOD1(inspect, FilterVerdict(const HttpTransactionData &));
|
||||
MOCK_METHOD2(inspect, FilterVerdict(const HttpHeader &, bool is_request));
|
||||
MOCK_METHOD2(inspect, FilterVerdict(const HttpBody &, bool is_request));
|
||||
MOCK_METHOD0(inspectEndRequest, FilterVerdict());
|
||||
MOCK_METHOD1(inspect, FilterVerdict(const ResponseCode &));
|
||||
MOCK_METHOD0(inspectEndTransaction, FilterVerdict());
|
||||
MOCK_METHOD0(inspectDelayedVerdict, FilterVerdict());
|
||||
};
|
||||
|
||||
#endif // __MOCK_HTTP_MANAGER_H__
|
Reference in New Issue
Block a user