Skip to content

security: memory-hooks liveness gate (R5/#71) + shared-tier inject verification (R4/#77) - #245

Merged
sandstream merged 2 commits into
mainfrom
claude/web-kit-status-sync-p6fg9a
Jul 6, 2026
Merged

sandstream merged 2 commits into
mainfrom
claude/web-kit-status-sync-p6fg9a

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Description

The two remaining medium items from holistic-review-4.0.md. Both are "no false green" gaps on the memory subsystem; each was verified against current code first (parts had already landed).

Changes

#71 — kit check gates on memory-hooks liveness (src/check-security.ts)

  • New memory hooks liveness check: FAILS when capture hooks were installed here (durable marker present) but have since vanished from ~/.claude/settings.json (capture silently off — a false green). Skips when never installed (CI / fresh machine) and after a clean kit memory uninstall (which clears the marker), so it fails only on genuine silent degradation.
  • Already in place (verified): kit doctor flags the same liveness, and kit memory uninstall emits a memory.hooks.uninstall audit event. This adds the remaining "gate in kit check".

#77 — shared-tier signature verification on the recall inject path (src/memory/shared.ts, src/memory/hook.ts)

  • recentDecisions (SessionStart recovery / touched-decisions notice) replayed curated shared entries as trusted "Curated team decisions" without checking their signature. New recallSafeShared filters before injection: a bad-sig (tamper against a held key) is always dropped; under a committed .kit-policy.signers anchor only org-trusted entries are injected; with no anchor everything-but-tamper is kept (the common team-without-anchor case isn't broken).
  • Already in place (verified): shareEntry signs on write and kit memory verify verifies; this adds verification on the inject path.

Type of Change

  • Security hardening

Testing

  • npm test — 2369 pass, 0 fail
  • New tests: liveness skip/pass/fail (env-injected); recallSafeShared drops a tampered entry (no anchor) and injects only org-trusted entries under an anchor.

Breaking Changes

kit check gains a memory hooks liveness failure only when the capture loop silently degraded (marker present + a hook gone). Tampered/untrusted shared entries are no longer auto-injected on SessionStart.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2


Generated by Claude Code

claude added 2 commits July 6, 2026 16:26
The self-playing loop (memory capture + statusline) depends on hooks in
~/.claude/settings.json. If they were installed here (durable marker present)
but have since vanished, capture is silently OFF — the store looks installed
but records nothing (a false green). `kit doctor` already flagged this and
`kit memory uninstall` already emits an audit event; this folds the same
liveness into the `kit check` security gate.

New checkMemoryHooksLiveness(): skips when never installed (CI / fresh machine)
and after a clean uninstall (which clears the marker), so it FAILS only on
genuine silent degradation (marker present + a hook gone). Env-injected tests
cover skip/pass/fail.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
…#77)

recentDecisions (SessionStart recovery / touched-decisions notice) replayed
curated shared entries into every session as trusted "Curated team decisions"
without checking their Ed25519 signature — so a tampered or forged team entry
rode in as trusted (holistic-review #77). The sign/verify machinery existed
(shareEntry signs, kit memory verify verifies) but nothing verified on the
inject path.

New recallSafeShared(root, entries): drops a bad-sig entry ALWAYS (tamper must
never be replayed), and under a committed .kit-policy.signers anchor injects
ONLY org-trusted entries; with no anchor everything but tamper is kept so the
common team-without-anchor case isn't broken. Wired into recentDecisions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

✅ Docker image built successfully

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

@sandstream
sandstream merged commit e52bfa1 into main Jul 6, 2026
17 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a branch July 6, 2026 16:37
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