Skip to content

fix(evidence): refuse record on unborn HEAD, atomic artifact writes - #183

Merged
rldyourmnd merged 2 commits into
mainfrom
fix/session-evidence-unborn-baseline
Sep 20, 2026
Merged

rldyourmnd merged 2 commits into
mainfrom
fix/session-evidence-unborn-baseline

Conversation

@rldyourmnd

Copy link
Copy Markdown
Contributor

Summary

Code-review findings on the session-evidence implementation (released in gds-v0.9.10):

  • Unborn HEAD produced unverifiable artifacts. gds evidence record on a repository with zero commits signed and wrote an artifact whose head_oid is empty — the schema requires a 40/64-hex commit, so verify permanently rejects it, and its digest still entered the local hash chain. Record now fails closed with GDS_SESSION_EVIDENCE_BASELINE_UNAVAILABLE before signing.
  • Non-atomic artifact write. os.WriteFile could leave a truncated artifact at the final path on crash. Writes now go through a 0600 temporary file in the same directory plus rename.

Test plan

  • New regression test TestEvidenceRecordRefusesUnbornHead: record on an unborn repo refuses with the expected finding and writes no artifact
  • go test ./core/app ./core/cli ./core/sessionevidence — all pass
  • go vet, gofmt — clean
  • scripts/validate_gds_schemas.py — succeeded
  • Live reproduction: unborn fixture now returns GDS_SESSION_EVIDENCE_BASELINE_UNAVAILABLE with head_mode: unborn; normal record still succeeds, artifact mode 0600, hash chain intact, no temp-file leftovers
  • Development lock restamped via journaled operation op_01M2Y3AR3BM7642DQT57YST6BS (verified)

Generated with Devin

rldyourmnd and others added 2 commits September 20, 2026 05:22
…cally

An unborn-HEAD repository produced a signed artifact with an empty
head_oid that verify can never accept (the schema requires a 40/64-hex
commit). Record now fails closed with GDS_SESSION_EVIDENCE_BASELINE_UNAVAILABLE
before signing, so no unverifiable artifact enters the hash chain.

Artifact writes now go through a 0600 temporary file plus rename, so a
crash cannot leave a truncated artifact at the final path.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@rldyourmnd
rldyourmnd merged commit d546c62 into main Sep 20, 2026
8 checks passed
@rldyourmnd
rldyourmnd deleted the fix/session-evidence-unborn-baseline branch September 20, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant