Skip to content

feat(audit): external timestamp anchor via command transport (fail-closed) - #186

Merged
sandstream merged 1 commit into
mainfrom
claude/headroom-kit-integration-cmjw7t
Jun 30, 2026
Merged

sandstream merged 1 commit into
mainfrom
claude/headroom-kit-integration-cmjw7t

Conversation

@sandstream

Copy link
Copy Markdown
Owner

What

Implements the documented resolveExternalAnchor() extension point so an audit seal can carry an external authority's receipt — closing the same-machine forge gap. The keyless chain + machine-local HMAC anchor proves what happened on this machine, but anyone holding that machine's anchor key (UID) can re-seal a rewritten log undetectably. An external countersignature removes that single point of trust.

kit still ships no network client (no-egress default) — the operator wires the authority via a command.

How

  • commandExternalAnchor(cmd) — runs $KIT_EXTERNAL_ANCHOR_CMD, piping the seal context via env (KIT_ANCHOR_TIP, KIT_ANCHOR_COUNT, KIT_ANCHOR_LOGPATH) and parsing a JSON receipt { token, authority?, timestamp? } from stdout. The command can be an RFC3161 TSA client, an append-only log writer, a notary — anything.
  • kit audit anchor --external — folds the receipt into the anchor record (AnchorRecord.external); requested-but-unconfigured hard-errors.
  • kit audit verify --require-external — fails any HMAC-only seal so a policy can demand third-party countersignature on every seal.
  • Fail-closed throughout: non-zero exit, non-JSON output, missing token, or --external with no command configured all hard-error rather than silently degrading to HMAC-only. 30s timeout.

Tests

5 new tests under audit anchor - external anchor (command transport, fail-closed): resolve null/with-env, receipt parse + tip-via-env wiring, fail-closed rejects (exit/non-json/missing-token), anchorAuditLog --external stores the receipt + unconfigured throws, and decideAnchorVerdict --require-external fails HMAC-only / passes with a receipt. Full suite green (1976 tests).

🤖 Generated with Claude Code

https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg


Generated by Claude Code

…osed)

Implements the documented resolveExternalAnchor() extension point so a seal
can carry an external authority's receipt, closing the same-machine forge gap
(anyone holding the local anchor key can otherwise re-seal a rewritten log).

- commandExternalAnchor: runs $KIT_EXTERNAL_ANCHOR_CMD, pipes tip/count/logpath
  via env, parses a JSON receipt {token, authority?, timestamp?}. Fail-closed:
  non-zero exit, non-JSON, or missing token all throw (30s timeout).
- kit audit anchor --external: folds the receipt into the anchor record
  (AnchorRecord.external); requested-but-unconfigured hard-errors.
- kit audit verify --require-external: fails any HMAC-only seal so a policy can
  demand third-party countersignature.
- kit ships no network client (no-egress default) — operator wires the authority.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit 3a78a29 into main Jun 30, 2026
17 checks passed
sandstream pushed a commit that referenced this pull request Jun 30, 2026
…tity

Track C adversarial hardening of the 3.0 surface.

HIGH — palSyncFindings auto-closed findings by source-tag + scope only, with no
origin_device predicate. Since the finding id was derived from sourceTag+dedupKey
(repo-independent), it was identical across machines on a shared/synced store, so
a scan on device B that didn't see device A's open finding would permanently
close A's security blocker; two repos sharing a basename also collided.
  - fold scope into the finding id (distinct rows per repo)
  - scope by absolute project root, not basename (findings-track, health-track)
  - device-fence the auto-close (origin_device = thisDevice OR NULL); legacy
    NULL-origin rows stay reconcilable by any device
  - re-attribute origin on reopen so the observing device is reminded
  A cleared finding now lingers until the owning device re-scans — fail-safe.

MEDIUM — deviceId() was sha256(hostname+user): guessable by a peer on a shared
store and unstable across hostname churn (silently orphaning a device's items).
Now prefers a random id persisted to <memoryDir>/device-id (0600); validates the
KIT_DEVICE_ID override against [A-Za-z0-9_-]{1,64}; hostname hash is last resort.

Also restores the `## [3.0.0]` CHANGELOG header dropped by the #186 Unreleased
edit (the 3.0.0 block was orphaned under [Unreleased]).

3 new regression tests; full suite 1979 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
sandstream added a commit that referenced this pull request Jun 30, 2026
…tity (#187)

Track C adversarial hardening of the 3.0 surface.

HIGH — palSyncFindings auto-closed findings by source-tag + scope only, with no
origin_device predicate. Since the finding id was derived from sourceTag+dedupKey
(repo-independent), it was identical across machines on a shared/synced store, so
a scan on device B that didn't see device A's open finding would permanently
close A's security blocker; two repos sharing a basename also collided.
  - fold scope into the finding id (distinct rows per repo)
  - scope by absolute project root, not basename (findings-track, health-track)
  - device-fence the auto-close (origin_device = thisDevice OR NULL); legacy
    NULL-origin rows stay reconcilable by any device
  - re-attribute origin on reopen so the observing device is reminded
  A cleared finding now lingers until the owning device re-scans — fail-safe.

MEDIUM — deviceId() was sha256(hostname+user): guessable by a peer on a shared
store and unstable across hostname churn (silently orphaning a device's items).
Now prefers a random id persisted to <memoryDir>/device-id (0600); validates the
KIT_DEVICE_ID override against [A-Za-z0-9_-]{1,64}; hostname hash is last resort.

Also restores the `## [3.0.0]` CHANGELOG header dropped by the #186 Unreleased
edit (the 3.0.0 block was orphaned under [Unreleased]).

3 new regression tests; full suite 1979 green.


Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg

Co-authored-by: Claude <noreply@anthropic.com>
sandstream added a commit that referenced this pull request Jul 1, 2026
#196)

Cut 3.1.0 from [Unreleased]:
- gzip-compress memory sync blobs before encryption (~3x smaller, #193)
- public-key sync mode — ephemeral sessions push with no secret (#192)
- kit agent-config wires GitHub Copilot (#195)
- external timestamp anchor via command transport (#186)
- plus device-identity hardening + transport fixes

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants