Skip to content

security: persist signed authority receipts and restore STEP_UP after restart - #88

Merged
blocksifrdev merged 3 commits into
mainfrom
security/durable-receipt-ledger-20261102
Nov 2, 2026
Merged

blocksifrdev merged 3 commits into
mainfrom
security/durable-receipt-ledger-20261102

Conversation

@blocksifrdev

Copy link
Copy Markdown
Collaborator

CFAV P0 follow-on for staging availability, fail-closed auditability, and approval continuity. Replace process-local receipt Map/lastHash with a single-instance, append-only HMAC-verified chained on-disk ledger that must be configured via an absolute private path. Every authority decision is fsynced before a PERMIT, STEP_UP, or DENY response is returned. Startup refuses malformed, tampered, truncated, symlinked, or permission-unsafe state. Exclusive ownership lock prevents two authority instances from forking the same ledger; unclean lock recovery requires operator review. Synthetic CI exercises real HTTP authority decisions, restart recovery, attempted concurrent opening, and tampering. No real GitHub reviewer/production secrets or unverified permissions are granted. Multi-node storage, external audit and target-side effect confirmation remain independent blockers.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T23:50:59.129662Z 986319c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 986319c358

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +67 to +71
const size = Buffer.byteLength(raw)
if (size !== fileStat.size || (size > 0 && !raw.endsWith("\n"))) {
throw new Error("TRUNCATED_OR_CHANGED_RECEIPT_LEDGER")
}
for (const line of raw.split("\n").filter(Boolean)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Detect receipt-ledger truncation at record boundaries

If the ledger loses one or more complete trailing records, startup accepts the shortened file because its remaining signatures and chain links still verify. I reproduced this by appending two signed receipts, closing the ledger, removing the second JSONL line, and reopening successfully with a count of one. Truncating to zero bytes is also accepted. This silently loses previously acknowledged decisions and prior STEP_UP receipts instead of failing closed. Persist and verify an independent committed head or record count so recovery can distinguish an intact ledger from a valid prefix.

Useful? React with 👍 / 👎.

@blocksifrdev
blocksifrdev merged commit bc0d05b into main Nov 2, 2026
3 of 5 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