Skip to content

Commit

Permalink
chore(userspace/engine): introduce proper check to avoid future issue…
Browse files Browse the repository at this point in the history
…s throwing an exception.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and poiana committed Feb 8, 2024
1 parent 7bcbc08 commit 7879920
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion userspace/engine/falco_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,13 @@ std::unique_ptr<load_result> falco_engine::load_rules(const std::string &rules_c
}

auto source = find_source(rule.source);
m_rules.insert(rule, rule.name);
auto rule_id = m_rules.insert(rule, rule.name);
if (rule_id != rule.id)
{
throw falco_exception("Incompatible ID for rule: " + rule.name +
" | compiled ID: " + std::to_string(rule.id) +
" | stats_mgr ID: " + std::to_string(rule_id));
}

// By default rules are enabled/disabled for the default ruleset
// skip the rule if below the minimum priority
Expand Down

0 comments on commit 7879920

Please sign in to comment.