@intentius/chant 0.124.62 → 0.124.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/handlers/approve.d.ts +26 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +167 -18
- package/dist/cli/handlers/plan.d.ts +10 -0
- package/dist/cli/handlers/plan.d.ts.map +1 -0
- package/dist/cli/handlers/plan.js +71 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +2 -1
- package/dist/cli/handlers/release.d.ts +11 -7
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +93 -20
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +48 -7
- package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
- package/dist/cli/mcp/workspace-tools.js +2 -1
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +43 -0
- package/dist/cli/registry.d.ts +18 -2
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/config.d.ts +50 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/gate-decision.d.ts +1 -1
- package/dist/gate-decision.d.ts.map +1 -1
- package/dist/gate-decision.js +4 -2
- package/dist/gate-statement.schema.json +46 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +20 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts.map +1 -1
- package/dist/lifecycle/__fixtures__/publish-fakes.js +119 -3
- package/dist/lifecycle/gate-ledger.d.ts +28 -5
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +6 -0
- package/dist/lifecycle/gate-seal.d.ts +59 -7
- package/dist/lifecycle/gate-seal.d.ts.map +1 -1
- package/dist/lifecycle/gate-seal.js +68 -15
- package/dist/lifecycle/gate-statement.d.ts +95 -0
- package/dist/lifecycle/gate-statement.d.ts.map +1 -0
- package/dist/lifecycle/gate-statement.js +110 -0
- package/dist/lifecycle/gate-webauthn.d.ts +79 -0
- package/dist/lifecycle/gate-webauthn.d.ts.map +1 -0
- package/dist/lifecycle/gate-webauthn.js +105 -0
- package/dist/lifecycle/git.d.ts +1 -1
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +24 -19
- package/dist/lifecycle/ledger-remote.d.ts +37 -0
- package/dist/lifecycle/ledger-remote.d.ts.map +1 -0
- package/dist/lifecycle/ledger-remote.js +42 -0
- package/dist/lifecycle/plan-stale.d.ts +76 -0
- package/dist/lifecycle/plan-stale.d.ts.map +1 -0
- package/dist/lifecycle/plan-stale.js +120 -0
- package/dist/lifecycle/publish-credentials.d.ts +1 -1
- package/dist/lifecycle/publish-credentials.d.ts.map +1 -1
- package/dist/lifecycle/publish-credentials.js +2 -0
- package/dist/lifecycle/publish-declaration.d.ts +107 -0
- package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
- package/dist/lifecycle/publish-declaration.js +110 -1
- package/dist/lifecycle/publish-forge.d.ts +5 -1
- package/dist/lifecycle/publish-forge.d.ts.map +1 -1
- package/dist/lifecycle/publish-forge.js +13 -4
- package/dist/lifecycle/publish-git-ssh.d.ts +82 -0
- package/dist/lifecycle/publish-git-ssh.d.ts.map +1 -0
- package/dist/lifecycle/publish-git-ssh.js +180 -0
- package/dist/lifecycle/publish-github.d.ts +69 -0
- package/dist/lifecycle/publish-github.d.ts.map +1 -0
- package/dist/lifecycle/publish-github.js +153 -0
- package/dist/lifecycle/publish-homebrew.d.ts +77 -0
- package/dist/lifecycle/publish-homebrew.d.ts.map +1 -0
- package/dist/lifecycle/publish-homebrew.js +265 -0
- package/dist/lifecycle/publish-marketplace.d.ts +85 -0
- package/dist/lifecycle/publish-marketplace.d.ts.map +1 -0
- package/dist/lifecycle/publish-marketplace.js +398 -0
- package/dist/lifecycle/publish-targets.d.ts +6 -0
- package/dist/lifecycle/publish-targets.d.ts.map +1 -1
- package/dist/lifecycle/publish-targets.js +15 -0
- package/dist/lifecycle/publish-tauri.d.ts +61 -0
- package/dist/lifecycle/publish-tauri.d.ts.map +1 -0
- package/dist/lifecycle/publish-tauri.js +181 -0
- package/dist/lifecycle/release-cut.d.ts +51 -5
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +165 -16
- package/dist/lifecycle/release-publish.d.ts +18 -2
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- package/dist/lifecycle/release-publish.js +5 -0
- package/dist/lifecycle/release-revocation.d.ts +4 -3
- package/dist/lifecycle/release-revocation.d.ts.map +1 -1
- package/dist/lifecycle/release-revocation.js +5 -4
- package/dist/lifecycle/release-store.d.ts +32 -0
- package/dist/lifecycle/release-store.d.ts.map +1 -1
- package/dist/lifecycle/release-store.js +11 -0
- package/dist/lifecycle/snapshot-store.d.ts.map +1 -1
- package/dist/lifecycle/snapshot-store.js +17 -9
- package/dist/lifecycle/test-passkey.d.ts +25 -0
- package/dist/lifecycle/test-passkey.d.ts.map +1 -0
- package/dist/lifecycle/test-passkey.js +39 -0
- package/dist/notify.d.ts +23 -3
- package/dist/notify.d.ts.map +1 -1
- package/dist/notify.js +8 -2
- package/dist/notify.schema.json +12 -3
- package/dist/op/gate.d.ts +1 -1
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +2 -1
- package/dist/pr-forge.d.ts +20 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +87 -8
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/wave-runtime.mjs +333 -331
- package/dist/workspace/ci-builds.d.ts +21 -0
- package/dist/workspace/ci-builds.d.ts.map +1 -1
- package/dist/workspace/ci-builds.js +14 -0
- package/dist/workspace/ci-green.d.ts +45 -2
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +123 -5
- package/dist/workspace/ci-quarantine-report.d.ts +80 -0
- package/dist/workspace/ci-quarantine-report.d.ts.map +1 -0
- package/dist/workspace/ci-quarantine-report.js +204 -0
- package/dist/workspace/ci-quarantine.d.ts +73 -0
- package/dist/workspace/ci-quarantine.d.ts.map +1 -0
- package/dist/workspace/ci-quarantine.js +170 -0
- package/dist/workspace/ci-serve.d.ts.map +1 -1
- package/dist/workspace/ci-serve.js +7 -4
- package/dist/workspace/class-data.d.ts +3 -1
- package/dist/workspace/class-data.d.ts.map +1 -1
- package/dist/workspace/class-data.js +4 -1
- package/dist/workspace/declaration.d.ts +45 -2
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +45 -2
- package/dist/workspace/declaration.schema.json +51 -3
- package/dist/workspace/forge-work.d.ts +76 -0
- package/dist/workspace/forge-work.d.ts.map +1 -0
- package/dist/workspace/forge-work.js +160 -0
- package/dist/workspace/identity-gate-rule.d.ts +3 -2
- package/dist/workspace/identity-gate-rule.d.ts.map +1 -1
- package/dist/workspace/identity-gate-rule.js +5 -7
- package/dist/workspace/identity.d.ts +3 -2
- package/dist/workspace/identity.d.ts.map +1 -1
- package/dist/workspace/identity.js +6 -3
- package/dist/workspace/intent-cli.d.ts +3 -2
- package/dist/workspace/intent-cli.d.ts.map +1 -1
- package/dist/workspace/intent-cli.js +26 -5
- package/dist/workspace/intent-record.d.ts +3 -0
- package/dist/workspace/intent-record.d.ts.map +1 -1
- package/dist/workspace/intent-record.schema.json +32 -0
- package/dist/workspace/intent.d.ts +9 -0
- package/dist/workspace/intent.d.ts.map +1 -1
- package/dist/workspace/intent.js +2 -0
- package/dist/workspace/intent.schema.json +32 -0
- package/dist/workspace/kind-readers.d.ts.map +1 -1
- package/dist/workspace/kind-readers.js +2 -1
- package/dist/workspace/kinds.d.ts +6 -1
- package/dist/workspace/kinds.d.ts.map +1 -1
- package/dist/workspace/kinds.js +8 -3
- package/dist/workspace/plan-stale.schema.json +286 -0
- package/dist/workspace/release-candidates.d.ts +42 -7
- package/dist/workspace/release-candidates.d.ts.map +1 -1
- package/dist/workspace/release-candidates.js +64 -23
- package/dist/workspace/release-candidates.schema.json +55 -2
- package/dist/workspace/releases.schema.json +47 -0
- package/dist/workspace/trust/policy.d.ts +10 -0
- package/dist/workspace/trust/policy.d.ts.map +1 -1
- package/dist/workspace/trust/policy.js +19 -1
- package/dist/workspace/trust/run-commits.d.ts.map +1 -1
- package/dist/workspace/trust/run-commits.js +2 -1
- package/dist/workspace/trust/seal.d.ts.map +1 -1
- package/dist/workspace/trust/seal.js +34 -3
- package/dist/workspace/trust/trust-files.d.ts.map +1 -1
- package/dist/workspace/trust/trust-files.js +6 -1
- package/package.json +2 -1
- package/src/cli/handlers/approve-external-signature.test.ts +328 -0
- package/src/cli/handlers/approve.ts +206 -18
- package/src/cli/handlers/plan.ts +74 -0
- package/src/cli/handlers/pr.ts +2 -1
- package/src/cli/handlers/release.ts +84 -20
- package/src/cli/main.ts +48 -7
- package/src/cli/mcp/workspace-tools.ts +2 -1
- package/src/cli/parse-args.ts +33 -0
- package/src/cli/registry.ts +18 -2
- package/src/config.ts +8 -0
- package/src/gate-decision-bundle.test.ts +4 -2
- package/src/gate-decision.ts +11 -2
- package/src/gate-statement.schema.json +46 -0
- package/src/lifecycle/__fixtures__/publish-fakes.ts +125 -5
- package/src/lifecycle/gate-ledger.ts +34 -5
- package/src/lifecycle/gate-seal.ts +86 -15
- package/src/lifecycle/gate-statement.ts +144 -0
- package/src/lifecycle/gate-webauthn.test.ts +77 -0
- package/src/lifecycle/gate-webauthn.ts +133 -0
- package/src/lifecycle/git.ts +23 -19
- package/src/lifecycle/ledger-remote.test.ts +183 -0
- package/src/lifecycle/ledger-remote.ts +46 -0
- package/src/lifecycle/plan-stale.test.ts +149 -0
- package/src/lifecycle/plan-stale.ts +172 -0
- package/src/lifecycle/publish-credentials.ts +2 -0
- package/src/lifecycle/publish-declaration.ts +116 -1
- package/src/lifecycle/publish-forge.ts +14 -4
- package/src/lifecycle/publish-git-ssh.ts +202 -0
- package/src/lifecycle/publish-github.ts +174 -0
- package/src/lifecycle/publish-homebrew.test.ts +358 -0
- package/src/lifecycle/publish-homebrew.ts +283 -0
- package/src/lifecycle/publish-marketplace.test.ts +406 -0
- package/src/lifecycle/publish-marketplace.ts +421 -0
- package/src/lifecycle/publish-resume.test.ts +40 -0
- package/src/lifecycle/publish-target-context.test.ts +2 -2
- package/src/lifecycle/publish-targets.test.ts +23 -0
- package/src/lifecycle/publish-targets.ts +15 -0
- package/src/lifecycle/publish-tauri.test.ts +163 -0
- package/src/lifecycle/publish-tauri.ts +198 -0
- package/src/lifecycle/release-cut-lane.test.ts +177 -0
- package/src/lifecycle/release-cut-override.test.ts +213 -0
- package/src/lifecycle/release-cut.ts +198 -17
- package/src/lifecycle/release-publish.ts +23 -3
- package/src/lifecycle/release-revocation.ts +5 -4
- package/src/lifecycle/release-store.ts +44 -0
- package/src/lifecycle/snapshot-store.ts +16 -9
- package/src/lifecycle/test-passkey.ts +55 -0
- package/src/notify-bundle.test.ts +3 -1
- package/src/notify.schema.json +12 -3
- package/src/notify.ts +20 -3
- package/src/op/gate.ts +2 -1
- package/src/override-gate-bundle.test.ts +2 -0
- package/src/pr-forge-bundle.test.ts +2 -2
- package/src/pr-forge.test.ts +38 -0
- package/src/pr-forge.ts +93 -11
- package/src/pr-requires.test.ts +9 -0
- package/src/release-floors.ts +1 -1
- package/src/stage-hooks-bundle.test.ts +2 -0
- package/src/wave-runtime-bundle.test.ts +3 -2
- package/src/workspace/ci-builds.ts +27 -0
- package/src/workspace/ci-green-stale.test.ts +193 -0
- package/src/workspace/ci-green.ts +137 -6
- package/src/workspace/ci-quarantine-report.test.ts +145 -0
- package/src/workspace/ci-quarantine-report.ts +234 -0
- package/src/workspace/ci-quarantine.test.ts +160 -0
- package/src/workspace/ci-quarantine.ts +188 -0
- package/src/workspace/ci-serve.ts +7 -4
- package/src/workspace/class-data.ts +5 -1
- package/src/workspace/declaration.schema.json +51 -3
- package/src/workspace/declaration.test.ts +1 -0
- package/src/workspace/declaration.ts +88 -5
- package/src/workspace/forge-work.test.ts +143 -0
- package/src/workspace/forge-work.ts +195 -0
- package/src/workspace/identity-gate-rule.ts +6 -8
- package/src/workspace/identity.ts +6 -3
- package/src/workspace/intent-cli.ts +24 -5
- package/src/workspace/intent-record.schema.json +32 -0
- package/src/workspace/intent-record.ts +3 -0
- package/src/workspace/intent.schema.json +32 -0
- package/src/workspace/intent.ts +9 -0
- package/src/workspace/kind-readers.ts +2 -1
- package/src/workspace/kinds.test.ts +13 -0
- package/src/workspace/kinds.ts +12 -3
- package/src/workspace/plan-stale.schema.json +286 -0
- package/src/workspace/release-candidates.schema.json +55 -2
- package/src/workspace/release-candidates.test.ts +77 -4
- package/src/workspace/release-candidates.ts +80 -23
- package/src/workspace/releases.schema.json +47 -0
- package/src/workspace/trust/gate-seal.test.ts +44 -0
- package/src/workspace/trust/policy.ts +24 -1
- package/src/workspace/trust/run-commits.ts +2 -1
- package/src/workspace/trust/seal.ts +35 -3
- package/src/workspace/trust/trust-files.test.ts +5 -0
- package/src/workspace/trust/trust-files.ts +15 -1
|
@@ -393,6 +393,53 @@
|
|
|
393
393
|
"channel": {
|
|
394
394
|
"type": "string",
|
|
395
395
|
"description": "Added by #4168 4.3, written by chant 0.124.35 and newer. The tag release publish moves in place of latest (an npm dist-tag, an image tag), from release cut --channel. Absent for latest."
|
|
396
|
+
},
|
|
397
|
+
"lane": {
|
|
398
|
+
"type": "string",
|
|
399
|
+
"description": "Added by #4692, written by chant 0.124.64 and newer. The green lane the cut checked, from release cut --lane or release.lane in chant.config.ts: the commit carried ci/green-<lane>/<sha> and no ci/revoked-<lane>/<sha>. Absent on a cut that checked ci/green/<sha>."
|
|
400
|
+
},
|
|
401
|
+
"override": {
|
|
402
|
+
"type": "object",
|
|
403
|
+
"required": [
|
|
404
|
+
"green",
|
|
405
|
+
"tag",
|
|
406
|
+
"by",
|
|
407
|
+
"at",
|
|
408
|
+
"reason",
|
|
409
|
+
"digest",
|
|
410
|
+
"sealed"
|
|
411
|
+
],
|
|
412
|
+
"properties": {
|
|
413
|
+
"green": {
|
|
414
|
+
"const": false,
|
|
415
|
+
"description": "The commit was not green."
|
|
416
|
+
},
|
|
417
|
+
"tag": {
|
|
418
|
+
"type": "string",
|
|
419
|
+
"description": "The green tag it had none of that counts: ci/green/<sha>, or ci/green-<lane>/<sha>."
|
|
420
|
+
},
|
|
421
|
+
"by": {
|
|
422
|
+
"type": "string",
|
|
423
|
+
"description": "Who wrote the override, a person the overriders file at base lists."
|
|
424
|
+
},
|
|
425
|
+
"at": {
|
|
426
|
+
"type": "string",
|
|
427
|
+
"description": "When the override was written."
|
|
428
|
+
},
|
|
429
|
+
"reason": {
|
|
430
|
+
"type": "string",
|
|
431
|
+
"description": "Why, in the overrider's words."
|
|
432
|
+
},
|
|
433
|
+
"digest": {
|
|
434
|
+
"type": "string",
|
|
435
|
+
"description": "The override digest on _gates/policy-override.jsonl, binding the subject release-<sha12>, the commit and the rule."
|
|
436
|
+
},
|
|
437
|
+
"sealed": {
|
|
438
|
+
"type": "boolean",
|
|
439
|
+
"description": "Whether the override was sealed, as a release gate in identity.gates requires."
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
"description": "Added by #4693, written by chant 0.124.64 and newer. The commit was not green, and release cut --override-green cut it under a person's override, which it spent. Absent on a cut of a green commit."
|
|
396
443
|
}
|
|
397
444
|
}
|
|
398
445
|
},
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
import { z } from "zod";
|
|
24
24
|
import type { RecordSource } from "../record-source.js";
|
|
25
25
|
import { type ExcludedSigner, type Signer } from "./trust-files.js";
|
|
26
|
+
import type { PasskeySigner } from "../../lifecycle/gate-webauthn.js";
|
|
26
27
|
export { DEFAULT_SIGNERS_PATH, TRUST_CONFIG_PATH, parseAllowedSigners, renderAllowedSigners, type ExcludedSigner, type Signer, type SignerSet, } from "./trust-files.js";
|
|
27
28
|
export declare const trustConfigSchema: z.ZodObject<{
|
|
28
29
|
schema: z.ZodLiteral<1>;
|
|
@@ -41,6 +42,13 @@ export declare const trustConfigSchema: z.ZodObject<{
|
|
|
41
42
|
}>;
|
|
42
43
|
key: z.ZodString;
|
|
43
44
|
}, z.core.$strict>>>;
|
|
45
|
+
passkeys: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
46
|
+
principal: z.ZodString;
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
publicKey: z.ZodString;
|
|
49
|
+
rpId: z.ZodString;
|
|
50
|
+
origins: z.ZodArray<z.ZodString>;
|
|
51
|
+
}, z.core.$strict>>>;
|
|
44
52
|
admitted: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
45
53
|
return: z.ZodString;
|
|
46
54
|
signers: z.ZodArray<z.ZodObject<{
|
|
@@ -82,6 +90,8 @@ export interface TrustPolicy {
|
|
|
82
90
|
principal: string;
|
|
83
91
|
reason: string;
|
|
84
92
|
}>;
|
|
93
|
+
/** Passkeys that sign people's gate approvals (#4646). Absent on a policy built by hand: none. */
|
|
94
|
+
passkeys?: PasskeySigner[];
|
|
85
95
|
/** Signers admitted per return (#2552), keyed by return id. They verify that return's commits and seals only. */
|
|
86
96
|
admitted: Record<string, Signer[]>;
|
|
87
97
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAgE,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KA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
.optional(),
|
|
66
|
+
/**
|
|
67
|
+
* Passkeys that sign gate approvals for people (#4646): a WebAuthn
|
|
68
|
+
* credential's id, its public key as base64url DER SubjectPublicKeyInfo,
|
|
69
|
+
* the relying party id and the origins an assertion may come from. A
|
|
70
|
+
* passkey signs only a gate approval (`chant approve --signature`).
|
|
71
|
+
*/
|
|
72
|
+
passkeys: z
|
|
73
|
+
.array(z
|
|
74
|
+
.object({
|
|
75
|
+
principal: z.string().min(1),
|
|
76
|
+
id: z.string().regex(/^[A-Za-z0-9_-]+$/, "a credential id, base64url with no padding"),
|
|
77
|
+
publicKey: z.string().regex(/^[A-Za-z0-9_-]+$/, "a DER SubjectPublicKeyInfo, base64url with no padding"),
|
|
78
|
+
rpId: z.string().min(1),
|
|
79
|
+
origins: z.array(z.string().min(1)).min(1),
|
|
80
|
+
})
|
|
81
|
+
.strict())
|
|
82
|
+
.optional(),
|
|
66
83
|
/**
|
|
67
84
|
* Signers admitted for the work one return brought back (#2552, D10,
|
|
68
85
|
* ws-004). Each entry names the return by its id (the file
|
|
@@ -104,7 +121,7 @@ export function policyWriters(policy) {
|
|
|
104
121
|
}
|
|
105
122
|
/** A policy with nothing in it: attestation off. */
|
|
106
123
|
export function emptyPolicy(base, problems = []) {
|
|
107
|
-
return { base, signersPath: DEFAULT_SIGNERS_PATH, active: false, signers: [], excluded: [], roles: {}, adopted: [], runners: [], excludedRunners: [], admitted: {}, problems };
|
|
124
|
+
return { base, signersPath: DEFAULT_SIGNERS_PATH, active: false, signers: [], excluded: [], roles: {}, adopted: [], runners: [], excludedRunners: [], passkeys: [], admitted: {}, problems };
|
|
108
125
|
}
|
|
109
126
|
/**
|
|
110
127
|
* Read the policy through `source`, which must read the base revision.
|
|
@@ -160,6 +177,7 @@ export function readTrustPolicy(source, base) {
|
|
|
160
177
|
adopted: config.adopted ?? [],
|
|
161
178
|
runners,
|
|
162
179
|
excludedRunners,
|
|
180
|
+
passkeys: config.passkeys ?? [],
|
|
163
181
|
admitted: admittedOf(config),
|
|
164
182
|
problems: [],
|
|
165
183
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-commits.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/run-commits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAsE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"run-commits.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/run-commits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAsE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAG3G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAW1C,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,EAAE,CAAA;CAAE,CAmBxG;AAED,+FAA+F;AAC/F,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qFAAqF;IACrF,QAAQ,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,4EAA4E;IAC5E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iDAAiD;IACjD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,iFAAiF;IACjF,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,UAAU,CAuCrG"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import { execFileSync } from "node:child_process";
|
|
13
13
|
import { AGENT_RUNS_DIR, LEDGER_BRANCH, foldRun, parseRunFile, readRunFiles } from "../runs.js";
|
|
14
14
|
import { RUN_TRAILER } from "../trailers.js";
|
|
15
|
+
import { lifecycleRemoteOverride } from "../../lifecycle/ledger-remote.js";
|
|
15
16
|
import { attestRun } from "./run-statement.js";
|
|
16
17
|
function git(repo, args) {
|
|
17
18
|
try {
|
|
@@ -23,7 +24,7 @@ function git(repo, args) {
|
|
|
23
24
|
}
|
|
24
25
|
/** Every run on the ledger, in every member's `_agent-runs`, and the ref and tip read. */
|
|
25
26
|
export function readLedgerRuns(repo) {
|
|
26
|
-
for (const ref of [`refs/heads/${LEDGER_BRANCH}`, `refs/remotes
|
|
27
|
+
for (const ref of [`refs/heads/${LEDGER_BRANCH}`, `refs/remotes/${lifecycleRemoteOverride() ?? "origin"}/${LEDGER_BRANCH}`]) {
|
|
27
28
|
const tip = git(repo, ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`])?.trim();
|
|
28
29
|
if (!tip)
|
|
29
30
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/seal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,OAAO,
|
|
1
|
+
{"version":3,"file":"seal.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/seal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH,OAAO,KAAK,E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AAE,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAE9I;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,WAAW,CAEpI;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,GAAG,WAAW,CAEpF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAEnJ"}
|
|
@@ -26,7 +26,7 @@ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
|
26
26
|
import { homedir, tmpdir } from "node:os";
|
|
27
27
|
import { join, resolve } from "node:path";
|
|
28
28
|
import { sshKeygen, verifySshSignature } from "./ssh-commit.js";
|
|
29
|
-
import { GATE_SEAL_NAMESPACE, gateSealPayload,
|
|
29
|
+
import { checkGateSignature, GATE_SEAL_NAMESPACE, gateSealPayload, sshSignatureKey, verifySshSignatureWith, WEBAUTHN_SEAL_KIND } from "../../lifecycle/gate-seal.js";
|
|
30
30
|
import { RELEASE_SEAL_NAMESPACE, releaseSealPayload } from "../identity-gate-rule.js";
|
|
31
31
|
export { GATE_SEAL_NAMESPACE, gateSealPayload, gateSealVersion, sealedFieldsOf } from "../../lifecycle/gate-seal.js";
|
|
32
32
|
/** The ssh signature namespace of a verdict seal. */
|
|
@@ -94,6 +94,9 @@ export function checkRecordSeal(policy, r) {
|
|
|
94
94
|
* when the signers file at base lists a key for the approver.
|
|
95
95
|
*/
|
|
96
96
|
export function checkGateSeal(policy, a) {
|
|
97
|
+
// #4646: a seal of kind webauthn is a passkey's assertion, listed in .chant/trust.json, not the signers file.
|
|
98
|
+
if (isWebAuthnSeal(a.seal))
|
|
99
|
+
return checkWebAuthnGateSeal(policy, a);
|
|
97
100
|
return checkSeal(policy, {
|
|
98
101
|
principal: a.resolvedBy,
|
|
99
102
|
what: `the approval of gate ${a.gate} by ${a.resolvedBy}`,
|
|
@@ -150,10 +153,38 @@ function checkSeal(policy, s) {
|
|
|
150
153
|
}
|
|
151
154
|
/** A gate seal checked with node:crypto (#3785) against the keys `listed` for the approver in the gate namespace. */
|
|
152
155
|
function verifyGate(listed, payload, signature) {
|
|
153
|
-
const
|
|
154
|
-
const r = verifySshSignatureWith(signature, payload, GATE_SEAL_NAMESPACE, keys);
|
|
156
|
+
const r = checkGateSignature({ signers: listed }, listed[0].principal, { signature }, payload);
|
|
155
157
|
return r.ok ? { ok: true, principal: listed[0].principal, key: r.key } : { ok: false, reason: r.reason };
|
|
156
158
|
}
|
|
159
|
+
const isWebAuthnSeal = (seal) => typeof seal === "object" && seal !== null && !Array.isArray(seal) && seal.kind === WEBAUTHN_SEAL_KIND;
|
|
160
|
+
/**
|
|
161
|
+
* A passkey's seal on a gate approval (#4646), checked against the passkeys
|
|
162
|
+
* `.chant/trust.json` lists at base for the approver. As with an ssh seal,
|
|
163
|
+
* attestation is on only when the signers file exists at base; with none, a
|
|
164
|
+
* seal that verifies against a listed passkey is intact and unattested.
|
|
165
|
+
*/
|
|
166
|
+
function checkWebAuthnGateSeal(policy, a) {
|
|
167
|
+
const what = `the approval of gate ${a.gate} by ${a.resolvedBy}`;
|
|
168
|
+
const seal = a.seal;
|
|
169
|
+
if (typeof seal.signer !== "string" || typeof seal.signature !== "string") {
|
|
170
|
+
return { attested: false, code: "seal-signature-invalid", message: `the seal on ${what} is malformed: it needs signer and signature` };
|
|
171
|
+
}
|
|
172
|
+
if (normalise(seal.signer) !== normalise(a.resolvedBy)) {
|
|
173
|
+
return { attested: false, code: "seal-signature-invalid", message: `the seal on ${what} is by ${seal.signer}, and its approver is ${a.resolvedBy || "empty"}` };
|
|
174
|
+
}
|
|
175
|
+
const r = checkGateSignature(policy, a.resolvedBy, seal, gateSealPayload(a));
|
|
176
|
+
if (r.ok && !policy.active) {
|
|
177
|
+
return { attested: null, code: "seal-unverifiable", message: `the passkey signature is intact (${r.key}), and there is no signers file at base to turn attestation on`, key: r.key };
|
|
178
|
+
}
|
|
179
|
+
if (r.ok)
|
|
180
|
+
return { attested: true, message: `sealed by ${a.resolvedBy} with passkey ${r.key}, which .chant/trust.json at base lists`, key: r.key };
|
|
181
|
+
if (r.unlisted) {
|
|
182
|
+
return policy.active
|
|
183
|
+
? { attested: false, code: "seal-signer-unlisted", message: `${a.resolvedBy} has no passkey in .chant/trust.json at base, so the seal can't count` }
|
|
184
|
+
: { attested: null, code: "seal-unverifiable", message: `the seal by ${a.resolvedBy} is a passkey's, and .chant/trust.json at base lists none for them` };
|
|
185
|
+
}
|
|
186
|
+
return { attested: false, code: "seal-signature-invalid", message: `the seal does not verify for ${a.resolvedBy} against .chant/trust.json at base: ${r.reason}` };
|
|
187
|
+
}
|
|
157
188
|
/** A seal checked with no signers file: is the signature over these bytes intact? */
|
|
158
189
|
function checkIntegrity(principal, payload, signature, namespace) {
|
|
159
190
|
if (namespace === GATE_SEAL_NAMESPACE) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trust-files.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/trust-files.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,0GAA0G;AAC1G,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAe7D,uEAAuE;AACvE,MAAM,WAAW,MAAM;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,GAAG,EAAE,M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IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAmDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAkD3D;AAED,8FAA8F;AAC9F,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAM9D;AASD,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAElD;AAOD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CA4D1D"}
|
|
@@ -175,7 +175,7 @@ export function trustConfigProblems(raw) {
|
|
|
175
175
|
if (!ok)
|
|
176
176
|
problems.push(`${field}: ${message}`);
|
|
177
177
|
};
|
|
178
|
-
check("/", only(raw, ["schema", "signers", "roles", "adopted", "runners", "admitted"]), "unknown key");
|
|
178
|
+
check("/", only(raw, ["schema", "signers", "roles", "adopted", "runners", "passkeys", "admitted"]), "unknown key");
|
|
179
179
|
check("schema", raw.schema === 1, "expected 1");
|
|
180
180
|
check("signers", optional(raw.signers, isRepoPath), "a path inside the repository, with / separators and no ..");
|
|
181
181
|
check("roles", optional(raw.roles, (r) => isObject(r) && Object.entries(r).every(([k, v]) => /^[a-z][a-z0-9-]*$/.test(k) && Array.isArray(v) && v.every(nonEmpty))), "role names to lists of principals");
|
|
@@ -183,6 +183,11 @@ export function trustConfigProblems(raw) {
|
|
|
183
183
|
a.every((e) => isObject(e) && only(e, ["from", "to", "note"]) && optional(e.from, (f) => typeof f === "string" && FULL_COMMIT.test(f)) && typeof e.to === "string" && FULL_COMMIT.test(e.to) && optional(e.note, (n) => typeof n === "string"))), "commit ranges of full commit ids");
|
|
184
184
|
check("runners", optional(raw.runners, (a) => Array.isArray(a) &&
|
|
185
185
|
a.every((e) => isObject(e) && only(e, ["principal", "class", "key"]) && nonEmpty(e.principal) && (e.class === "runner" || e.class === "service") && typeof e.key === "string" && SSH_ED25519.test(e.key))), "runner keys: a principal, a class and an ssh-ed25519 key");
|
|
186
|
+
const b64url = (v) => typeof v === "string" && /^[A-Za-z0-9_-]+$/.test(v);
|
|
187
|
+
check("passkeys", optional(raw.passkeys, (a) => Array.isArray(a) &&
|
|
188
|
+
a.every((e) => isObject(e) && only(e, ["principal", "id", "publicKey", "rpId", "origins"]) &&
|
|
189
|
+
nonEmpty(e.principal) && b64url(e.id) && b64url(e.publicKey) && nonEmpty(e.rpId) &&
|
|
190
|
+
Array.isArray(e.origins) && e.origins.length > 0 && e.origins.every(nonEmpty))), "passkeys: a principal, a credential id, a public key, an rpId and origins");
|
|
186
191
|
check("admitted", optional(raw.admitted, (a) => Array.isArray(a) &&
|
|
187
192
|
a.every((e) => isObject(e) && only(e, ["return", "signers", "note"]) &&
|
|
188
193
|
typeof e.return === "string" && /^ret-[0-9a-f]{12}$/.test(e.return) &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant",
|
|
3
|
-
"version": "0.124.
|
|
3
|
+
"version": "0.124.64",
|
|
4
4
|
"description": "Declarative infrastructure-as-code toolkit — TypeScript on Node.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"./capabilities/templates.json": "./src/capabilities/templates.json",
|
|
58
58
|
"./notify.schema.json": "./src/notify.schema.json",
|
|
59
59
|
"./health.schema.json": "./src/health.schema.json",
|
|
60
|
+
"./gate-statement.schema.json": "./src/gate-statement.schema.json",
|
|
60
61
|
"./workspace/factory-rules": {
|
|
61
62
|
"development": "./src/workspace/factory-rules.ts",
|
|
62
63
|
"types": "./dist/workspace/factory-rules.d.ts",
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #4646: an approval signed outside chant counts toward a gate that counts
|
|
3
|
+
* only signed approvals. `chant approve --statement` prints the bytes, an ssh
|
|
4
|
+
* key on another machine or a passkey signs them, and `chant approve
|
|
5
|
+
* --signature` records the signature, checked against the signers file and
|
|
6
|
+
* the passkeys in `.chant/trust.json` at base. Real keys: ssh-keygen and
|
|
7
|
+
* node:crypto. Against temp repos; nothing is pushed.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test, vi } from "vitest";
|
|
11
|
+
import { writeFileSync } from "node:fs";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { appendPendingGate, readGateLedger } from "../../lifecycle/gate-ledger";
|
|
14
|
+
import { resetGateOrigin } from "../../lifecycle/gate-origin";
|
|
15
|
+
import { gateSealPayload } from "../../lifecycle/gate-seal";
|
|
16
|
+
import { GATE_BINDING_MAX_BYTES, GATE_STATEMENT_SCHEMA_ID, gateBindingProblem, type GateStatement } from "../../lifecycle/gate-statement";
|
|
17
|
+
import { assert, passkey, type Passkey } from "../../lifecycle/test-passkey";
|
|
18
|
+
import { gateAdmission } from "../../workspace/identity";
|
|
19
|
+
import { checkGateSeal } from "../../workspace/trust/seal";
|
|
20
|
+
import { readTrustPolicy } from "../../workspace/trust/policy";
|
|
21
|
+
import { gitRevisionSource } from "../../workspace/record-source";
|
|
22
|
+
import { hasSshKeygen, TestRepo, type Key } from "../../workspace/trust/test-repo";
|
|
23
|
+
import { contract, validSchema } from "../../workspace/__fixtures__/contract-repo";
|
|
24
|
+
import { gateApprovalStatement, recordGateApproval, runApprove } from "./approve";
|
|
25
|
+
import { parseArgs } from "../main";
|
|
26
|
+
import type { ParsedArgs } from "../registry";
|
|
27
|
+
import schema from "../../gate-statement.schema.json";
|
|
28
|
+
|
|
29
|
+
vi.mock("../../op/discover", () => ({ discoverOps: async () => ({ errors: [], ops: new Map() }) }));
|
|
30
|
+
|
|
31
|
+
const PLAN = `sha256:${"a".repeat(64)}`;
|
|
32
|
+
const OTHER = `sha256:${"b".repeat(64)}`;
|
|
33
|
+
const PENDING_AT = "2026-01-01T09:00:00.000Z";
|
|
34
|
+
|
|
35
|
+
const repos: TestRepo[] = [];
|
|
36
|
+
const home = process.cwd();
|
|
37
|
+
afterEach(() => {
|
|
38
|
+
process.chdir(home);
|
|
39
|
+
resetGateOrigin();
|
|
40
|
+
while (repos.length) repos.pop()!.cleanup();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
let keys: TestRepo;
|
|
44
|
+
let alice: Key;
|
|
45
|
+
let mallory: Key;
|
|
46
|
+
let erin: Passkey;
|
|
47
|
+
let frank: Passkey;
|
|
48
|
+
beforeAll(() => {
|
|
49
|
+
erin = passkey("github:erin", "cred-erin", "EdDSA");
|
|
50
|
+
frank = passkey("github:frank", "cred-frank", "ES256");
|
|
51
|
+
if (!hasSshKeygen) return;
|
|
52
|
+
keys = new TestRepo("4646-keys");
|
|
53
|
+
alice = keys.key("alice");
|
|
54
|
+
mallory = keys.key("mallory");
|
|
55
|
+
});
|
|
56
|
+
afterAll(() => keys?.cleanup());
|
|
57
|
+
|
|
58
|
+
/** A workspace whose gate `ship` counts only signed approvals, with alice's ssh key and two passkeys at base, waiting at the gate for PLAN. */
|
|
59
|
+
async function waiting(): Promise<TestRepo> {
|
|
60
|
+
const r = new TestRepo("4646");
|
|
61
|
+
repos.push(r);
|
|
62
|
+
r.git(["config", "user.email", "t@example.test"]);
|
|
63
|
+
r.git(["config", "user.name", "t"]);
|
|
64
|
+
r.git(["config", "commit.gpgsign", "false"]);
|
|
65
|
+
r.write("chant.workspace.json", JSON.stringify({ name: "acme", schema: 1, members: [], identity: { gates: { ship: {} } } }));
|
|
66
|
+
r.write(".chant/allowed_signers", `github:alice ${alice.pub}\n`);
|
|
67
|
+
r.write(".chant/trust.json", JSON.stringify({ schema: 1, passkeys: [erin.signer, frank.signer] }));
|
|
68
|
+
r.commit("base");
|
|
69
|
+
await appendPendingGate(
|
|
70
|
+
{ op: "deploy", gate: "ship", timestamp: PENDING_AT, origin: "cli", expiresAt: "2999-01-01T00:00:00.000Z", planDigest: PLAN, environment: "prod" },
|
|
71
|
+
{ cwd: r.dir },
|
|
72
|
+
);
|
|
73
|
+
process.chdir(r.dir);
|
|
74
|
+
return r;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function statementFor(r: TestRepo, actor: string, extra: { plan?: string; binding?: string } = {}): Promise<GateStatement> {
|
|
78
|
+
const s = await gateApprovalStatement("deploy", "ship", { origin: "cli", actor, cwd: r.dir, ...extra });
|
|
79
|
+
expect(s).not.toBeNull();
|
|
80
|
+
return s!;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function file(r: TestRepo, name: string, text: string): string {
|
|
84
|
+
const f = join(r.dir, "..", `${name}-${Math.random().toString(36).slice(2)}`);
|
|
85
|
+
writeFileSync(f, text);
|
|
86
|
+
return f;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const { expectValid } = contract(schema);
|
|
90
|
+
|
|
91
|
+
describe.skipIf(!hasSshKeygen)("an approval signed outside chant (#4646)", () => {
|
|
92
|
+
test("--statement prints the bytes --sign would sign, and records nothing", async () => {
|
|
93
|
+
expect(validSchema(schema)).toBe(true);
|
|
94
|
+
expect(schema.$id).toBe(GATE_STATEMENT_SCHEMA_ID);
|
|
95
|
+
const r = await waiting();
|
|
96
|
+
const s = await statementFor(r, "github:erin");
|
|
97
|
+
expectValid(s);
|
|
98
|
+
const bytes = gateSealPayload({ op: "deploy", gate: "ship", environment: "prod", planDigest: PLAN, resolvedBy: "github:erin", timestamp: s.timestamp });
|
|
99
|
+
expect(Buffer.from(s.statement, "base64")).toEqual(bytes);
|
|
100
|
+
expect(s.text).toBe(`deploy\nship\nprod\n${PLAN}\ngithub:erin\n${s.timestamp}`);
|
|
101
|
+
expect(s).toMatchObject({ planDigest: PLAN, environment: "prod", relayedBy: null, binding: null, sealVersion: 1, namespace: "chant-gate" });
|
|
102
|
+
expect((await readGateLedger("deploy", { cwd: r.dir })).resolutions).toEqual([]);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test("an ssh signature made on another machine by a wrong key, over another plan or at another time is refused", async () => {
|
|
106
|
+
const r = await waiting();
|
|
107
|
+
const s = await statementFor(r, "github:alice");
|
|
108
|
+
const signed = keys.sshSign(alice, Buffer.from(s.statement, "base64"), s.namespace);
|
|
109
|
+
|
|
110
|
+
// mallory's key, and alice's key over the statement for another plan.
|
|
111
|
+
const bad = keys.sshSign(mallory, Buffer.from(s.statement, "base64"), s.namespace);
|
|
112
|
+
expect((await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:alice", at: s.timestamp, signature: file(r, "bad", bad), cwd: r.dir })).ok).toBe(false);
|
|
113
|
+
const other = await statementFor(r, "github:alice", { plan: OTHER });
|
|
114
|
+
const elsewhere = keys.sshSign(alice, Buffer.from(other.statement, "base64"), s.namespace);
|
|
115
|
+
expect((await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:alice", at: other.timestamp, signature: file(r, "other", elsewhere), cwd: r.dir })).ok).toBe(false);
|
|
116
|
+
// The right signature at another time.
|
|
117
|
+
const later = new Date(Date.parse(s.timestamp) + 1).toISOString();
|
|
118
|
+
expect((await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:alice", at: later, signature: file(r, "late", signed), cwd: r.dir })).ok).toBe(false);
|
|
119
|
+
expect((await readGateLedger("deploy", { cwd: r.dir })).resolutions).toEqual([]);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test("an ssh signature made on another machine counts, and the record re-checks offline", async () => {
|
|
123
|
+
const r = await waiting();
|
|
124
|
+
const s = await statementFor(r, "github:alice");
|
|
125
|
+
const signed = keys.sshSign(alice, Buffer.from(s.statement, "base64"), s.namespace);
|
|
126
|
+
const out = await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:alice", at: s.timestamp, signature: file(r, "sig", signed), cwd: r.dir });
|
|
127
|
+
expect(out.ok).toBe(true);
|
|
128
|
+
if (!out.ok) return;
|
|
129
|
+
expect(out.record.timestamp).toBe(s.timestamp);
|
|
130
|
+
expect(out.record.seal).toMatchObject({ signer: "github:alice", signature: signed });
|
|
131
|
+
expect(out.record.seal?.key).toMatch(/^SHA256:/);
|
|
132
|
+
expect(out.record.seal?.kind).toBeUndefined();
|
|
133
|
+
expect(gateAdmission(r.dir, "ship")!.refuses(out.record)).toBeNull();
|
|
134
|
+
expect(checkGateSeal(readTrustPolicy(gitRevisionSource(r.dir, "HEAD"), null), out.record).attested).toBe(true);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test.each([["an Ed25519", () => erin], ["a P-256", () => frank]] as const)("%s passkey's assertion counts, and the record re-checks offline", async (_name, who) => {
|
|
138
|
+
const pk = who();
|
|
139
|
+
const r = await waiting();
|
|
140
|
+
const s = await statementFor(r, pk.signer.principal);
|
|
141
|
+
const a = assert(pk, Buffer.from(s.statement, "base64"));
|
|
142
|
+
const out = await recordGateApproval("deploy", "ship", { origin: "cli", actor: pk.signer.principal, at: s.timestamp, signature: file(r, "assertion", JSON.stringify(a)), cwd: r.dir });
|
|
143
|
+
expect(out.ok).toBe(true);
|
|
144
|
+
if (!out.ok) return;
|
|
145
|
+
expect(out.record.seal).toEqual({
|
|
146
|
+
kind: "webauthn",
|
|
147
|
+
signer: pk.signer.principal,
|
|
148
|
+
key: pk.signer.id,
|
|
149
|
+
signature: a.signature,
|
|
150
|
+
clientDataJSON: a.clientDataJSON,
|
|
151
|
+
authenticatorData: a.authenticatorData,
|
|
152
|
+
});
|
|
153
|
+
// Read back off the ledger and judged again, as a run and verify judge it.
|
|
154
|
+
const [line] = (await readGateLedger("deploy", { cwd: r.dir })).resolutions;
|
|
155
|
+
expect(gateAdmission(r.dir, "ship")!.refuses(line!)).toBeNull();
|
|
156
|
+
const policy = readTrustPolicy(gitRevisionSource(r.dir, "HEAD"), null);
|
|
157
|
+
expect(checkGateSeal(policy, line!)).toMatchObject({ attested: true, key: pk.signer.id });
|
|
158
|
+
// Moving the approval to another plan breaks it.
|
|
159
|
+
expect(checkGateSeal(policy, { ...line!, planDigest: OTHER }).attested).toBe(false);
|
|
160
|
+
expect(gateAdmission(r.dir, "ship")!.refuses({ ...line!, planDigest: OTHER })).toMatch(/challenge/);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("a passkey's assertion is refused for another approver, another plan, or without user verification", async () => {
|
|
164
|
+
const r = await waiting();
|
|
165
|
+
const s = await statementFor(r, "github:erin");
|
|
166
|
+
const bytes = Buffer.from(s.statement, "base64");
|
|
167
|
+
const refused = async (actor: string, assertion: object, at = s.timestamp) =>
|
|
168
|
+
!(await recordGateApproval("deploy", "ship", { origin: "cli", actor, at, signature: file(r, "a", JSON.stringify(assertion)), cwd: r.dir })).ok;
|
|
169
|
+
// frank's passkey over erin's statement, recorded as erin: the credential isn't erin's.
|
|
170
|
+
expect(await refused("github:erin", assert(frank, bytes))).toBe(true);
|
|
171
|
+
// erin's passkey recorded as frank: the statement names erin.
|
|
172
|
+
expect(await refused("github:frank", assert(erin, bytes))).toBe(true);
|
|
173
|
+
const other = await statementFor(r, "github:erin", { plan: OTHER });
|
|
174
|
+
expect(await refused("github:erin", assert(erin, Buffer.from(other.statement, "base64")))).toBe(true);
|
|
175
|
+
expect(await refused("github:erin", assert(erin, bytes, { flags: 0x01 }))).toBe(true);
|
|
176
|
+
expect(await refused("github:erin", assert(erin, bytes, { origin: "https://evil.example" }))).toBe(true);
|
|
177
|
+
expect((await readGateLedger("deploy", { cwd: r.dir })).resolutions).toEqual([]);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test("--at must be the statement's, in chant's form, not before the pending fact or in the future", async () => {
|
|
181
|
+
const r = await waiting();
|
|
182
|
+
const s = await statementFor(r, "github:erin");
|
|
183
|
+
const a = file(r, "a", JSON.stringify(assert(erin, Buffer.from(s.statement, "base64"))));
|
|
184
|
+
const tryAt = async (at: string | undefined) =>
|
|
185
|
+
(await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:erin", ...(at !== undefined ? { at } : {}), signature: a, cwd: r.dir })).ok;
|
|
186
|
+
expect(await tryAt(undefined)).toBe(false);
|
|
187
|
+
expect(await tryAt("2026-11-01T10:00:00Z")).toBe(false);
|
|
188
|
+
expect(await tryAt("2026-01-01T08:00:00.000Z")).toBe(false);
|
|
189
|
+
expect(await tryAt(new Date(Date.now() + 60 * 60 * 1000).toISOString())).toBe(false);
|
|
190
|
+
expect(await gateApprovalStatement("deploy", "ship", { origin: "cli", actor: "github:erin", at: "2026-01-01T08:00:00.000Z", cwd: r.dir })).toBeNull();
|
|
191
|
+
expect(await tryAt(s.timestamp)).toBe(true);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test("--at goes with --statement or --signature, and --signature not with --sign", async () => {
|
|
195
|
+
const r = await waiting();
|
|
196
|
+
const s = await statementFor(r, "github:erin");
|
|
197
|
+
const a = file(r, "a", JSON.stringify(assert(erin, Buffer.from(s.statement, "base64"))));
|
|
198
|
+
expect((await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:erin", at: s.timestamp, cwd: r.dir })).ok).toBe(false);
|
|
199
|
+
expect((await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:alice", at: s.timestamp, sign: alice.file, signature: a, cwd: r.dir })).ok).toBe(false);
|
|
200
|
+
expect((await readGateLedger("deploy", { cwd: r.dir })).resolutions).toEqual([]);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test("chant approve --statement prints the document, and --signature - reads stdin's path through the flags", async () => {
|
|
204
|
+
expect(parseArgs(["approve", "deploy", "ship", "--statement", "--actor", "github:erin"])).toMatchObject({ statement: true, actor: "github:erin" });
|
|
205
|
+
expect(parseArgs(["approve", "deploy", "ship", "--signature", "-", "--at", "2026-11-01T10:00:00.000Z"])).toMatchObject({ signature: "-", at: "2026-11-01T10:00:00.000Z" });
|
|
206
|
+
expect(() => parseArgs(["approve", "deploy", "ship", "--signature", "--at", "x"])).toThrow(/--signature needs a file/);
|
|
207
|
+
await waiting();
|
|
208
|
+
const printed: string[] = [];
|
|
209
|
+
const log = vi.spyOn(console, "log").mockImplementation((t: string) => void printed.push(t));
|
|
210
|
+
try {
|
|
211
|
+
const args = { command: "approve", path: "deploy", extraPositional: "ship", format: "", fix: false, watch: false, verbose: false, help: false, live: false, yes: true, statement: true, actor: "github:erin" } as ParsedArgs;
|
|
212
|
+
expect(await runApprove({ args, plugins: [], serializers: [] } as never)).toBe(0);
|
|
213
|
+
expect(await runApprove({ args: { ...args, signature: "x" }, plugins: [], serializers: [] } as never)).toBe(1);
|
|
214
|
+
} finally {
|
|
215
|
+
log.mockRestore();
|
|
216
|
+
}
|
|
217
|
+
const doc = JSON.parse(printed.join(""));
|
|
218
|
+
expectValid(doc);
|
|
219
|
+
expect(doc).toMatchObject({ schema: "chant-gate-statement/v1", resolvedBy: "github:erin", planDigest: PLAN });
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
test("an unsigned approval of the gate is still refused", async () => {
|
|
223
|
+
const r = await waiting();
|
|
224
|
+
expect((await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:erin", cwd: r.dir })).ok).toBe(false);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// #4697: the relay adds a line of its own that the person's signature covers.
|
|
229
|
+
const BINDING = "deploy dep_42 until 2026-11-01T12:00:00Z";
|
|
230
|
+
|
|
231
|
+
describe.skipIf(!hasSshKeygen)("a relay's binding line in the statement (#4697)", () => {
|
|
232
|
+
test("--binding ends the statement with a binding line, seal version 3", async () => {
|
|
233
|
+
const r = await waiting();
|
|
234
|
+
const s = await statementFor(r, "github:erin", { binding: BINDING });
|
|
235
|
+
expectValid(s);
|
|
236
|
+
expect(s.text).toBe(`deploy\nship\nprod\n${PLAN}\ngithub:erin\n${s.timestamp}\nbinding ${BINDING}`);
|
|
237
|
+
expect(s).toMatchObject({ binding: BINDING, sealVersion: 3 });
|
|
238
|
+
expect(Buffer.from(s.statement, "base64")).toEqual(
|
|
239
|
+
gateSealPayload({ op: "deploy", gate: "ship", environment: "prod", planDigest: PLAN, resolvedBy: "github:erin", timestamp: s.timestamp, binding: BINDING }),
|
|
240
|
+
);
|
|
241
|
+
expect((await readGateLedger("deploy", { cwd: r.dir })).resolutions).toEqual([]);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
test("a passkey's assertion over it records the binding, and the record re-checks offline", async () => {
|
|
245
|
+
const r = await waiting();
|
|
246
|
+
const s = await statementFor(r, "github:erin", { binding: BINDING });
|
|
247
|
+
const a = file(r, "a", JSON.stringify(assert(erin, Buffer.from(s.statement, "base64"))));
|
|
248
|
+
const out = await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:erin", at: s.timestamp, binding: BINDING, signature: a, cwd: r.dir });
|
|
249
|
+
expect(out.ok).toBe(true);
|
|
250
|
+
if (!out.ok) return;
|
|
251
|
+
expect(out.record.binding).toBe(BINDING);
|
|
252
|
+
expect(out.record.seal).toMatchObject({ kind: "webauthn", version: 3 });
|
|
253
|
+
const [line] = (await readGateLedger("deploy", { cwd: r.dir })).resolutions;
|
|
254
|
+
expect(line!.binding).toBe(BINDING);
|
|
255
|
+
expect(gateAdmission(r.dir, "ship")!.refuses(line!)).toBeNull();
|
|
256
|
+
const policy = readTrustPolicy(gitRevisionSource(r.dir, "HEAD"), null);
|
|
257
|
+
expect(checkGateSeal(policy, line!).attested).toBe(true);
|
|
258
|
+
// Another binding, or none, and the line no longer verifies.
|
|
259
|
+
for (const edited of [{ binding: "deploy dep_43 until 2026-11-01T12:00:00Z" }, { binding: undefined }]) {
|
|
260
|
+
expect(checkGateSeal(policy, { ...line!, ...edited }).attested).toBe(false);
|
|
261
|
+
expect(gateAdmission(r.dir, "ship")!.refuses({ ...line!, ...edited })).not.toBeNull();
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
test("an ssh signature over it records the binding, and --sign signs one the same way", async () => {
|
|
266
|
+
const r = await waiting();
|
|
267
|
+
const s = await statementFor(r, "github:alice", { binding: BINDING });
|
|
268
|
+
const signed = keys.sshSign(alice, Buffer.from(s.statement, "base64"), s.namespace);
|
|
269
|
+
const out = await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:alice", at: s.timestamp, binding: BINDING, signature: file(r, "sig", signed), cwd: r.dir });
|
|
270
|
+
expect(out.ok).toBe(true);
|
|
271
|
+
if (!out.ok) return;
|
|
272
|
+
expect(out.record).toMatchObject({ binding: BINDING, seal: { signer: "github:alice", signature: signed, version: 3 } });
|
|
273
|
+
expect(gateAdmission(r.dir, "ship")!.refuses(out.record)).toBeNull();
|
|
274
|
+
|
|
275
|
+
const here = await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:alice", binding: BINDING, sign: alice.file, cwd: r.dir });
|
|
276
|
+
expect(here.ok).toBe(true);
|
|
277
|
+
if (!here.ok) return;
|
|
278
|
+
expect(here.record.seal?.version).toBe(3);
|
|
279
|
+
expect(gateAdmission(r.dir, "ship")!.refuses(here.record)).toBeNull();
|
|
280
|
+
expect(checkGateSeal(readTrustPolicy(gitRevisionSource(r.dir, "HEAD"), null), here.record).attested).toBe(true);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
test("a signature recorded with another binding, or none, than it was made over is refused", async () => {
|
|
284
|
+
const r = await waiting();
|
|
285
|
+
const s = await statementFor(r, "github:erin", { binding: BINDING });
|
|
286
|
+
const a = file(r, "a", JSON.stringify(assert(erin, Buffer.from(s.statement, "base64"))));
|
|
287
|
+
const record = (binding?: string) =>
|
|
288
|
+
recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:erin", at: s.timestamp, ...(binding !== undefined ? { binding } : {}), signature: a, cwd: r.dir });
|
|
289
|
+
expect((await record()).ok).toBe(false);
|
|
290
|
+
expect((await record("deploy dep_43 until 2026-11-01T12:00:00Z")).ok).toBe(false);
|
|
291
|
+
// A signature over a statement with no binding can't be recorded with one.
|
|
292
|
+
const plain = await statementFor(r, "github:erin");
|
|
293
|
+
const b = file(r, "b", JSON.stringify(assert(erin, Buffer.from(plain.statement, "base64"))));
|
|
294
|
+
expect((await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:erin", at: plain.timestamp, binding: BINDING, signature: b, cwd: r.dir })).ok).toBe(false);
|
|
295
|
+
expect((await readGateLedger("deploy", { cwd: r.dir })).resolutions).toEqual([]);
|
|
296
|
+
// An approval without a binding records as before: no binding, seal version 1.
|
|
297
|
+
const out = await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:erin", at: plain.timestamp, signature: b, cwd: r.dir });
|
|
298
|
+
expect(out.ok && out.record.binding === undefined && out.record.seal?.version === undefined).toBe(true);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
test("a binding must be one printable line within the limit, and goes with a signature", async () => {
|
|
302
|
+
for (const bad of ["", "two\nlines", "cr\r", "tab\there", "nul\u0000", "bidi \u202e", "sep\u2028", " leading", "trailing ", "x".repeat(GATE_BINDING_MAX_BYTES + 1), "é".repeat(GATE_BINDING_MAX_BYTES / 2 + 1)]) {
|
|
303
|
+
expect(gateBindingProblem(bad), JSON.stringify(bad)).not.toBeNull();
|
|
304
|
+
}
|
|
305
|
+
for (const good of [BINDING, "x".repeat(GATE_BINDING_MAX_BYTES), "déploiement 42 jusqu'à midi", "{\"deploy\":\"dep_42\",\"exp\":1793534400}"]) {
|
|
306
|
+
expect(gateBindingProblem(good), good).toBeNull();
|
|
307
|
+
}
|
|
308
|
+
const r = await waiting();
|
|
309
|
+
expect(await gateApprovalStatement("deploy", "ship", { origin: "cli", actor: "github:erin", binding: "two\nlines", cwd: r.dir })).toBeNull();
|
|
310
|
+
// An unsigned approval has nothing to bind it.
|
|
311
|
+
expect((await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:erin", binding: BINDING, cwd: r.dir })).ok).toBe(false);
|
|
312
|
+
expect(parseArgs(["approve", "deploy", "ship", "--statement", "--binding", BINDING])).toMatchObject({ statement: true, binding: BINDING });
|
|
313
|
+
expect(() => parseArgs(["approve", "deploy", "ship", "--statement", "--binding", "--at", "x"])).toThrow(/--binding needs/);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
test("a ledger line whose binding isn't one line of text is malformed", async () => {
|
|
317
|
+
const r = await waiting();
|
|
318
|
+
const s = await statementFor(r, "github:erin", { binding: BINDING });
|
|
319
|
+
const a = file(r, "a", JSON.stringify(assert(erin, Buffer.from(s.statement, "base64"))));
|
|
320
|
+
expect((await recordGateApproval("deploy", "ship", { origin: "cli", actor: "github:erin", at: s.timestamp, binding: BINDING, signature: a, cwd: r.dir })).ok).toBe(true);
|
|
321
|
+
const { appendGateResolution } = await import("../../lifecycle/gate-ledger");
|
|
322
|
+
await appendGateResolution({ op: "deploy", gate: "ship", resolvedBy: "github:erin", timestamp: new Date().toISOString(), binding: "a\nb" }, { cwd: r.dir });
|
|
323
|
+
await appendGateResolution({ op: "deploy", gate: "ship", resolvedBy: "github:erin", timestamp: new Date().toISOString(), binding: 7 as unknown as string }, { cwd: r.dir });
|
|
324
|
+
const ledger = await readGateLedger("deploy", { cwd: r.dir });
|
|
325
|
+
expect(ledger.resolutions.map((l) => l.binding)).toEqual([BINDING]);
|
|
326
|
+
expect(ledger.malformed).toBe(2);
|
|
327
|
+
});
|
|
328
|
+
});
|