Skip to content

feat: per-action audit trail (reins audit)#20

Merged
karngyan merged 15 commits into
mainfrom
audit-log
Jul 11, 2026
Merged

feat: per-action audit trail (reins audit)#20
karngyan merged 15 commits into
mainfrom
audit-log

Conversation

@karngyan

Copy link
Copy Markdown
Contributor

What

Phase 1 (Trust) audit-log slice, per docs/superpowers/specs/2026-07-11-audit-log-design.md:

  • Extension stamps action targets. The policy gate resolves each command's tab, host, and effective tier; those now ride back on every response frame as optional meta — on successes and policy denials (denials show what was blocked, not just what ran).
  • Daemon writes the trail. One redacted JSONL line per /rpc attempt (success / policy_denied / daemon-side failure) in ~/.reins/logs/audit-YYYY-MM-DD.jsonl. Value-bearing params (text, value, expression, promptText, upload paths, CDP payloads) are redacted before write — plaintext never reaches disk. Writes are best-effort (a full disk never breaks a command); files prune after 30 days.
  • reins audit views it. Table by default, --last <n> across day files, --denied, --json. Reads files directly — no daemon needed.

Also: security-page docs section, changeset (minor: cli + extension), roadmap tick.

Notes

  • ResponseFrame.meta is optional — older extensions stay compatible; their records just lack host/tier.
  • reins policy-style containment guarantee holds end-to-end: audit hook exceptions can never affect an RPC result (regression-tested).
  • Fast-follows noted in the final review: render table times in local time, lenient meta validation for extension-newer-than-daemon skew, browserId on mid-flight-disconnect rejections.

Test plan

  • pnpm lint && pnpm typecheck && pnpm build && pnpm test — full workspace green (171 cli tests; 414 total)
  • End-to-end record via stand-in WS extension in integration.test.ts
  • Real-binary smoke: reins audit, --denied --json composition, help line

🤖 Generated with Claude Code

karngyan and others added 15 commits July 11, 2026 20:43
Mark Phase 1 site-policy/read-tier items shipped (v0.3.0, #15),
leaving audit log, SECURITY.md, and skill hardening. Add the approved
audit-log design: extension stamps host/tier/tabId on response meta,
daemon writes redacted JSONL, reins audit views it, 30-day retention.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Spec fixes found while planning: policy denials already carry the
policy_denied error code (no new code needed), and the CLI flag parser
only supports --flag forms, so the viewer count flag is --last <n>.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nial

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…abId fallback

- Redact promptText (handle_dialog) — agent-typed dialog text no longer hits disk in plaintext.
- Denial/error audit records now carry the browser id that was actually reached, sourced from
  the rejection error (bridge #settle and requestFull timeout stamp .browserId).
- tabId falls back to params when response meta lacks it, per spec.
- finish()'s roster lookup moved inside its try/catch so no part of the audit path can throw
  into the RPC.
- audit-cli viewer now guards against JSON-parseable but shape-invalid lines (e.g. `5`, `{}`)
  instead of crashing on r.ts.slice.
- createAuditor test added for a not-yet-existing nested log directory.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@karngyan
karngyan merged commit 65ce7f3 into main Jul 11, 2026
2 checks passed
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