From 33c2e9fffb7432f748c95164692dc52257581a5b Mon Sep 17 00:00:00 2001 From: "aikido-autofix[bot]" <119856028+aikido-autofix[bot]@users.noreply.github.com> Date: Sun, 6 Sep 2026 01:06:37 +0000 Subject: [PATCH] fix(security): autofix Potential file inclusion attack via reading file --- elastalert/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elastalert/config.py b/elastalert/config.py index c6efb3ad2..f078b54a4 100644 --- a/elastalert/config.py +++ b/elastalert/config.py @@ -502,6 +502,8 @@ def get_rule_hashes(conf, use_rule=None): def get_rulefile_hash(rule_file): rulefile_hash = '' if os.path.exists(rule_file): + if '..' in rule_file: + raise Exception('Invalid file path') with open(rule_file) as fh: rulefile_hash = hashlib.sha1(fh.read()).digest() for import_rule_file in import_rules.get(rule_file, []):