Add reproducible evaluation and provenance research

This commit is contained in:
2026-09-17 10:40:29 -05:00
parent d9fc3ca18b
commit 68f02d035f
53 changed files with 1432 additions and 14 deletions
+12
View File
@@ -2,6 +2,7 @@ from __future__ import annotations
from dataclasses import asdict, dataclass, field
from enum import IntEnum
import hashlib
from pathlib import Path
from typing import Any
@@ -58,10 +59,21 @@ class Finding:
remediation: str | None = None
tags: tuple[str, ...] = ()
def fingerprint(self) -> str:
material = "\0".join((
self.rule_id,
self.artifact_path,
str(self.line or 0),
str(self.column or 0),
self.message,
)).encode("utf-8")
return hashlib.sha256(material).hexdigest()
def to_dict(self) -> dict[str, Any]:
result = asdict(self)
result["severity"] = self.severity.label()
result["tags"] = list(self.tags)
result["fingerprint"] = self.fingerprint()
return result