feat(detection-core): package-rooted entry packs wired into JS recognition; fact digest covers packs (8.2 part 2)

This commit is contained in:
Marius Ciepluch
2026-10-30 19:25:30 +01:00
parent 1d5a509424
commit 51971cda7e
6 changed files with 163 additions and 6 deletions
+7 -1
View File
@@ -44,11 +44,17 @@ def _sha256_bytes(payload: bytes) -> str:
def fact_manifest_disk(directory: Path) -> dict[str, str]:
"""Digest every TOML fact artifact under ``directory`` as it exists on disk."""
"""Digest every fact artifact under ``directory`` as it exists on disk.
Covers ruleset TOMLs plus admitted entry-pack JSON files under ``entries/``, so a
pack is part of the frozen fact-set digest (2026-10-30 detection-core 8.2).
"""
manifest: dict[str, str] = {}
for path in sorted(directory.rglob("*.toml")):
if path.is_file():
manifest[path.relative_to(directory).as_posix()] = _sha256_bytes(path.read_bytes())
for path in sorted((directory / "entries").glob("*.json")) if (directory / "entries").is_dir() else []:
manifest[path.relative_to(directory).as_posix()] = _sha256_bytes(path.read_bytes())
return manifest