From ad6885c5caa77b696ff774eed462bb79510ca32a Mon Sep 17 00:00:00 2001 From: Timothy Wayne Gregg Date: Sun, 25 Oct 2026 22:50:15 -0400 Subject: [PATCH 1/3] Preserve assessment run and executable provenance across reports --- README.md | 6 +++ SHA256SUMS | 2 +- docs/CONTRACT.md | 11 +++- docs/REFERENCE.md | 4 +- docs/example-report.html | 2 +- schemas/report-v1.schema.json | 14 +++++- sharp_rsvg_rce_check.py | 49 ++++++++++++++---- src/checker.py | 2 + test_contract.py | 7 ++- test_report_provenance.py | 95 +++++++++++++++++++++++++++++++++++ vendor/common.py | 45 ++++++++++++++--- 11 files changed, 213 insertions(+), 24 deletions(-) create mode 100644 test_report_provenance.py diff --git a/README.md b/README.md index 23fd39d..7671130 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,12 @@ exported. Retaining a candidate never selects it as the assessed version. JSON, formula-neutralized CSV and a self-contained, script-free HTML report use the same validated evidence records. HTML supports escaped `--brand` and an optional bounded local raster `--logo`. See the [actual synthetic HTML example](docs/example-report.html); retained images in `docs/images/` are earlier concept artwork, not generated results. +Every report includes one UTC run assessment timestamp, the exact standalone +executable SHA-256, rule snapshot ID/date/hash and completeness. Empty and +interrupted CSV summaries retain the same provenance. Assessment time is distinct +from rule verification and evidence acquisition; build identity never attests a +deployed patch. Injected time/build metadata keeps synthetic library calls reproducible. + ## Documentation and development - [Reference](docs/REFERENCE.md): input schema, CLI, limits, outputs and exit policy diff --git a/SHA256SUMS b/SHA256SUMS index f0ad964..d23f2a1 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -1,2 +1,2 @@ -293da888b6c8cb667dc373f4a138dd94d9a76855a7420df5bca56a7aa252f593 sharp_rsvg_rce_check.py +42ffcf3cea3242bfd6915245ec30c73e8a23214b91eea290125eab59c6a1816e sharp_rsvg_rce_check.py dbcee01397d62d0017fea9319fcb8d59a36b5bf0dfe16556f890cca498c848f6 rules/snapshot.json diff --git a/docs/CONTRACT.md b/docs/CONTRACT.md index 0de8e58..b431557 100644 --- a/docs/CONTRACT.md +++ b/docs/CONTRACT.md @@ -165,7 +165,16 @@ Unverified research leads must remain disabled or outside the active snapshot. ## Deterministic formats Canonical JSON uses the same stable encoding as snapshot hashing. It includes -no runtime clock, absolute input path, or implicit filename-derived label. +no absolute input path or implicit filename-derived label. The run envelope includes +required `generated_at` (a real UTC `YYYY-MM-DDTHH:MM:SSZ` assessment timestamp) and +`tool.executable_sha256` (lowercase SHA-256 of the executing standalone bytes). +These identify this assessment run, not evidence acquisition or deployed patch state. +The CLI captures the envelope once and retains it through incomplete recovery. +`make_report` accepts injected values for deterministic fixtures; canonical assessment +results and rule hashing remain independent of the clock. CSV and HTML retain this +envelope together with rule snapshot ID, verification date, digest and completeness, +including empty reports. The new required fields update the closed schema-v1 report +contract; older report fixtures must add them rather than infer them from file dates. Callers must traverse and order observations deterministically; list order is preserved to avoid silently changing the meaning of configuration operations. diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index f48dce1..0b712ac 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -48,7 +48,9 @@ The checker does not collect credentials, hostnames, environment variables, proc `--format json|csv|html` defaults to JSON on stdout. `--output FILE` publishes an atomic report in an existing directory. It refuses an existing destination unless `--force` is supplied. The scanner, inventory, supplied logo and their symlink/hard-link aliases remain protected with `--force`; output symlinks are rejected. No-clobber publication requires filesystem hard-link support and fails explicitly if unavailable. Reports are not incremental checkpoints; abrupt termination or output failure can prevent publication. -All formats share the [v1 evidence contract](CONTRACT.md). JSON includes the rule snapshot digest and `complete` flag, without a runtime timestamp. CSV serializes structured dimensions as JSON cells and prefixes strings that could become spreadsheet formulas. An interrupted report with no completed assets has a `record_type=summary` row. HTML escapes dynamic text, blocks remote resources, contains no scripts, supports printing, and accepts `--brand TEXT` and `--logo FILE` (PNG/JPEG/GIF/WebP, at most 1 MiB; logo only with HTML). No logo is selected by default. +All formats share the [v1 evidence contract](CONTRACT.md). JSON includes `generated_at` (UTC run assessment time), `tool.executable_sha256` (the executing standalone file's exact bytes), rule snapshot ID/date/hash and `complete`. The CLI captures time and digest once, reusing them if a handled interruption produces an incomplete report. This timestamp is not evidence acquisition time or rule verification time; a checker digest does not attest any deployed patch. Library callers can inject `generated_at` and `executable_sha256` into `make_report` for deterministic fixtures. + +CSV retains all existing columns and appends `tool`, `tool_version`, `executable_sha256`, `generated_at`, `rules_snapshot_id`, and `rules_sha256` on result and empty summary rows. It serializes structured dimensions as JSON cells and neutralizes spreadsheet formulas, including summary metadata. An interrupted report with no completed assets has a `record_type=summary` row. HTML escapes dynamic text, displays run assessment time separately from rule verification, blocks remote resources, contains no scripts, supports printing, and accepts `--brand TEXT` and `--logo FILE` (PNG/JPEG/GIF/WebP, at most 1 MiB; logo only with HTML). No logo is selected by default. These provenance fields are required by the updated closed report schema; consumers of older schema-v1 report fixtures must update them together. Build numbers and asset IDs are operator-provided; review them before sharing a report. Invalid inventory/file errors use controlled descriptions instead of raw input paths or content. Argument-parser usage errors can include the explicit command-line arguments. diff --git a/docs/example-report.html b/docs/example-report.html index 88db2b7..a858836 100644 --- a/docs/example-report.html +++ b/docs/example-report.html @@ -8,7 +8,7 @@ article,.callout{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:18px 22px;margin:20px 0} pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:.85rem}p,li,code{overflow-wrap:anywhere}a{color:var(--accent)}summary{cursor:pointer} footer{font-size:.85rem;color:var(--muted)}@media print{body{background:white;color:black}article{break-inside:avoid}details>summary{display:none}details>ul,details>pre{display:block}} -
CompleteTech LLC

