fix(lint): disable rule caching during linting (#2817)

This commit is contained in:
Maijin
2026-01-23 00:27:02 +08:00
committed by GitHub
parent 52a761ebb3
commit 073760f279
3 changed files with 5 additions and 1 deletions

View File

@@ -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

View File

@@ -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"

View File

@@ -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: