From 910788850ad0342853e799ef555ce014e5609cd6 Mon Sep 17 00:00:00 2001 From: Luca Guerra Date: Fri, 9 May 2025 09:56:09 +0000 Subject: [PATCH] cleanup(engine): only consider .yaml/.yml rule files Signed-off-by: Luca Guerra --- userspace/falco/configuration.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/userspace/falco/configuration.cpp b/userspace/falco/configuration.cpp index fb20c6c6..f334ce38 100644 --- a/userspace/falco/configuration.cpp +++ b/userspace/falco/configuration.cpp @@ -734,13 +734,21 @@ void falco_configuration::read_rules_file_directory(const std::string &path, std::sort(dir_filenames.begin(), dir_filenames.end()); for(std::string &ent : dir_filenames) { - rules_filenames.push_back(ent); + // only consider yaml files + if(falco::utils::matches_wildcard("*.yaml", ent) || + falco::utils::matches_wildcard("*.yml", ent)) { + rules_filenames.push_back(ent); + } } } else { // Assume it's a file and just add to // rules_filenames. If it can't be opened/etc that // will be reported later.. - rules_filenames.push_back(path); + // also, only consider yaml files + if(falco::utils::matches_wildcard("*.yaml", path) || + falco::utils::matches_wildcard("*.yml", path)) { + rules_filenames.push_back(path); + } } }