From 073760f279492d49054ff62bf58b180faac709b8 Mon Sep 17 00:00:00 2001 From: Maijin Date: Fri, 23 Jan 2026 00:27:02 +0800 Subject: [PATCH] fix(lint): disable rule caching during linting (#2817) --- CHANGELOG.md | 1 + capa/main.py | 4 +++- scripts/lint.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 784b2aed..f0120c18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ ### Bug Fixes - Fixed insecure deserialization vulnerability in YAML loading @0x1622 (#2770) - loader: gracefully handle ELF files with unsupported architectures kamranulhaq2002@gmail.com #2800 +- lint: disable rule caching during linting @Maijin #2817 ### capa Explorer Web diff --git a/capa/main.py b/capa/main.py index 7434918d..ce0191d3 100644 --- a/capa/main.py +++ b/capa/main.py @@ -661,7 +661,9 @@ def get_rules_from_cli(args) -> RuleSet: raises: ShouldExitError: if the program is invoked incorrectly and should exit. """ - enable_cache: bool = True + enable_cache: bool = getattr(args, "enable_cache", True) + # this allows calling functions to easily disable rule caching, e.g., used by the rule linter to avoid + try: if capa.helpers.is_running_standalone() and args.is_default_rules: cache_dir = get_default_root() / "cache" diff --git a/scripts/lint.py b/scripts/lint.py index aa1170c0..c489c8d5 100644 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -1229,6 +1229,7 @@ def main(argv=None): time0 = time.time() + args.enable_cache = False try: rules = capa.main.get_rules_from_cli(args) except capa.main.ShouldExitError as e: