mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-29 19:24:26 +03:00
Aug 20th update
This commit is contained in:
@@ -57,7 +57,6 @@ private:
|
||||
std::vector<std::string> filesPathsList;
|
||||
};
|
||||
|
||||
|
||||
class I_Serializable {
|
||||
public:
|
||||
virtual void serialize(std::ostream& stream) = 0;
|
||||
|
@@ -397,7 +397,7 @@ SerializeToLocalAndRemoteSyncBase::SerializeToLocalAndRemoteSyncBase(
|
||||
const string &owner
|
||||
) :
|
||||
SerializeToFileBase(filePath),
|
||||
m_remotePath(remotePath),
|
||||
m_remotePath(replaceAllCopy(remotePath, "//", "/")),
|
||||
m_interval(0),
|
||||
m_owner(owner),
|
||||
m_pMainLoop(nullptr),
|
||||
@@ -407,7 +407,7 @@ SerializeToLocalAndRemoteSyncBase::SerializeToLocalAndRemoteSyncBase(
|
||||
m_windowsCount(0),
|
||||
m_intervalsCounter(0),
|
||||
m_remoteSyncEnabled(true),
|
||||
m_assetId(assetId),
|
||||
m_assetId(replaceAllCopy(assetId, "/", "")),
|
||||
m_isAssetIdUuid(Waap::Util::isUuid(assetId)),
|
||||
m_shared_storage_host(genError("not set")),
|
||||
m_learning_host(genError("not set"))
|
||||
@@ -439,7 +439,7 @@ SerializeToLocalAndRemoteSyncBase::SerializeToLocalAndRemoteSyncBase(
|
||||
}
|
||||
if (remotePath != "") {
|
||||
// remote path is /<tenantId>/<assetId>/<type>
|
||||
auto parts = split(remotePath, '/');
|
||||
auto parts = split(m_remotePath, '/');
|
||||
if (parts.size() > 2) {
|
||||
size_t offset = 0;
|
||||
if (parts[0].empty()) {
|
||||
@@ -656,8 +656,7 @@ void SerializeToLocalAndRemoteSyncBase::syncWorker()
|
||||
OrchestrationMode mode = Singleton::exists<I_AgentDetails>() ?
|
||||
Singleton::Consume<I_AgentDetails>::by<WaapComponent>()->getOrchestrationMode() : OrchestrationMode::ONLINE;
|
||||
|
||||
if (mode == OrchestrationMode::OFFLINE || !m_remoteSyncEnabled || isBase() ||
|
||||
(mode == OrchestrationMode::ONLINE && !m_isAssetIdUuid) || !postData()) {
|
||||
if (mode == OrchestrationMode::OFFLINE || !m_remoteSyncEnabled || isBase() || !postData()) {
|
||||
dbgDebug(D_WAAP_CONFIDENCE_CALCULATOR)
|
||||
<< "Did not synchronize the data. for asset: "
|
||||
<< m_assetId
|
||||
|
@@ -37,7 +37,14 @@ WaapTelemetryBase::sendLog(const LogRest &metric_client_rest) const
|
||||
if (mode == OrchestrationMode::ONLINE) {
|
||||
return;
|
||||
}
|
||||
auto svc_host = getConfigurationWithDefault(default_host, "Logging", "K8sSvc Log host");
|
||||
const char* host_env_var = getenv("TUNING_HOST");
|
||||
string host;
|
||||
if (host_env_var != nullptr && strlen(host_env_var) > 0) {
|
||||
host = string(host_env_var);
|
||||
} else {
|
||||
host = default_host;
|
||||
}
|
||||
auto svc_host = getConfigurationWithDefault(host, "Logging", "Container Log host");
|
||||
string fog_metric_uri = getConfigurationWithDefault<string>("/api/v1/agents/events", "metric", "fogMetricUri");
|
||||
MessageMetadata req_md(svc_host, 80);
|
||||
req_md.insertHeader(
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "i_mainloop.h"
|
||||
#include "i_serialize.h"
|
||||
#include "waap.h"
|
||||
#include "Waf2Util.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -25,7 +26,7 @@ USE_DEBUG_FLAG(D_WAAP);
|
||||
|
||||
TuningDecision::TuningDecision(const string& remotePath)
|
||||
:
|
||||
m_remotePath(remotePath + "/tuning"),
|
||||
m_remotePath(replaceAllCopy(remotePath + "/tuning", "//", "/")),
|
||||
m_baseUri()
|
||||
{
|
||||
if (remotePath == "")
|
||||
|
@@ -733,6 +733,12 @@ inline void replaceAll(std::string& str, const std::string& from, const std::str
|
||||
start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx'
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string replaceAllCopy(std::string str, const std::string& from, const std::string& to) {
|
||||
replaceAll(str, from, to);
|
||||
return str;
|
||||
}
|
||||
|
||||
inline void alignBase64Chunk (std::string &chunk)
|
||||
{
|
||||
size_t len = chunk.length() % 4;
|
||||
|
Reference in New Issue
Block a user