mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-29 19:24:26 +03:00
Jul 5th update
This commit is contained in:
@@ -208,12 +208,14 @@ void ConfidenceCalculator::pullProcessedData(const std::vector<std::string>& fil
|
||||
{
|
||||
dbgTrace(D_WAAP) << "Fetching the confidence set object";
|
||||
bool is_first_pull = true;
|
||||
bool is_ok = false;
|
||||
for (auto file : files)
|
||||
{
|
||||
ConfidenceFileDecryptor getConfFile;
|
||||
bool res = sendObjectWithRetry(getConfFile,
|
||||
I_Messaging::Method::GET,
|
||||
getUri() + "/" + file);
|
||||
is_ok |= res;
|
||||
if (res && getConfFile.getConfidenceSet().ok())
|
||||
{
|
||||
mergeFromRemote(getConfFile.getConfidenceSet().unpack(), is_first_pull);
|
||||
@@ -224,8 +226,8 @@ void ConfidenceCalculator::pullProcessedData(const std::vector<std::string>& fil
|
||||
m_confidence_level = getConfFile.getConfidenceLevels().unpackMove();
|
||||
}
|
||||
}
|
||||
// is_first_pull = false -> at least one file was downloaded and merged
|
||||
if (is_first_pull) {
|
||||
// is_ok = false -> no file was downloaded and merged
|
||||
if (!is_ok) {
|
||||
dbgError(D_WAAP_CONFIDENCE_CALCULATOR) << "Failed to get the remote state";
|
||||
}
|
||||
}
|
||||
|
@@ -151,9 +151,9 @@ void TrustedSourcesConfidenceCalculator::pullProcessedData(const std::vector<std
|
||||
bool res = sendObjectWithRetry(getTrustFile,
|
||||
I_Messaging::Method::GET,
|
||||
getUri() + "/" + file);
|
||||
pull_ok |= res;
|
||||
if (res && getTrustFile.getTrustedLogs().ok()) {
|
||||
mergeFromRemote(getTrustFile.getTrustedLogs().unpack());
|
||||
pull_ok = true;
|
||||
}
|
||||
}
|
||||
if (!pull_ok && !files.empty()) {
|
||||
|
@@ -101,6 +101,24 @@ inline unsigned char from_hex(unsigned char ch, bool &valid) {
|
||||
return ch;
|
||||
}
|
||||
|
||||
inline bool str_starts_with(const std::string& value, const std::string& prefix)
|
||||
{
|
||||
if (prefix.size() > value.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return value.compare(0, prefix.size(), prefix) == 0;
|
||||
}
|
||||
|
||||
inline bool str_ends_with(const std::string& value, const std::string& ending)
|
||||
{
|
||||
if (ending.size() > value.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return value.compare(value.size() - ending.size(), ending.size(), ending) == 0;
|
||||
}
|
||||
|
||||
template<class _IT>
|
||||
_IT unquote_plus(_IT first, _IT last, bool decodeUrl=true, bool decodePlus=true) {
|
||||
_IT result = first;
|
||||
|
@@ -89,6 +89,8 @@ WaapComponent::Impl::init(const std::string &waapDataFileName)
|
||||
|
||||
reputationAggregator.init();
|
||||
|
||||
waapStateTable = Singleton::Consume<I_Table>::by<WaapComponent>();
|
||||
|
||||
bool success = waf2_proc_start(waapDataFileName);
|
||||
if (!success) {
|
||||
dbgWarning(D_WAAP) << "WAF2 engine FAILED to initialize (probably failed to load signatures). Aborting!";
|
||||
@@ -101,8 +103,6 @@ WaapComponent::Impl::init(const std::string &waapDataFileName)
|
||||
I_StaticResourcesHandler *static_resources = Singleton::Consume<I_StaticResourcesHandler>::by<WaapComponent>();
|
||||
static_resources->registerStaticResource("cp-ab.js", "/etc/cp/conf/waap/cp-ab.js");
|
||||
static_resources->registerStaticResource("cp-csrf.js", "/etc/cp/conf/waap/cp-csrf.js");
|
||||
|
||||
waapStateTable = Singleton::Consume<I_Table>::by<WaapComponent>();
|
||||
}
|
||||
|
||||
// Called when component is shut down
|
||||
|
Reference in New Issue
Block a user