Repository navigation
approve: accept a signature made outside chant, by an ssh key or a passkey (#4646) - #4690
Merged
Merged
Conversation
lex00
force-pushed
the
unit/approve-external-signature-4646
branch
from
November 1, 2026 18:56
a29c7a2 to
8871c89
Compare
…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
force-pushed
the
unit/approve-external-signature-4646
branch
from
November 1, 2026 19:03
8871c89 to
602b5fc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4646.
What's added
chant approve <op> <gate> --statementruns the checks an approval runs, records nothing, and prints the statement--signsigns as achant-gate-statement/v1document (@intentius/chant/gate-statement.schema.json). It's the existinggateSealPayloadbytes: op, gate, environment, plan digest, approver and time, LF-joined, with therelayed-byandcheckpointlines when they apply. The document gives them astextand base64statement, plusdigest(sha256:<hex>),challenge(base64url of the SHA-256, no padding, which is what Arugula's passkey ceremony signs),namespace(chant-gate),sealVersionand 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.--athas 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: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--signwould have made.{ id, clientDataJSON, authenticatorData, signature }(base64url), or aPublicKeyCredential.toJSON()with those underresponse. It's checked against a newpasskeyslist in.chant/trust.json:{ principal, id, publicKey, rpId, origins }, wherepublicKeyis base64url DER SPKI (whatgetPublicKey()returns). Ed25519, P-256 and RSA keys verify. The check is WebAuthn level 2 with node:crypto:typeiswebauthn.get, the challenge is the statement's, the origin is listed and not cross-origin, the rpIdHash matchesrpId, UP and UV are both set, and the signature overauthenticatorData || 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
--actoris refused before anything is written, whether or not the gate is inidentity.gates. A passkey seal is recorded as{ kind: "webauthn", signer, key: <credential id>, signature, clientDataJSON, authenticatorData }(withversion: 2when it signs a checkpoint). An ssh seal still has nokind.All the gate seal checks now go through one function,
checkGateSignatureinlifecycle/gate-seal.ts. Those aregateSealRefusal(sealed waves, quorum judge, gate-decision, override gate),admitApprover(theidentity.gatesrule) andcheckGateSeal. So a run,workspace status,@intentius/chant/gate-decisionandchant approveall re-check either kind from the ledger against the policy at base.gate-decision's zod-free trust reader readspasskeysas well, andtrustConfigProblemsagrees with the zod schema on them. A principal with a passkey at base counts as asignerforidentity.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_RELEASEinlifecycle/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 withpasskeysas 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.gateSealRefusalcounts a passkey seal only for its own principal, and refuses an unknown seal kind.--signatureinput is read in all three shapes.cli/handlers/approve-external-signature.test.ts, against temp repos with a gate inidentity.gates:--statementequalsgateSealPayload, validates against the schema and writes nothing.SHA256:fingerprint and nokind. The rule admits it andcheckGateSealattests it. Mallory's key, alice's key over another plan's statement, and the right signature at another--atare all refused.--at,--atwithout--signature,--signwith--signature, and an unsigned approval.runApprove --statementprints the document, and the flags parse.CHANT_SKIP_ARTIFACT_CHECK=1 npx vitest run --project unitover 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, andimport-decisions.mjs --checkreports 0 problems. ESLint is clean on the changed files. Locally,npm run typecheckreports only the lexicon generated-file errors from an--ignore-scriptsinstall, none in core.Docs: "Approvals signed outside chant" in the declaration reference (statement format,
passkeys, the checks, what's recorded), with the signer andgatesrows updated, plus--statement,--signatureand--atin cli/operator.mdx andchant approve --help.Not done here:
chant run approveand the MCP approve tool don't take--signature. There's noworkspace trust passkey addcommand 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.