fix(userspace/falco): check plugin requirements when validating rule files

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce 2022-10-05 07:29:52 +00:00 committed by poiana
parent bbb821fb8e
commit 663c1d073a

View File

@ -70,6 +70,7 @@ application::run_result application::validate_rules_files()
// The json output encompasses all files so the // The json output encompasses all files so the
// validation result is a single json object. // validation result is a single json object.
std::string err = "";
nlohmann::json results = nlohmann::json::array(); nlohmann::json results = nlohmann::json::array();
for(auto &filename : m_options.validate_rules_filenames) for(auto &filename : m_options.validate_rules_filenames)
@ -77,6 +78,10 @@ application::run_result application::validate_rules_files()
std::unique_ptr<falco::load_result> res; std::unique_ptr<falco::load_result> res;
res = m_state->engine->load_rules(rc.at(filename), filename); res = m_state->engine->load_rules(rc.at(filename), filename);
if (!check_rules_plugin_requirements(err))
{
return run_result::fatal(err);
}
successful &= res->successful(); successful &= res->successful();