Security evidence report

sharp-rsvg-rce-check 0.2.0 · rules verified 2026-10-24

Completed assessment

Local exploitability is not tested. Version, configuration, candidate source patterns and external exploitation reports are separate evidence.

precondition_present: 1 · mitigated_configuration: 1 · fixed_version_reported: 1 · unknown: 1

  • Offline supplied evidence and explicitly selected metadata only; library selection, deployed versions, provenance and effective mitigations are not independently attested.
  • No network requests, application execution, image decoding, exploitation, reachability test or compromise detection is performed.
  • The Sharp comparison covers exact stable 0.0-0.35 versions. Global librsvg has a documented remediation build, not a published independent affected-version range; only stable 2.63.2+ within 2.63 is accepted as reported remediation.
  • PIE is an RCE mitigation, not a library patch or a guarantee against other memory-corruption impact. Unknown libc or PIE remains unknown.

synthetic-bundle · Sharp (bundled librsvg)

precondition_present

Reported version: 0.35.4 · Rule: CVE-2026-96889 · Exploitability: not_tested

For official bundled binaries, upgrade Sharp to 0.35.5 or a later supported patched release. For a global library, independently verify the selected librsvg and apply the upstream 2.63.2 fix or a documented vendor fix. Rebuild/redeploy and verify the actual linkage. Effective VipsForeignLoadSvg blocking and Node PIE are separate mitigations; neither attests the library patch set.

  • The reported official Sharp bundle is below 0.35.5.
  • Version, platform, libc, effective mitigation and input-path observations are operator claims; local exploitability remains not_tested.
  • A mitigated configuration preserves an affected library/package assessment and does not establish safety or absence of prior compromise.
