mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-05 16:50:34 +00:00
update(userspace/engine): avoid relying on leaked std namespace
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
@@ -52,7 +52,7 @@ struct falco_exception : std::exception
|
|||||||
|
|
||||||
namespace falco_common
|
namespace falco_common
|
||||||
{
|
{
|
||||||
const string syscall_source = "syscall";
|
const std::string syscall_source = "syscall";
|
||||||
|
|
||||||
// Same as numbers/indices into the above vector
|
// Same as numbers/indices into the above vector
|
||||||
enum priority_type
|
enum priority_type
|
||||||
|
@@ -150,7 +150,7 @@ public:
|
|||||||
// add k8s/mesos/container information to outputs when
|
// add k8s/mesos/container information to outputs when
|
||||||
// available.
|
// available.
|
||||||
//
|
//
|
||||||
void set_extra(string &extra, bool replace_container_info);
|
void set_extra(std::string &extra, bool replace_container_info);
|
||||||
|
|
||||||
// Represents the result of matching an event against a set of
|
// Represents the result of matching an event against a set of
|
||||||
// rules.
|
// rules.
|
||||||
@@ -284,7 +284,7 @@ private:
|
|||||||
stats_manager m_rule_stats_manager;
|
stats_manager m_rule_stats_manager;
|
||||||
|
|
||||||
uint16_t m_next_ruleset_id;
|
uint16_t m_next_ruleset_id;
|
||||||
std::map<string, uint16_t> m_known_rulesets;
|
std::map<std::string, uint16_t> m_known_rulesets;
|
||||||
falco_common::priority_type m_min_priority;
|
falco_common::priority_type m_min_priority;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -33,7 +33,7 @@ public:
|
|||||||
const std::string &level, const std::string &format, std::set<std::string> &tags,
|
const std::string &level, const std::string &format, std::set<std::string> &tags,
|
||||||
const std::string &hostname) const;
|
const std::string &hostname) const;
|
||||||
|
|
||||||
map<string, string> get_field_values(gen_event *evt, const std::string &source,
|
std::map<std::string, std::string> get_field_values(gen_event *evt, const std::string &source,
|
||||||
const std::string &format) const ;
|
const std::string &format) const ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -67,7 +67,7 @@ public:
|
|||||||
std::string& out) const;
|
std::string& out) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
atomic<uint64_t> m_total;
|
std::atomic<uint64_t> m_total;
|
||||||
std::vector<std::unique_ptr<atomic<uint64_t>>> m_by_priority;
|
std::vector<std::unique_ptr<std::atomic<uint64_t>>> m_by_priority;
|
||||||
std::vector<std::unique_ptr<atomic<uint64_t>>> m_by_rule_id;
|
std::vector<std::unique_ptr<std::atomic<uint64_t>>> m_by_rule_id;
|
||||||
};
|
};
|
@@ -281,8 +281,8 @@ private:
|
|||||||
throw falco_exception("Could not open file " + filename + " for reading");
|
throw falco_exception("Could not open file " + filename + " for reading");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string rules_content((istreambuf_iterator<char>(is)),
|
std::string rules_content((std::istreambuf_iterator<char>(is)),
|
||||||
istreambuf_iterator<char>());
|
std::istreambuf_iterator<char>());
|
||||||
rules_contents.emplace_back(std::move(rules_content));
|
rules_contents.emplace_back(std::move(rules_content));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ public:
|
|||||||
void init(const std::string& conf_filename, const std::vector<std::string>& cmdline_options);
|
void init(const std::string& conf_filename, const std::vector<std::string>& cmdline_options);
|
||||||
void init(const std::vector<std::string>& cmdline_options);
|
void init(const std::vector<std::string>& cmdline_options);
|
||||||
|
|
||||||
static void read_rules_file_directory(const string& path, list<string>& rules_filenames, list<string> &rules_folders);
|
static void read_rules_file_directory(const std::string& path, std::list<std::string>& rules_filenames, std::list<std::string> &rules_folders);
|
||||||
|
|
||||||
// Rules list as passed by the user
|
// Rules list as passed by the user
|
||||||
std::list<std::string> m_rules_filenames;
|
std::list<std::string> m_rules_filenames;
|
||||||
@@ -157,7 +157,7 @@ namespace YAML {
|
|||||||
if(!rhs.m_library_path.empty() && rhs.m_library_path.at(0) != '/')
|
if(!rhs.m_library_path.empty() && rhs.m_library_path.at(0) != '/')
|
||||||
{
|
{
|
||||||
// prepend share dir if path is not absolute
|
// prepend share dir if path is not absolute
|
||||||
rhs.m_library_path = string(FALCO_ENGINE_PLUGINS_DIR) + rhs.m_library_path;
|
rhs.m_library_path = std::string(FALCO_ENGINE_PLUGINS_DIR) + rhs.m_library_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(node["init_config"] && !node["init_config"].IsNull())
|
if(node["init_config"] && !node["init_config"].IsNull())
|
||||||
@@ -183,7 +183,7 @@ namespace YAML {
|
|||||||
|
|
||||||
if(node["open_params"] && !node["open_params"].IsNull())
|
if(node["open_params"] && !node["open_params"].IsNull())
|
||||||
{
|
{
|
||||||
string open_params = node["open_params"].as<std::string>();
|
std::string open_params = node["open_params"].as<std::string>();
|
||||||
rhs.m_open_params = trim(open_params);
|
rhs.m_open_params = trim(open_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,11 +26,11 @@ class falco_logger
|
|||||||
static void set_time_format_iso_8601(bool val);
|
static void set_time_format_iso_8601(bool val);
|
||||||
|
|
||||||
// Will throw exception if level is unknown.
|
// Will throw exception if level is unknown.
|
||||||
static void set_level(string &level);
|
static void set_level(std::string &level);
|
||||||
|
|
||||||
static void set_sinsp_logging(bool enable, const std::string& severity, const std::string& prefix);
|
static void set_sinsp_logging(bool enable, const std::string& severity, const std::string& prefix);
|
||||||
|
|
||||||
static void log(int priority, const string&& msg);
|
static void log(int priority, const std::string&& msg);
|
||||||
|
|
||||||
static int level;
|
static int level;
|
||||||
static bool log_stderr;
|
static bool log_stderr;
|
||||||
|
@@ -49,7 +49,7 @@ struct message
|
|||||||
std::string msg;
|
std::string msg;
|
||||||
std::string rule;
|
std::string rule;
|
||||||
std::string source;
|
std::string source;
|
||||||
map<std::string, std::string> fields;
|
std::map<std::string, std::string> fields;
|
||||||
std::set<std::string> tags;
|
std::set<std::string> tags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -112,7 +112,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
YAML::Node m_root;
|
YAML::Node m_root;
|
||||||
std::string m_input;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key is a string representing a node in the YAML document.
|
* Key is a string representing a node in the YAML document.
|
||||||
@@ -146,9 +145,9 @@ private:
|
|||||||
{
|
{
|
||||||
if (i > 0 && nodeKey.empty() && key[i - 1] != '.')
|
if (i > 0 && nodeKey.empty() && key[i - 1] != '.')
|
||||||
{
|
{
|
||||||
throw runtime_error(
|
throw std::runtime_error(
|
||||||
"Parsing error: expected '.' character at pos "
|
"Parsing error: expected '.' character at pos "
|
||||||
+ to_string(i - 1));
|
+ std::to_string(i - 1));
|
||||||
}
|
}
|
||||||
nodeKey += c;
|
nodeKey += c;
|
||||||
}
|
}
|
||||||
@@ -157,9 +156,9 @@ private:
|
|||||||
{
|
{
|
||||||
if (nodeKey.empty())
|
if (nodeKey.empty())
|
||||||
{
|
{
|
||||||
throw runtime_error(
|
throw std::runtime_error(
|
||||||
"Parsing error: unexpected character at pos "
|
"Parsing error: unexpected character at pos "
|
||||||
+ to_string(i));
|
+ std::to_string(i));
|
||||||
}
|
}
|
||||||
ret.reset(ret[nodeKey]);
|
ret.reset(ret[nodeKey]);
|
||||||
nodeKey.clear();
|
nodeKey.clear();
|
||||||
@@ -179,7 +178,7 @@ private:
|
|||||||
}
|
}
|
||||||
catch(const std::exception& e)
|
catch(const std::exception& e)
|
||||||
{
|
{
|
||||||
throw runtime_error("Config error at key \"" + key + "\": " + string(e.what()));
|
throw std::runtime_error("Config error at key \"" + key + "\": " + std::string(e.what()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user