Skip to content

approve: accept a signature made outside chant, by an ssh key or a passkey (#4646) - #4690

Merged
lex00 merged 1 commit into
mainfrom
unit/approve-external-signature-4646
Nov 1, 2026
Merged

lex00 merged 1 commit into
mainfrom
unit/approve-external-signature-4646

Conversation

@lex00

@lex00 lex00 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Closes #4646.

What's added

chant approve <op> <gate> --statement runs the checks an approval runs, records nothing, and prints the statement --sign signs as a chant-gate-statement/v1 document (@intentius/chant/gate-statement.schema.json). It's the existing gateSealPayload bytes: op, gate, environment, plan digest, approver and time, LF-joined, with the relayed-by and checkpoint lines when they apply. The document gives them as text and base64 statement, plus digest (sha256:<hex>), challenge (base64url of the SHA-256, no padding, which is what Arugula's passkey ceremony signs), namespace (chant-gate), sealVersion and the fields. The statement fixes the time.

chant approve <op> <gate> --actor <p> --at <time> --signature <file|-> records a signature made elsewhere over that statement. --at has to be the statement's time in chant's form. It can't be earlier than the pending fact or more than five minutes ahead. The file holds either of these:

  • An armored ssh signature in chant-gate, checked against the signers file's keys for --actor. That covers a device key that is an ssh or security key. The seal is the one --sign would have made.
  • A WebAuthn assertion { id, clientDataJSON, authenticatorData, signature } (base64url), or a PublicKeyCredential.toJSON() with those under response. It's checked against a new passkeys list in .chant/trust.json: { principal, id, publicKey, rpId, origins }, where publicKey is base64url DER SPKI (what getPublicKey() returns). Ed25519, P-256 and RSA keys verify. The check is WebAuthn level 2 with node:crypto: type is webauthn.get, the challenge is the statement's, the origin is listed and not cross-origin, the rpIdHash matches rpId, UP and UV are both set, and the signature over authenticatorData || SHA-256(clientDataJSON) verifies. The counter isn't checked, since a ledger line can't know the last count.

A signature that doesn't verify for --actor is refused before anything is written, whether or not the gate is in identity.gates. A passkey seal is recorded as { kind: "webauthn", signer, key: <credential id>, signature, clientDataJSON, authenticatorData } (with version: 2 when it signs a checkpoint). An ssh seal still has no kind.

All the gate seal checks now go through one function, checkGateSignature in lifecycle/gate-seal.ts. Those are gateSealRefusal (sealed waves, quorum judge, gate-decision, override gate), admitApprover (the identity.gates rule) and checkGateSeal. So a run, workspace status, @intentius/chant/gate-decision and chant approve all re-check either kind from the ledger against the policy at base. gate-decision's zod-free trust reader reads passkeys as well, and trustConfigProblems agrees with the zod schema on them. A principal with a passkey at base counts as a signer for identity.attribution: "identified". The WebAuthn verifier is a new node:crypto-only module, lifecycle/gate-webauthn.ts. It's in all three bundle lists, and the gate-decision bundle budget goes from 58 to 66 KB because the bundle is about 63 KB now.

As with ssh seals, nothing counts unless the signers file exists at base, so a passkey-only workspace keeps an empty one. The docs say so.

Floor: GATE_EXTERNAL_SIGNATURE_FLOOR = NEXT_RELEASE in lifecycle/gate-statement.ts. Its schema text and the declaration reference's text are registered. release-floors.ts --npm --release 0.124.63: 87 floors and 2 texts agree. An older chant reads a trust.json with passkeys as invalid, which turns attestation off and fails closed, and it counts no passkey seal.

Decision record: ws-109 (and its README entry), since ws-080 had the seal as ssh only.

Tests

Real keys throughout: ssh-keygen keys, and node:crypto Ed25519 and P-256 passkeys with assertions built by hand.

  • lifecycle/gate-webauthn.test.ts: EdDSA and ES256 verify. Each of these is refused: a create ceremony, another challenge (including another plan digest), another origin, cross-origin, another rpId, UV unset, UP unset, another key under the listed id, an unlisted credential, and tampered authenticator data. gateSealRefusal counts a passkey seal only for its own principal, and refuses an unknown seal kind. --signature input is read in all three shapes.
  • cli/handlers/approve-external-signature.test.ts, against temp repos with a gate in identity.gates:
    • --statement equals gateSealPayload, validates against the schema and writes nothing.
    • An ssh signature made with alice's key counts, with an SHA256: fingerprint and no kind. The rule admits it and checkGateSeal attests it. Mallory's key, alice's key over another plan's statement, and the right signature at another --at are all refused.
    • Ed25519 and P-256 passkeys count. The ledger line read back is admitted and attested, and moving it to another plan breaks it.
    • Refused: another person's passkey, another plan, no UV, a wrong origin, a bad --at, --at without --signature, --sign with --signature, and an unsigned approval.
    • runApprove --statement prints the document, and the flags parse.

CHANT_SKIP_ARTIFACT_CHECK=1 npx vitest run --project unit over trust/, lifecycle/gate-, identity, gate-decision*, op/gate-review, op/gate-quorum*, op/gate.test, handlers/approve*, override-approve, gate-resume, cli/main.test, override-gate*, stage-hooks*, status-gates: 33 files, 513 tests, all pass. The decision and boundary tests pass, and import-decisions.mjs --check reports 0 problems. ESLint is clean on the changed files. Locally, npm run typecheck reports only the lexicon generated-file errors from an --ignore-scripts install, none in core.

Docs: "Approvals signed outside chant" in the declaration reference (statement format, passkeys, the checks, what's recorded), with the signer and gates rows updated, plus --statement, --signature and --at in cli/operator.mdx and chant approve --help.

Not done here: chant run approve and the MCP approve tool don't take --signature. There's no workspace trust passkey add command yet, so a passkey is added by editing trust.json, which is a protected write. The issue's --signer <id> isn't a flag: the signer is --actor, and for a passkey the assertion's credential id picks the entry.

@lex00
lex00 force-pushed the unit/approve-external-signature-4646 branch from a29c7a2 to 8871c89 Compare November 1, 2026 18:56
…sskey (#4646)

chant approve --statement prints the bytes --sign signs, as a
chant-gate-statement/v1 document with the time fixed. chant approve
--signature <file> --at <time> records an ssh signature over them, or a
passkey's WebAuthn assertion checked against passkeys in .chant/trust.json
at base. Both count toward an identity.gates gate, and the seal re-checks
offline through the one check every gate reader shares. ws-109.
@lex00
lex00 force-pushed the unit/approve-external-signature-4646 branch from 8871c89 to 602b5fc Compare November 1, 2026 19:03
@lex00
lex00 merged commit a6e4457 into main Nov 1, 2026
9 checks passed
@lex00
lex00 deleted the unit/approve-external-signature-4646 branch November 2, 2026 07:05
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.

approve: accept a signature made outside chant (device keys, passkeys) for signed-only gates

1 participant