33 Commits

Author SHA1 Message Date
9eea815805 Fix R1: invalidate view codes on revoke/rekey/suspend
Outstanding view codes survived revoke and rekey, so a pre-issued code
could mint a fresh human_via_agent session after compromise revoke or
key rotation. Invalidate unused codes when sessions are revoked (covers
revoke, suspend, and rekey), and refuse redeem when the agent is
currently revoked. Regression tests cover all three paths.
2026-10-06 06:28:01 +08:00
leora
73f802a5e6 Sealed store: AES-256-GCM encryption at rest for the DB file
Tokens/codes/secrets were already digests; a stolen cleartext SQLite file
still leaked the agent roster, revocation state and audit history.
SealedStore / SIGIL_SEAL_PASS wraps on-disk bytes in AES-256-GCM
(PBKDF2-HMAC-SHA256, 480k iters). Working copy is plaintext only while
open (temp file); flush/close re-seals. Incremental path short of
SQLCipher page-level encryption.

11 new tests in test_sealed.py (stolen seal has no SQLite header / no
agent rows; wrong passphrase fails; works with off-box anchor). Suite
130 green.

Part of Quarry 18a5d762. Independent crypto review + platform glue remain.
2026-10-06 06:28:01 +08:00
leora
13802d8f59 Off-box audit chain tip: publish/verify outside the SQLite file
A signed checkpoint inside the same database is still only as strong as that
file. Store(..., anchor_path=) / SIGIL_ANCHOR now writes the signed tip to a
filesystem path outside the DB (atomic tip file + append-only .log).
verify_external_anchors catches a rewrite even after in-DB checkpoints are
deleted. 8 new tests in test_anchor.py; suite 119 green.

Part of Quarry 18a5d762 (Sigil prod build). Do not merge to main yet:
sealed store and independent crypto review still open.
2026-10-06 06:28:01 +08:00
leora
0ecff7ed50 Drop stray tests/probe.txt (push probe, not a test fixture) 2026-10-06 06:28:01 +08:00
leora
9c4fe06fb5 Close three review blockers: rekey, dual-enrol race, redeem quotas
- put_agent is INSERT OR IGNORE (enrol create-if-absent); update_agent_key
  preserves revocation columns so rekey cannot un-revoke
- enrol_rekey and seed_bootstrap refuse while the agent is revoked
- redeem_code uses per-agent code_redeem / code_redeem_fail; anonymous
  guesses no longer lock valid codes for other agents
- remove dead duplicate revoke_agent; tests for each finding (111 total)

Do not merge to main yet: independent crypto review, off-box chain head,
sealed store, and platform glue still open.
2026-10-06 06:28:01 +08:00
557f98e1f9 Document the second pass and what is still open 2026-10-06 06:28:01 +08:00
53136cc38f Document the second pass and what is still open 2026-10-06 06:28:01 +08:00
43c55682c7 Route the human-session tests through the real code path 2026-10-06 06:28:01 +08:00
69669f12ec One test per finding in the second review pass 2026-10-06 06:28:01 +08:00
dbae7dc98f Document revocation and bump to 0.3.0 2026-10-06 06:28:01 +08:00
949feb7a32 Expose checkpoint, revoke, reinstate and sweep on the CLI 2026-10-06 06:28:01 +08:00
2d05f72656 Close the second round of review findings: public_from_private 2026-10-06 06:28:01 +08:00
5a20bae6a6 Close the second round of review findings: no credentials in the audit log 2026-10-06 06:28:01 +08:00
a7968dd4cb Close the second round of review findings: GrantedCode, no minting from a name 2026-10-06 06:28:01 +08:00
db9a450f0c Close the second round of review findings: revoke, reinstate, expiry 2026-10-06 06:28:01 +08:00
65cea0d927 Close the second round of review findings: checkpoints, revocation, WAL, sweep 2026-10-06 06:28:01 +08:00
910ddfde42 Harden Sigil: tests/test_hardening.py 2026-10-06 06:28:01 +08:00
2f5b24e8f9 Harden Sigil: tests/helpers.py 2026-10-06 06:28:01 +08:00
0c2fcd91f0 probe 2026-10-06 06:28:01 +08:00
da20d6c539 Harden Sigil: tests/test_viewcodes.py 2026-10-06 06:28:01 +08:00
4487f15b9e Harden Sigil: tests/test_sessions.py 2026-10-06 06:28:01 +08:00
71801d31cb Harden Sigil: sigil/viewcodes.py 2026-10-06 06:28:01 +08:00
a3c4e61832 Harden Sigil: sigil/store.py 2026-10-06 06:28:01 +08:00
fba91c1bf7 Harden Sigil: sigil/sessions.py 2026-10-06 06:28:01 +08:00
dc55b9a7aa Harden Sigil: sigil/keys.py 2026-10-06 06:28:01 +08:00
752e006e0d Harden Sigil: sigil/identity.py 2026-10-06 06:28:01 +08:00
df19aae02f Harden Sigil: sigil/errors.py 2026-10-06 06:28:01 +08:00
17792d96fb Harden Sigil: sigil/__init__.py 2026-10-06 06:28:01 +08:00
3d1087c17c Harden Sigil: sigil.py 2026-10-06 06:28:01 +08:00
bcd89a5db1 Harden Sigil: DESIGN.md 2026-10-06 06:28:01 +08:00
5e1db8afcd Harden Sigil: README.md 2026-10-06 06:28:01 +08:00
f4a044f1d6 Sigil: agent identity for the new internet
Replace passcode identity with Ed25519 challenge-response.

- Enrolment consumes a one-time bootstrap secret, after which no static
  secret is used on the wire again.
- Nonces are single-use and consumed before the signature is judged, so a
  captured or bad signature cannot be retried.
- Sessions are short-lived, scoped, and typed agent vs human_via_agent.
- Human view access uses one-time codes with a 5 minute redemption window
  and a 1 hour session, deliberately different numbers: the code is a key,
  the session is the door.
- Invariant: only an agent signature may act as an agent. Enforced and tested.
- Append-only audit trail.

54 tests, covering refusals rather than only the happy path.

Reference implementation, not reviewed or hardened. See README Status.
2026-10-06 06:28:01 +08:00
7f0e73f281 Initialise bigpickle/sigil
Component repo for Sigil. Content arrives by pull request.
2026-10-05 20:44:17 +08:00