Evidence and assessment dimensions
  • version: present — The reported official Sharp bundle is below 0.35.5.
  • inventory: present — Operator-reported library selection: bundled; linkage is not independently verified.
  • inventory: present — Sharp version observation: 0.35.4. Accepted exact observations: 0.35.4.
  • inventory: unknown — librsvg version observation: missing, qualified or conflicting.
  • configuration: present — Reported platform: linux; reported libc: glibc. Other platforms do not establish that the underlying memory bug is absent.
  • configuration: present — Reported effective SVG decoder state: enabled. A blocked claim must cover VipsForeignLoadSvg in the deployed process.
  • configuration: present — Reported Node executable PIE state: disabled. This operator claim is not inferred from optional binary metadata hints.
  • configuration: present — Operator-reviewed untrusted SVG input path: present. No data-flow or reachability test is performed.
{
+
CompleteTech LLC

Security evidence report

sharp-rsvg-rce-check 0.2.0 · Run assessed (UTC): 2026-10-25T12:34:56Z · Executable SHA-256: 42ffcf3cea3242bfd6915245ec30c73e8a23214b91eea290125eab59c6a1816e · rules verified 2026-10-24

Completed assessment

Local exploitability is not tested. Version, configuration, candidate source patterns and external exploitation reports are separate evidence.

precondition_present: 1 · mitigated_configuration: 1 · fixed_version_reported: 1 · unknown: 1

  • Offline supplied evidence and explicitly selected metadata only; library selection, deployed versions, provenance and effective mitigations are not independently attested.
  • No network requests, application execution, image decoding, exploitation, reachability test or compromise detection is performed.
  • The Sharp comparison covers exact stable 0.0-0.35 versions. Global librsvg has a documented remediation build, not a published independent affected-version range; only stable 2.63.2+ within 2.63 is accepted as reported remediation.
  • PIE is an RCE mitigation, not a library patch or a guarantee against other memory-corruption impact. Unknown libc or PIE remains unknown.

synthetic-bundle · Sharp (bundled librsvg)

precondition_present

Reported version: 0.35.4 · Rule: CVE-2026-96889 · Exploitability: not_tested

For official bundled binaries, upgrade Sharp to 0.35.5 or a later supported patched release. For a global library, independently verify the selected librsvg and apply the upstream 2.63.2 fix or a documented vendor fix. Rebuild/redeploy and verify the actual linkage. Effective VipsForeignLoadSvg blocking and Node PIE are separate mitigations; neither attests the library patch set.

  • The reported official Sharp bundle is below 0.35.5.
  • Version, platform, libc, effective mitigation and input-path observations are operator claims; local exploitability remains not_tested.
  • A mitigated configuration preserves an affected library/package assessment and does not establish safety or absence of prior compromise.
Evidence and assessment dimensions
  • version: present — The reported official Sharp bundle is below 0.35.5.
  • inventory: present — Operator-reported library selection: bundled; linkage is not independently verified.
  • inventory: present — Sharp version observation: 0.35.4. Accepted exact observations: 0.35.4.
  • inventory: unknown — librsvg version observation: missing, qualified or conflicting.
  • configuration: present — Reported platform: linux; reported libc: glibc. Other platforms do not establish that the underlying memory bug is absent.
  • configuration: present — Reported effective SVG decoder state: enabled. A blocked claim must cover VipsForeignLoadSvg in the deployed process.
  • configuration: present — Reported Node executable PIE state: disabled. This operator claim is not inferred from optional binary metadata hints.
  • configuration: present — Operator-reviewed untrusted SVG input path: present. No data-flow or reachability test is performed.
{
   "confidence": "low",
   "mitigation": {
     "evidence_ids": [],
diff --git a/schemas/report-v1.schema.json b/schemas/report-v1.schema.json
index 43bb84e..2a11cca 100644
--- a/schemas/report-v1.schema.json
+++ b/schemas/report-v1.schema.json
@@ -6,6 +6,12 @@
     "complete": {
       "type": "boolean"
     },
+    "generated_at": {
+      "format": "date-time",
+      "maxLength": 20,
+      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z(?![\\s\\S])",
+      "type": "string"
+    },
     "limitations": {
       "items": {
         "maxLength": 2048,
@@ -459,6 +465,10 @@
     "tool": {
       "additionalProperties": false,
       "properties": {
+        "executable_sha256": {
+          "pattern": "^[a-f0-9]{64}(?![\\s\\S])",
+          "type": "string"
+        },
         "name": {
           "maxLength": 128,
           "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}(?![\\s\\S])",
@@ -473,7 +483,8 @@
       },
       "required": [
         "name",
-        "version"
+        "version",
+        "executable_sha256"
       ],
       "type": "object"
     }
@@ -481,6 +492,7 @@
   "required": [
     "schema_version",
     "tool",
+    "generated_at",
     "rules",
     "complete",
     "limitations",
diff --git a/sharp_rsvg_rce_check.py b/sharp_rsvg_rce_check.py
index c264ebc..4b788db 100644
--- a/sharp_rsvg_rce_check.py
+++ b/sharp_rsvg_rce_check.py
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-CompleteTech-Commercial
 # Copyright (c) 2026 CompleteTech LLC. See LICENSING.md.
 # Generated by tools/build.py. Edit src/checker.py, src/adapters.py and vendor/common.py.
-# Vendored common.py SHA-256: 714fb820175dc3d2dcb967928df4e1e97ad6fa0d478901ff6dba985f1368c0f7
+# Vendored common.py SHA-256: 28d21644bc98e7fe04223cc0b12465d809c1b6a3ef84710ddcb3bee6c28aa566
 from __future__ import annotations
 
 # SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-CompleteTech-Commercial
@@ -21,7 +21,7 @@
 import stat
 import tempfile
 from copy import deepcopy
-from datetime import date
+from datetime import date, datetime, timezone
 from pathlib import Path
 from urllib.parse import urlsplit
 
@@ -62,6 +62,9 @@ def _array(items, maximum=1000, minimum=0):
 
 ID_SCHEMA = {"type": "string", "pattern": r"^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}(?![\s\S])", "maxLength": 128}
 DATE_SCHEMA = {"type": "string", "format": "date"}
+UTC_SCHEMA = {"type": "string", "format": "date-time", "maxLength": 20,
+              "pattern": r"^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z(?![\s\S])"}
+DIGEST_SCHEMA = {"type": "string", "pattern": r"^[a-f0-9]{64}(?![\s\S])"}
 URL_SCHEMA = {"type": "string", "format": "uri", "maxLength": 2048}
 NULLABLE_DATE = {"anyOf": [DATE_SCHEMA, {"type": "null"}]}
 NULLABLE_URL = {"anyOf": [URL_SCHEMA, {"type": "null"}]}
@@ -107,7 +110,8 @@ def _threat_schema(states):
 })
 REPORT_SCHEMA = _object({
     "schema_version": {"const": CONTRACT_VERSION},
-    "tool": _object({"name": ID_SCHEMA, "version": _text(64, min_length=1)}),
+    "tool": _object({"name": ID_SCHEMA, "version": _text(64, min_length=1), "executable_sha256": DIGEST_SCHEMA}),
+    "generated_at": UTC_SCHEMA,
     "rules": _object({
         "snapshot_id": ID_SCHEMA, "verified_at": DATE_SCHEMA,
         "sha256": {"anyOf": [{"type": "string", "pattern": r"^[a-f0-9]{64}(?![\s\S])"}, {"type": "null"}]},
@@ -156,6 +160,13 @@ def _check_format(value, fmt, path):
             date.fromisoformat(value)
         except ValueError:
             raise ContractError(f"{path}: invalid ISO date") from None
+    elif fmt == "date-time":
+        try:
+            if re.fullmatch(r"[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z", value) is None:
+                raise ValueError
+            datetime.strptime(value, "%Y-%m-%dT%H:%M:%SZ")
+        except ValueError:
+            raise ContractError(f"{path}: expected real UTC timestamp") from None
     elif fmt == "uri":
         try:
             parsed = urlsplit(value)
@@ -315,9 +326,21 @@ def make_result(asset_id, component, rule_id, status="unknown", *, version=None,
     return validate_result(result)
 
 
+def utc_now():
+    """Run assessment time, separate from rule verification and evidence acquisition."""
+    return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
+
+
+def executable_digest():
+    """Identify actual standalone bytes; this is not deployed patch attestation."""
+    return hashlib.sha256(_read_regular_file(Path(__file__), MAX_JSON_BYTES)).hexdigest()
+
+
 def make_report(tool, tool_version, snapshot_id, rules_as_of, results, *, complete=True,
-                limitations=None, snapshot_digest=None):
-    report = {"schema_version": CONTRACT_VERSION, "tool": {"name": tool, "version": tool_version},
+                limitations=None, snapshot_digest=None, generated_at=None, executable_sha256=None):
+    report = {"schema_version": CONTRACT_VERSION, "tool": {"name": tool, "version": tool_version,
+              "executable_sha256": executable_digest() if executable_sha256 is None else executable_sha256},
+              "generated_at": utc_now() if generated_at is None else generated_at,
               "rules": {"snapshot_id": snapshot_id, "verified_at": rules_as_of, "sha256": snapshot_digest},
               "complete": complete, "limitations": deepcopy(limitations or []), "results": deepcopy(results)}
     return validate_report(report)
@@ -448,19 +471,24 @@ def render_csv(report):
     output = io.StringIO(newline="")
     fields = ("record_type", "asset_id", "component", "version", "rule_id", "status", "version_assessment", "confidence",
               "exploitability", "complete", "rules_as_of", "evidence", "preconditions", "mitigation",
-              "reachability", "threat", "reasons", "recommendation", "sources", "limitations")
+              "reachability", "threat", "reasons", "recommendation", "sources", "limitations",
+              "tool", "tool_version", "executable_sha256", "generated_at", "rules_snapshot_id", "rules_sha256")
     writer = csv.DictWriter(output, fieldnames=fields, lineterminator="\n")
     writer.writeheader()
+    provenance = {"tool": report["tool"]["name"], "tool_version": report["tool"]["version"],
+                  "executable_sha256": report["tool"]["executable_sha256"], "generated_at": report["generated_at"],
+                  "rules_snapshot_id": report["rules"]["snapshot_id"], "rules_sha256": report["rules"]["sha256"] or ""}
     for result in report["results"]:
         row = {key: result[key] for key in fields if key in result}
         row.update(record_type="result", component=result["component"]["name"], version=result["component"]["version"] or "",
                    complete=report["complete"], rules_as_of=report["rules"]["verified_at"], limitations=report["limitations"])
+        row.update(provenance)
         writer.writerow({key: _csv_safe(json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"))
                                        if isinstance(value, (dict, list)) else value) for key, value in row.items()})
     if not report["results"]:
-        writer.writerow({"record_type": "summary", "complete": report["complete"],
+        writer.writerow({key: _csv_safe(value) for key, value in {"record_type": "summary", "complete": report["complete"],
                          "rules_as_of": report["rules"]["verified_at"], "exploitability": "not_tested",
-                         "limitations": json.dumps(report["limitations"], ensure_ascii=False, sort_keys=True, separators=(",", ":"))})
+                         "limitations": json.dumps(report["limitations"], ensure_ascii=False, sort_keys=True, separators=(",", ":")), **provenance}.items()})
     return output.getvalue()
 
 
@@ -515,7 +543,8 @@ def render_html(report, brand="CompleteTech LLC", logo=None):
 pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:.85rem}p,li,code{overflow-wrap:anywhere}a{color:var(--accent)}summary{cursor:pointer}
 footer{font-size:.85rem;color:var(--muted)}@media print{body{background:white;color:black}article{break-inside:avoid}details>summary{display:none}details>ul,details>pre{display:block}}
 
""" + logo_html + "
" + esc(brand) + "

Security evidence report

" + esc(report["tool"]["name"]) \ - + " " + esc(report["tool"]["version"]) + " · rules verified " + esc(report["rules"]["verified_at"]) \ + + " " + esc(report["tool"]["version"]) + " · Run assessed (UTC): " + esc(report["generated_at"]) \ + + " · Executable SHA-256: " + esc(report["tool"]["executable_sha256"]) + " · rules verified " + esc(report["rules"]["verified_at"]) \ + "

" + ("Completed assessment" if report["complete"] else "Incomplete assessment") \ + "

Local exploitability is not tested. Version, configuration, candidate source patterns and external exploitation reports are separate evidence.

" \ + counts + "

    " + limitations + "
" + "".join(rows) \ @@ -1064,6 +1093,7 @@ def publish_results(args, results, protected, *, complete, state=None): state = {} if state is None else state report = make_report(TOOL_NAME, TOOL_VERSION, SNAPSHOT_ID, RULE_DATE, results, complete=complete, limitations=LIMITATIONS, + generated_at=state.get("generated_at"), executable_sha256=state.get("executable_sha256"), snapshot_digest=snapshot_digest(RULE_SNAPSHOT)) rendered = canonical_json(report) if args.format == "json" else render_csv(report) if args.format == "csv" else render_html(report, brand=args.brand, logo=args.logo) if args.output: @@ -1121,6 +1151,7 @@ def main(argv=None): if args.logo: protected.append(args.logo) try: + publication["generated_at"], publication["executable_sha256"] = utc_now(), executable_digest() if args.logo and args.format != "html": raise ContractError("logo requires HTML output") if len(adapter_files) > 100 or (adapter_files and (args.evidence_root is None or not args.evidence_root.is_dir())): diff --git a/src/checker.py b/src/checker.py index 0a5c42d..d3740a3 100644 --- a/src/checker.py +++ b/src/checker.py @@ -177,6 +177,7 @@ def publish_results(args, results, protected, *, complete, state=None): state = {} if state is None else state report = make_report(TOOL_NAME, TOOL_VERSION, SNAPSHOT_ID, RULE_DATE, results, complete=complete, limitations=LIMITATIONS, + generated_at=state.get("generated_at"), executable_sha256=state.get("executable_sha256"), snapshot_digest=snapshot_digest(RULE_SNAPSHOT)) rendered = canonical_json(report) if args.format == "json" else render_csv(report) if args.format == "csv" else render_html(report, brand=args.brand, logo=args.logo) if args.output: @@ -234,6 +235,7 @@ def main(argv=None): if args.logo: protected.append(args.logo) try: + publication["generated_at"], publication["executable_sha256"] = utc_now(), executable_digest() if args.logo and args.format != "html": raise ContractError("logo requires HTML output") if len(adapter_files) > 100 or (adapter_files and (args.evidence_root is None or not args.evidence_root.is_dir())): diff --git a/test_contract.py b/test_contract.py index b9487b5..f4e5371 100644 --- a/test_contract.py +++ b/test_contract.py @@ -27,6 +27,8 @@ def affected(**overrides): def report(result=None, **overrides): + overrides.setdefault("generated_at", "2026-10-25T12:34:56Z") + overrides.setdefault("executable_sha256", "a" * 64) return contract.make_report("synthetic-check", "0.1.0", "synthetic-1", "2026-10-23", [result or affected()], **overrides) @@ -181,7 +183,7 @@ def test_rule_and_snapshot_dates_are_consistent_and_hash_is_stable(self): with self.assertRaises(contract.ContractError): contract.snapshot_digest(snapshot) - def test_reports_are_deterministic_without_wall_clock_or_input_mutation(self): + def test_reports_are_deterministic_with_injected_context_without_input_mutation(self): result = affected() value = report(result) result["reasons"].append("changed later") @@ -189,7 +191,8 @@ def test_reports_are_deterministic_without_wall_clock_or_input_mutation(self): first = contract.canonical_json(value) second = contract.canonical_json(dict(reversed(list(value.items())))) self.assertEqual(first, second) - self.assertNotIn("generated_at", first) + self.assertEqual("2026-10-25T12:34:56Z", value["generated_at"]) + self.assertEqual("a" * 64, value["tool"]["executable_sha256"]) def test_html_escapes_every_untrusted_text_and_contains_no_external_assets(self): result = affected(component='', reasons=[""], recommendation='x') diff --git a/test_report_provenance.py b/test_report_provenance.py new file mode 100644 index 0000000..1fd3028 --- /dev/null +++ b/test_report_provenance.py @@ -0,0 +1,95 @@ +"""Synthetic run-envelope provenance regressions; no networking.""" +import contextlib +import csv +import hashlib +import io +import json +from pathlib import Path +import unittest +from unittest.mock import patch + +import sharp_rsvg_rce_check as c + +STAMP = '2026-10-25T12:34:56Z' +DIGEST = 'a' * 64 +BASE = ['--sharp-version', '0.35.4', '--library-source', 'bundled', '--sharp-build-source', 'upstream'] + + +class ProvenanceTests(unittest.TestCase): + def report(self, results=(), **extra): + return c.make_report(c.TOOL_NAME, c.TOOL_VERSION, c.SNAPSHOT_ID, c.RULE_DATE, + list(results), snapshot_digest=c.snapshot_digest(c.RULE_SNAPSHOT), + generated_at=STAMP, executable_sha256=DIGEST, **extra) + + def test_injected_context_deterministic_and_preserved_all_formats(self): + record = c.normalize_record({'asset_id': 'synthetic', 'sharp_versions': ['0.35.4'], + 'library_source': 'bundled', 'sharp_build_source': 'upstream'}) + report = self.report([c.assess_record(record)]) + self.assertEqual(c.canonical_json(report), c.canonical_json(self.report(report['results']))) + row = next(csv.DictReader(io.StringIO(c.render_csv(report)))) + expected = dict(tool=c.TOOL_NAME, tool_version=c.TOOL_VERSION, executable_sha256=DIGEST, + generated_at=STAMP, rules_snapshot_id=c.SNAPSHOT_ID, + rules_sha256=c.snapshot_digest(c.RULE_SNAPSHOT), rules_as_of=c.RULE_DATE) + for key, value in expected.items(): + self.assertEqual(value, row[key]) + self.assertIn(value, c.render_html(report)) + self.assertEqual('not_tested', row['exploitability']) + + def test_empty_incomplete_and_formula_safe_summary(self): + report = self.report(complete=False) + report['tool']['version'] = '=synthetic' + row = next(csv.DictReader(io.StringIO(c.render_csv(report)))) + self.assertEqual('summary', row['record_type']) + self.assertEqual('False', row['complete']) + self.assertEqual("'=synthetic", row['tool_version']) + self.assertEqual(STAMP, row['generated_at']) + self.assertEqual(DIGEST, row['executable_sha256']) + self.assertIn('Incomplete assessment', c.render_html(report)) + + def test_real_timestamp_and_digest_validation(self): + external = json.loads((Path(c.__file__).parent / 'schemas/report-v1.schema.json').read_text(encoding='utf-8')) + external.pop('$schema') + external.pop('$id') + external.pop('title') + self.assertEqual(c.REPORT_SCHEMA, external) + for value in ['2026-02-30T12:00:00Z', '2026-10-25T12:00:00+00:00', STAMP+'\n']: + report = self.report() + report['generated_at'] = value + with self.assertRaises(c.ContractError): + c.validate_report(report) + report = self.report() + report['tool']['executable_sha256'] = 'private-invalid' + with self.assertRaises(c.ContractError): + c.validate_report(report) + + def test_cli_context_captured_once_and_reused_after_interrupt(self): + for fmt in ['json', 'csv', 'html']: + stdout, stderr = io.StringIO(), io.StringIO() + real = c.canonical_json if fmt == 'json' else c.render_csv if fmt == 'csv' else c.render_html + name = 'canonical_json' if fmt == 'json' else 'render_csv' if fmt == 'csv' else 'render_html' + calls = [] + def render(report, *args, **kwargs): + calls.append(report) + if len(calls) == 1: + raise KeyboardInterrupt + return real(report, *args, **kwargs) + with patch.object(c, 'utc_now', return_value=STAMP) as clock, patch.object(c, 'executable_digest', return_value=DIGEST) as digest, patch.object(c, name, side_effect=render), contextlib.redirect_stdout(stdout), contextlib.redirect_stderr(stderr): + self.assertEqual(130, c.main(BASE + ['--format', fmt])) + self.assertEqual(1, clock.call_count) + self.assertEqual(1, digest.call_count) + self.assertEqual([STAMP, STAMP], [r['generated_at'] for r in calls]) + self.assertFalse(calls[-1]['complete']) + self.assertEqual(1, len(calls[-1]['results'])) + self.assertIn(STAMP, stdout.getvalue()) + + def test_cli_digest_identifies_standalone_bytes(self): + stdout, stderr = io.StringIO(), io.StringIO() + with contextlib.redirect_stdout(stdout), contextlib.redirect_stderr(stderr): + self.assertEqual(0, c.main(BASE)) + report = json.loads(stdout.getvalue()) + self.assertEqual(hashlib.sha256(Path(c.__file__).read_bytes()).hexdigest(), report['tool']['executable_sha256']) + self.assertRegex(report['generated_at'], r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$') + + +if __name__ == '__main__': + unittest.main() diff --git a/vendor/common.py b/vendor/common.py index acaf830..569722c 100644 --- a/vendor/common.py +++ b/vendor/common.py @@ -15,7 +15,7 @@ import stat import tempfile from copy import deepcopy -from datetime import date +from datetime import date, datetime, timezone from pathlib import Path from urllib.parse import urlsplit @@ -56,6 +56,9 @@ def _array(items, maximum=1000, minimum=0): ID_SCHEMA = {"type": "string", "pattern": r"^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}(?![\s\S])", "maxLength": 128} DATE_SCHEMA = {"type": "string", "format": "date"} +UTC_SCHEMA = {"type": "string", "format": "date-time", "maxLength": 20, + "pattern": r"^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z(?![\s\S])"} +DIGEST_SCHEMA = {"type": "string", "pattern": r"^[a-f0-9]{64}(?![\s\S])"} URL_SCHEMA = {"type": "string", "format": "uri", "maxLength": 2048} NULLABLE_DATE = {"anyOf": [DATE_SCHEMA, {"type": "null"}]} NULLABLE_URL = {"anyOf": [URL_SCHEMA, {"type": "null"}]} @@ -101,7 +104,8 @@ def _threat_schema(states): }) REPORT_SCHEMA = _object({ "schema_version": {"const": CONTRACT_VERSION}, - "tool": _object({"name": ID_SCHEMA, "version": _text(64, min_length=1)}), + "tool": _object({"name": ID_SCHEMA, "version": _text(64, min_length=1), "executable_sha256": DIGEST_SCHEMA}), + "generated_at": UTC_SCHEMA, "rules": _object({ "snapshot_id": ID_SCHEMA, "verified_at": DATE_SCHEMA, "sha256": {"anyOf": [{"type": "string", "pattern": r"^[a-f0-9]{64}(?![\s\S])"}, {"type": "null"}]}, @@ -150,6 +154,13 @@ def _check_format(value, fmt, path): date.fromisoformat(value) except ValueError: raise ContractError(f"{path}: invalid ISO date") from None + elif fmt == "date-time": + try: + if re.fullmatch(r"[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z", value) is None: + raise ValueError + datetime.strptime(value, "%Y-%m-%dT%H:%M:%SZ") + except ValueError: + raise ContractError(f"{path}: expected real UTC timestamp") from None elif fmt == "uri": try: parsed = urlsplit(value) @@ -309,9 +320,21 @@ def make_result(asset_id, component, rule_id, status="unknown", *, version=None, return validate_result(result) +def utc_now(): + """Run assessment time, separate from rule verification and evidence acquisition.""" + return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") + + +def executable_digest(): + """Identify actual standalone bytes; this is not deployed patch attestation.""" + return hashlib.sha256(_read_regular_file(Path(__file__), MAX_JSON_BYTES)).hexdigest() + + def make_report(tool, tool_version, snapshot_id, rules_as_of, results, *, complete=True, - limitations=None, snapshot_digest=None): - report = {"schema_version": CONTRACT_VERSION, "tool": {"name": tool, "version": tool_version}, + limitations=None, snapshot_digest=None, generated_at=None, executable_sha256=None): + report = {"schema_version": CONTRACT_VERSION, "tool": {"name": tool, "version": tool_version, + "executable_sha256": executable_digest() if executable_sha256 is None else executable_sha256}, + "generated_at": utc_now() if generated_at is None else generated_at, "rules": {"snapshot_id": snapshot_id, "verified_at": rules_as_of, "sha256": snapshot_digest}, "complete": complete, "limitations": deepcopy(limitations or []), "results": deepcopy(results)} return validate_report(report) @@ -442,19 +465,24 @@ def render_csv(report): output = io.StringIO(newline="") fields = ("record_type", "asset_id", "component", "version", "rule_id", "status", "version_assessment", "confidence", "exploitability", "complete", "rules_as_of", "evidence", "preconditions", "mitigation", - "reachability", "threat", "reasons", "recommendation", "sources", "limitations") + "reachability", "threat", "reasons", "recommendation", "sources", "limitations", + "tool", "tool_version", "executable_sha256", "generated_at", "rules_snapshot_id", "rules_sha256") writer = csv.DictWriter(output, fieldnames=fields, lineterminator="\n") writer.writeheader() + provenance = {"tool": report["tool"]["name"], "tool_version": report["tool"]["version"], + "executable_sha256": report["tool"]["executable_sha256"], "generated_at": report["generated_at"], + "rules_snapshot_id": report["rules"]["snapshot_id"], "rules_sha256": report["rules"]["sha256"] or ""} for result in report["results"]: row = {key: result[key] for key in fields if key in result} row.update(record_type="result", component=result["component"]["name"], version=result["component"]["version"] or "", complete=report["complete"], rules_as_of=report["rules"]["verified_at"], limitations=report["limitations"]) + row.update(provenance) writer.writerow({key: _csv_safe(json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":")) if isinstance(value, (dict, list)) else value) for key, value in row.items()}) if not report["results"]: - writer.writerow({"record_type": "summary", "complete": report["complete"], + writer.writerow({key: _csv_safe(value) for key, value in {"record_type": "summary", "complete": report["complete"], "rules_as_of": report["rules"]["verified_at"], "exploitability": "not_tested", - "limitations": json.dumps(report["limitations"], ensure_ascii=False, sort_keys=True, separators=(",", ":"))}) + "limitations": json.dumps(report["limitations"], ensure_ascii=False, sort_keys=True, separators=(",", ":")), **provenance}.items()}) return output.getvalue() @@ -509,7 +537,8 @@ def render_html(report, brand="CompleteTech LLC", logo=None): pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:.85rem}p,li,code{overflow-wrap:anywhere}a{color:var(--accent)}summary{cursor:pointer} footer{font-size:.85rem;color:var(--muted)}@media print{body{background:white;color:black}article{break-inside:avoid}details>summary{display:none}details>ul,details>pre{display:block}}
""" + logo_html + "
" + esc(brand) + "

Security evidence report

" + esc(report["tool"]["name"]) \ - + " " + esc(report["tool"]["version"]) + " · rules verified " + esc(report["rules"]["verified_at"]) \ + + " " + esc(report["tool"]["version"]) + " · Run assessed (UTC): " + esc(report["generated_at"]) \ + + " · Executable SHA-256: " + esc(report["tool"]["executable_sha256"]) + " · rules verified " + esc(report["rules"]["verified_at"]) \ + "

" + ("Completed assessment" if report["complete"] else "Incomplete assessment") \ + "

Local exploitability is not tested. Version, configuration, candidate source patterns and external exploitation reports are separate evidence.

" \ + counts + "

    " + limitations + "
" + "".join(rows) \ From 3c52a2800e106d93e451d8ef3b5d6a1aeea2138b Mon Sep 17 00:00:00 2001 From: Timothy Wayne Gregg Date: Sun, 25 Oct 2026 22:58:33 -0400 Subject: [PATCH 2/3] Resolve executable aliases before calculating report identity --- SHA256SUMS | 2 +- docs/REFERENCE.md | 5 +++++ docs/example-report.html | 2 +- sharp_rsvg_rce_check.py | 8 ++++++-- test_report_provenance.py | 23 +++++++++++++++++++++++ vendor/common.py | 6 +++++- 6 files changed, 41 insertions(+), 5 deletions(-) diff --git a/SHA256SUMS b/SHA256SUMS index d23f2a1..0e278d1 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -1,2 +1,2 @@ -42ffcf3cea3242bfd6915245ec30c73e8a23214b91eea290125eab59c6a1816e sharp_rsvg_rce_check.py +da4132845194dce45f044b9446d177632996553281f9e22ba975fd51f42279bc sharp_rsvg_rce_check.py dbcee01397d62d0017fea9319fcb8d59a36b5bf0dfe16556f890cca498c848f6 rules/snapshot.json diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index 0b712ac..28cddb9 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -52,6 +52,11 @@ All formats share the [v1 evidence contract](CONTRACT.md). JSON includes `genera CSV retains all existing columns and appends `tool`, `tool_version`, `executable_sha256`, `generated_at`, `rules_snapshot_id`, and `rules_sha256` on result and empty summary rows. It serializes structured dimensions as JSON cells and neutralizes spreadsheet formulas, including summary metadata. An interrupted report with no completed assets has a `record_type=summary` row. HTML escapes dynamic text, displays run assessment time separately from rule verification, blocks remote resources, contains no scripts, supports printing, and accepts `--brand TEXT` and `--logo FILE` (PNG/JPEG/GIF/WebP, at most 1 MiB; logo only with HTML). No logo is selected by default. These provenance fields are required by the updated closed report schema; consumers of older schema-v1 report fixtures must update them together. +Invoking the standalone checker through an executable symlink hashes the resolved +checker file. Copied standalone files hash their own bytes. This exception applies +only to locating the executing checker; evidence and output symlink protections +remain unchanged. + Build numbers and asset IDs are operator-provided; review them before sharing a report. Invalid inventory/file errors use controlled descriptions instead of raw input paths or content. Argument-parser usage errors can include the explicit command-line arguments. ## Status and exit policy diff --git a/docs/example-report.html b/docs/example-report.html index a858836..d633b3c 100644 --- a/docs/example-report.html +++ b/docs/example-report.html @@ -8,7 +8,7 @@ article,.callout{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:18px 22px;margin:20px 0} pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:.85rem}p,li,code{overflow-wrap:anywhere}a{color:var(--accent)}summary{cursor:pointer} footer{font-size:.85rem;color:var(--muted)}@media print{body{background:white;color:black}article{break-inside:avoid}details>summary{display:none}details>ul,details>pre{display:block}} -
CompleteTech LLC

Security evidence report

sharp-rsvg-rce-check 0.2.0 · Run assessed (UTC): 2026-10-25T12:34:56Z · Executable SHA-256: 42ffcf3cea3242bfd6915245ec30c73e8a23214b91eea290125eab59c6a1816e · rules verified 2026-10-24

Completed assessment

Local exploitability is not tested. Version, configuration, candidate source patterns and external exploitation reports are separate evidence.

precondition_present: 1 · mitigated_configuration: 1 · fixed_version_reported: 1 · unknown: 1

  • Offline supplied evidence and explicitly selected metadata only; library selection, deployed versions, provenance and effective mitigations are not independently attested.
  • No network requests, application execution, image decoding, exploitation, reachability test or compromise detection is performed.
  • The Sharp comparison covers exact stable 0.0-0.35 versions. Global librsvg has a documented remediation build, not a published independent affected-version range; only stable 2.63.2+ within 2.63 is accepted as reported remediation.
  • PIE is an RCE mitigation, not a library patch or a guarantee against other memory-corruption impact. Unknown libc or PIE remains unknown.

synthetic-bundle · Sharp (bundled librsvg)

precondition_present

Reported version: 0.35.4 · Rule: CVE-2026-96889 · Exploitability: not_tested

For official bundled binaries, upgrade Sharp to 0.35.5 or a later supported patched release. For a global library, independently verify the selected librsvg and apply the upstream 2.63.2 fix or a documented vendor fix. Rebuild/redeploy and verify the actual linkage. Effective VipsForeignLoadSvg blocking and Node PIE are separate mitigations; neither attests the library patch set.

  • The reported official Sharp bundle is below 0.35.5.
  • Version, platform, libc, effective mitigation and input-path observations are operator claims; local exploitability remains not_tested.
  • A mitigated configuration preserves an affected library/package assessment and does not establish safety or absence of prior compromise.
Evidence and assessment dimensions
  • version: present — The reported official Sharp bundle is below 0.35.5.
  • inventory: present — Operator-reported library selection: bundled; linkage is not independently verified.
  • inventory: present — Sharp version observation: 0.35.4. Accepted exact observations: 0.35.4.
  • inventory: unknown — librsvg version observation: missing, qualified or conflicting.
  • configuration: present — Reported platform: linux; reported libc: glibc. Other platforms do not establish that the underlying memory bug is absent.
  • configuration: present — Reported effective SVG decoder state: enabled. A blocked claim must cover VipsForeignLoadSvg in the deployed process.
  • configuration: present — Reported Node executable PIE state: disabled. This operator claim is not inferred from optional binary metadata hints.
  • configuration: present — Operator-reviewed untrusted SVG input path: present. No data-flow or reachability test is performed.
{
+
CompleteTech LLC

Security evidence report

sharp-rsvg-rce-check 0.2.0 · Run assessed (UTC): 2026-10-25T12:34:56Z · Executable SHA-256: da4132845194dce45f044b9446d177632996553281f9e22ba975fd51f42279bc · rules verified 2026-10-24

Completed assessment

Local exploitability is not tested. Version, configuration, candidate source patterns and external exploitation reports are separate evidence.

precondition_present: 1 · mitigated_configuration: 1 · fixed_version_reported: 1 · unknown: 1

  • Offline supplied evidence and explicitly selected metadata only; library selection, deployed versions, provenance and effective mitigations are not independently attested.
  • No network requests, application execution, image decoding, exploitation, reachability test or compromise detection is performed.
  • The Sharp comparison covers exact stable 0.0-0.35 versions. Global librsvg has a documented remediation build, not a published independent affected-version range; only stable 2.63.2+ within 2.63 is accepted as reported remediation.
  • PIE is an RCE mitigation, not a library patch or a guarantee against other memory-corruption impact. Unknown libc or PIE remains unknown.

synthetic-bundle · Sharp (bundled librsvg)

precondition_present

Reported version: 0.35.4 · Rule: CVE-2026-96889 · Exploitability: not_tested

For official bundled binaries, upgrade Sharp to 0.35.5 or a later supported patched release. For a global library, independently verify the selected librsvg and apply the upstream 2.63.2 fix or a documented vendor fix. Rebuild/redeploy and verify the actual linkage. Effective VipsForeignLoadSvg blocking and Node PIE are separate mitigations; neither attests the library patch set.

  • The reported official Sharp bundle is below 0.35.5.
  • Version, platform, libc, effective mitigation and input-path observations are operator claims; local exploitability remains not_tested.
  • A mitigated configuration preserves an affected library/package assessment and does not establish safety or absence of prior compromise.
Evidence and assessment dimensions
  • version: present — The reported official Sharp bundle is below 0.35.5.
  • inventory: present — Operator-reported library selection: bundled; linkage is not independently verified.
  • inventory: present — Sharp version observation: 0.35.4. Accepted exact observations: 0.35.4.
  • inventory: unknown — librsvg version observation: missing, qualified or conflicting.
  • configuration: present — Reported platform: linux; reported libc: glibc. Other platforms do not establish that the underlying memory bug is absent.
  • configuration: present — Reported effective SVG decoder state: enabled. A blocked claim must cover VipsForeignLoadSvg in the deployed process.
  • configuration: present — Reported Node executable PIE state: disabled. This operator claim is not inferred from optional binary metadata hints.
  • configuration: present — Operator-reviewed untrusted SVG input path: present. No data-flow or reachability test is performed.
{
   "confidence": "low",
   "mitigation": {
     "evidence_ids": [],
diff --git a/sharp_rsvg_rce_check.py b/sharp_rsvg_rce_check.py
index 4b788db..91d179e 100644
--- a/sharp_rsvg_rce_check.py
+++ b/sharp_rsvg_rce_check.py
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-CompleteTech-Commercial
 # Copyright (c) 2026 CompleteTech LLC. See LICENSING.md.
 # Generated by tools/build.py. Edit src/checker.py, src/adapters.py and vendor/common.py.
-# Vendored common.py SHA-256: 28d21644bc98e7fe04223cc0b12465d809c1b6a3ef84710ddcb3bee6c28aa566
+# Vendored common.py SHA-256: 77f61da266a4c79262cbc782edd1b99e5974adee134578e8cc03ebd40762d397
 from __future__ import annotations
 
 # SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-CompleteTech-Commercial
@@ -333,7 +333,11 @@ def utc_now():
 
 def executable_digest():
     """Identify actual standalone bytes; this is not deployed patch attestation."""
-    return hashlib.sha256(_read_regular_file(Path(__file__), MAX_JSON_BYTES)).hexdigest()
+    try:
+        executable = Path(__file__).resolve(strict=True)
+    except RuntimeError:
+        raise ContractError("Executable path could not be resolved") from None
+    return hashlib.sha256(_read_regular_file(executable, MAX_JSON_BYTES)).hexdigest()
 
 
 def make_report(tool, tool_version, snapshot_id, rules_as_of, results, *, complete=True,
diff --git a/test_report_provenance.py b/test_report_provenance.py
index 1fd3028..d5799ab 100644
--- a/test_report_provenance.py
+++ b/test_report_provenance.py
@@ -5,6 +5,9 @@
 import io
 import json
 from pathlib import Path
+import subprocess
+import sys
+import tempfile
 import unittest
 from unittest.mock import patch
 
@@ -90,6 +93,26 @@ def test_cli_digest_identifies_standalone_bytes(self):
         self.assertEqual(hashlib.sha256(Path(c.__file__).read_bytes()).hexdigest(), report['tool']['executable_sha256'])
         self.assertRegex(report['generated_at'], r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$')
 
+    def test_copied_and_symlink_invocations_hash_actual_executable(self):
+        with tempfile.TemporaryDirectory() as directory:
+            copied = Path(directory) / 'copied.py'
+            copied.write_bytes(Path(c.__file__).read_bytes() + b'\n# synthetic installation copy\n')
+            result = subprocess.run([sys.executable, str(copied), *BASE], capture_output=True, text=True)
+            self.assertEqual(0, result.returncode, result.stderr)
+            expected = hashlib.sha256(copied.read_bytes()).hexdigest()
+            self.assertEqual(expected, json.loads(result.stdout)['tool']['executable_sha256'])
+            linked = Path(directory) / 'linked.py'
+            try:
+                linked.symlink_to(copied)
+            except OSError:
+                self.skipTest('Symlink creation unavailable on this platform')
+            result = subprocess.run([sys.executable, str(linked), *BASE], capture_output=True, text=True)
+            self.assertEqual(0, result.returncode, result.stderr)
+            self.assertEqual(expected, json.loads(result.stdout)['tool']['executable_sha256'])
+            # Executable aliases are supported without allowing evidence aliases.
+            with self.assertRaises(c.ContractError):
+                c._read_regular_file(linked, c.MAX_JSON_BYTES)
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/vendor/common.py b/vendor/common.py
index 569722c..542ea71 100644
--- a/vendor/common.py
+++ b/vendor/common.py
@@ -327,7 +327,11 @@ def utc_now():
 
 def executable_digest():
     """Identify actual standalone bytes; this is not deployed patch attestation."""
-    return hashlib.sha256(_read_regular_file(Path(__file__), MAX_JSON_BYTES)).hexdigest()
+    try:
+        executable = Path(__file__).resolve(strict=True)
+    except RuntimeError:
+        raise ContractError("Executable path could not be resolved") from None
+    return hashlib.sha256(_read_regular_file(executable, MAX_JSON_BYTES)).hexdigest()
 
 
 def make_report(tool, tool_version, snapshot_id, rules_as_of, results, *, complete=True,

From 0ad73dc18902f27892573d0a7bf02b8f93dd2f99 Mon Sep 17 00:00:00 2001
From: Timothy Wayne Gregg 
Date: Sun, 25 Oct 2026 23:38:03 -0400
Subject: [PATCH 3/3] Fix run context in conflict evidence determinism tests

---
 test_conflict_evidence.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test_conflict_evidence.py b/test_conflict_evidence.py
index 0d17ae9..aa970a8 100644
--- a/test_conflict_evidence.py
+++ b/test_conflict_evidence.py
@@ -19,7 +19,10 @@ def report(self, sharp, native, fmt):
         for value in native:
             args += ['--librsvg-version', value]
         out = io.StringIO()
-        with patch('socket.socket', side_effect=AssertionError('offline')), contextlib.redirect_stdout(out):
+        with patch('socket.socket', side_effect=AssertionError('offline')), \
+                patch.object(check, 'utc_now', return_value='2026-10-25T12:34:56Z'), \
+                patch.object(check, 'executable_digest', return_value='a' * 64), \
+                contextlib.redirect_stdout(out):
             self.assertEqual(0, check.main(args))
         return out.getvalue()