feat(compliance): PR 2 — restart continuity via SessionID#2
Closed
OpsKern wants to merge 1 commit into
Closed
Conversation
Add SessionID to Config, ChainEntry, and Merkle hash so process-restart boundaries are detectable in the audit chain. - Config.SessionID written into every chain entry - NewWithContext warns (via Client.Warnings()) when chain's last entry has a different non-empty session_id, flagging a cross-restart chain - VerifyFull() returns VerifyResult with Valid, EntryCount, RootHash, and SessionGaps — structured session-boundary detection without breaking existing Verify() API - SessionID uses omitempty in HashContent so pre-v0.2 entries remain verifiable (no hash drift on upgrade) - Fix chainTimestampStr helper: JSONL round-trip deserialises Timestamp as string, not time.Time; verifyChain was silently using "" causing hash mismatch for file-backed stores gosec: 0 issues (1 nosec); go test -race: PASS; govulncheck: clean Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
aaaffd3 to
d6a788a
Compare
Contributor
Author
|
Squash-merged directly to main (commit 314efa0) — PR-2 changes fully incorporated alongside PR-1 conflict resolution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Config.SessionIDwritten into everyChainEntryand included in the Merkle hash (withomitemptyfor backwards compatibility with v0.1.0 chains)writ.New()emits a warning viaClient.Warnings()when the chain's last entry has a different non-emptysession_id, flagging a cross-restart boundary for human reviewVerifyFull() (*VerifyResult, error)method returns structured results:Valid,EntryCount,RootHash, andSessionGaps— without breaking the existingVerify(path)package-level APIverifyChain: JSONL round-trip deserialisesTimestampasstring, nottime.Time; the old type assertion silently produced"", causing hash mismatch for all file-backed store entriesEU AI Act Article 12
Closes the Restart continuity PARTIAL item: chain now records session boundaries, enabling auditors to detect and explain gaps across process restarts.
Test plan
TestSessionIDWrittenToChain— session_id propagates and chain verifiesTestSessionIDMismatchWarning— warning fires on session_id changeTestSessionIDMatchNoWarning— no false-positive warning on same sessionTestVerifyFullSessionGapDetected— SessionGaps populated for multi-session chainTestVerifyFullNoGapsForSingleSession— no gaps for single-session chaingo test -race ./...PASSgosec ./...0 issuesgovulncheck ./...clean🤖 Generated with Claude Code