Skip to content

A non-finite metric makes an untouched Annex IV artefact or pipeline manifest fail its own hash check (false exit 6) (CR-A04-004) #373

Closed

Description

@cemililik

Wave 1 · theme D1-2: Audit chain, integrity manifest and verifier robustness · highest severity High · 1 finding(s) · effort small

Summary

A stage diverges (NaN loss). The untouched chain manifest is then reported as tampered (exit 6), paging the security owner and hiding the real cause.

Primary finding

CR-A04-004 — A non-finite metric makes an untouched Annex IV artefact or pipeline manifest fail its own hash check (false exit 6)

severity High · reachability default · intent contract-violation · confidence confirmed · independently confirmed · reproduced end to end · already tracked: PARTIALLY-FIXED TRUST-15 — docs/roadmap/phase-16-trust-surface-hardening.md:9-11,339-343 (S2 done); CHANGELOG.md:91-101

What happens. build_annex_iv_artifact (compliance.py:1878) and generate_pipeline_manifest (compliance.py:3049) stamp manifest_hash via compute_annex_iv_manifest_hash, which canonicalises with plain json.dumps/json.loads allowing NaN (compliance.py:1935, 1945). The writers then persist through dumps_strict (compliance.py:2235, 3072; cli/_pipeline.py:267 _atomic_write_json), which turns NaN/Inf into 'nan'/'inf' strings (_strict_json.py:78-83). The verifier re-hashes the on-disk strings and reports 'manifest hash mismatch', exit 6. Stage metrics keep non-finite floats (cli/_pipeline.py:1630).

Where.

Evidence.

  • nan_manifest.py through the production _save_state: finite gives no hash violation; nan and inf both give 'manifest hash mismatch'. E2E e2e_nan/ (2-stage pipeline under scripted evalloss-nan): EXIT 0, both stages completed with eval_loss 'nan'; verify-annex-iv --pipeline EXIT=6, hash_state 'mismatch'.
  • dyn/nan_manifest.py: the stage metrics have eval_loss=NaN and the pipeline exits 0. The on-disk metrics are {'eval_loss': 'nan', ...}. verify_pipeline_manifest(read-back) returns ['manifest hash mismatch ...'], and forgelm verify-annex-iv --pipeline dyn/run_nan/pipeline_run gives EXIT=6. dyn/nan_single.py: export_compliance_artifacts with a NaN metric, then verify-annex-iv on annex_iv_metadata.json, gives EXIT=6 'Manifest hash mismatch'.
  • annex_nan.py: metrics eval_loss=nan, train_runtime=inf -> the on-disk performance_metrics carry 'nan'/'inf' strings, and fpy -m forgelm verify-annex-iv out/compliance/annex_iv_metadata.json -> 'Manifest hash mismatch' EXIT=6. A control with finite metrics gives EXIT=0. pipe_nan2.py (production _atomic_write_json, failed stage with eval_loss nan) -> verify-annex-iv --pipeline -> 'manifest hash mismatch' EXIT=6. pipe_nan.py: verify_pipeline_manifest(in-memory)=[] but the on-disk copy shows a…

Recommended fix. Canonicalise through sanitize_non_finite before hashing in compute_annex_iv_manifest_hash, so writer and verifier hash the same structure. Route production writes through one fsync'd writer, export_pipeline_manifest, or delete it.

Acceptance criteria

  • A regression test reproduces the failure scenario and asserts the corrected behaviour.
  • Documentation listed above is corrected in English and in its Turkish mirror in the same PR.
  • Every finding in this issue is resolved or explicitly closed with a reason.

Found by the October 2026 ForgeLM code and documentation review against commit cab2947. Code links point at that commit; line numbers may have moved since. Finding IDs (CR-…, DOC-…, TECH-…) are stable references for this backlog.

Activity

  1. added
    bugSomething isn't working
    backlog: knownAlready tracked in docs/roadmap
    securitySecurity-relevant
    severity: highWrong behaviour or a false claim users rely on
    source: review-2026-10Found by the October 2026 code and documentation review
    wave: 1Roadmap wave 1: high severity, small effort
    on Oct 9, 2026
  2. cemililik commented on Oct 9, 2026

    @cemililik
    CollaboratorAuthor

    Fixed on development: compute_annex_iv_manifest_hash now hashes the strict-JSON form the writers emit (f94595f), so an untouched Annex IV artefact or pipeline manifest with a NaN / Inf metric verifies, and 08f2426 adds match_annex_iv_manifest_hash so artefacts stamped by an earlier release over a bare NaN still verify while a real edit reports exit 6. Pinned by tests/test_strict_json.py (incl. TestLegacyNonFiniteArtefactStillVerifies) and tests/test_pipeline_compliance.py. Verified 2026-10-09.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: pipelineCode area: pipelinebacklog: knownAlready tracked in docs/roadmapbugSomething isn't workingsecuritySecurity-relevantseverity: highWrong behaviour or a false claim users rely onsource: review-2026-10Found by the October 2026 code and documentation reviewwave: 1Roadmap wave 1: high severity, small effort

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions