@intentius/chant 0.124.61 → 0.124.63
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 +18 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +142 -16
- 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/release.d.ts +6 -4
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +13 -7
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +34 -5
- 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 +31 -0
- package/dist/cli/registry.d.ts +13 -1
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/config.d.ts +32 -0
- package/dist/config.d.ts.map +1 -1
- 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 +44 -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 +17 -3
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-seal.d.ts +39 -3
- package/dist/lifecycle/gate-seal.d.ts.map +1 -1
- package/dist/lifecycle/gate-seal.js +50 -10
- package/dist/lifecycle/gate-statement.d.ts +70 -0
- package/dist/lifecycle/gate-statement.d.ts.map +1 -0
- package/dist/lifecycle/gate-statement.js +74 -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 +121 -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 +87 -0
- package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
- package/dist/lifecycle/publish-declaration.js +87 -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 +14 -4
- 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 +66 -0
- package/dist/lifecycle/publish-homebrew.d.ts.map +1 -0
- package/dist/lifecycle/publish-homebrew.js +173 -0
- package/dist/lifecycle/publish-marketplace.d.ts +51 -0
- package/dist/lifecycle/publish-marketplace.d.ts.map +1 -0
- package/dist/lifecycle/publish-marketplace.js +254 -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 +182 -0
- package/dist/lifecycle/release-publish.d.ts +5 -2
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- 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/activities/activity-contracts.d.ts +4 -4
- package/dist/pr-forge.d.ts +20 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +61 -2
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/wave-runtime.mjs +331 -330
- 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-workflow.d.ts +2 -0
- package/dist/workspace/ci-green-workflow.d.ts.map +1 -1
- package/dist/workspace/ci-green-workflow.js +9 -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 +127 -9
- 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 +205 -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 +171 -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 +3 -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 +33 -6
- package/dist/workspace/release-candidates.d.ts.map +1 -1
- package/dist/workspace/release-candidates.js +49 -20
- package/dist/workspace/release-candidates.schema.json +48 -2
- 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 +226 -0
- package/src/cli/handlers/approve.ts +174 -16
- package/src/cli/handlers/plan.ts +74 -0
- package/src/cli/handlers/release.ts +12 -7
- package/src/cli/main.ts +34 -5
- package/src/cli/mcp/workspace-tools.ts +2 -1
- package/src/cli/parse-args.ts +24 -0
- package/src/cli/registry.ts +13 -1
- package/src/gate-decision-bundle.test.ts +4 -2
- package/src/gate-decision.ts +11 -2
- package/src/gate-statement.schema.json +44 -0
- package/src/lifecycle/__fixtures__/publish-fakes.ts +125 -5
- package/src/lifecycle/gate-ledger.ts +17 -3
- package/src/lifecycle/gate-seal.ts +62 -9
- package/src/lifecycle/gate-statement.ts +107 -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 +150 -0
- package/src/lifecycle/plan-stale.ts +173 -0
- package/src/lifecycle/publish-credentials.ts +2 -0
- package/src/lifecycle/publish-declaration.ts +93 -1
- package/src/lifecycle/publish-forge.ts +15 -4
- package/src/lifecycle/publish-github.ts +174 -0
- package/src/lifecycle/publish-homebrew.test.ts +179 -0
- package/src/lifecycle/publish-homebrew.ts +187 -0
- package/src/lifecycle/publish-marketplace.test.ts +254 -0
- package/src/lifecycle/publish-marketplace.ts +259 -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 +199 -0
- package/src/lifecycle/release-publish.ts +5 -3
- 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/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 +68 -5
- 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-workflow.test.ts +9 -0
- package/src/workspace/ci-green-workflow.ts +9 -0
- package/src/workspace/ci-green.ts +141 -10
- package/src/workspace/ci-quarantine-report.test.ts +146 -0
- package/src/workspace/ci-quarantine-report.ts +235 -0
- package/src/workspace/ci-quarantine.test.ts +161 -0
- package/src/workspace/ci-quarantine.ts +189 -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 +10 -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 +48 -2
- package/src/workspace/release-candidates.test.ts +77 -4
- package/src/workspace/release-candidates.ts +62 -20
- 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
|
@@ -25,6 +25,7 @@ import { posix } from "node:path";
|
|
|
25
25
|
import { z } from "zod";
|
|
26
26
|
import type { RecordSource } from "../record-source";
|
|
27
27
|
import { DEFAULT_SIGNERS_PATH, TRUST_CONFIG_PATH, parseAllowedSigners, type ExcludedSigner, type Signer } from "./trust-files";
|
|
28
|
+
import type { PasskeySigner } from "../../lifecycle/gate-webauthn";
|
|
28
29
|
|
|
29
30
|
export {
|
|
30
31
|
DEFAULT_SIGNERS_PATH,
|
|
@@ -80,6 +81,25 @@ export const trustConfigSchema = z
|
|
|
80
81
|
.strict(),
|
|
81
82
|
)
|
|
82
83
|
.optional(),
|
|
84
|
+
/**
|
|
85
|
+
* Passkeys that sign gate approvals for people (#4646): a WebAuthn
|
|
86
|
+
* credential's id, its public key as base64url DER SubjectPublicKeyInfo,
|
|
87
|
+
* the relying party id and the origins an assertion may come from. A
|
|
88
|
+
* passkey signs only a gate approval (`chant approve --signature`).
|
|
89
|
+
*/
|
|
90
|
+
passkeys: z
|
|
91
|
+
.array(
|
|
92
|
+
z
|
|
93
|
+
.object({
|
|
94
|
+
principal: z.string().min(1),
|
|
95
|
+
id: z.string().regex(/^[A-Za-z0-9_-]+$/, "a credential id, base64url with no padding"),
|
|
96
|
+
publicKey: z.string().regex(/^[A-Za-z0-9_-]+$/, "a DER SubjectPublicKeyInfo, base64url with no padding"),
|
|
97
|
+
rpId: z.string().min(1),
|
|
98
|
+
origins: z.array(z.string().min(1)).min(1),
|
|
99
|
+
})
|
|
100
|
+
.strict(),
|
|
101
|
+
)
|
|
102
|
+
.optional(),
|
|
83
103
|
/**
|
|
84
104
|
* Signers admitted for the work one return brought back (#2552, D10,
|
|
85
105
|
* ws-004). Each entry names the return by its id (the file
|
|
@@ -139,6 +159,8 @@ export interface TrustPolicy {
|
|
|
139
159
|
runners: RunnerKey[];
|
|
140
160
|
/** Runner entries that are not used, and why. */
|
|
141
161
|
excludedRunners: Array<{ principal: string; reason: string }>;
|
|
162
|
+
/** Passkeys that sign people's gate approvals (#4646). Absent on a policy built by hand: none. */
|
|
163
|
+
passkeys?: PasskeySigner[];
|
|
142
164
|
/** Signers admitted per return (#2552), keyed by return id. They verify that return's commits and seals only. */
|
|
143
165
|
admitted: Record<string, Signer[]>;
|
|
144
166
|
/**
|
|
@@ -172,7 +194,7 @@ export function policyWriters(policy: TrustPolicy): Set<string> {
|
|
|
172
194
|
|
|
173
195
|
/** A policy with nothing in it: attestation off. */
|
|
174
196
|
export function emptyPolicy(base: string | null, problems: string[] = []): TrustPolicy {
|
|
175
|
-
return { base, signersPath: DEFAULT_SIGNERS_PATH, active: false, signers: [], excluded: [], roles: {}, adopted: [], runners: [], excludedRunners: [], admitted: {}, problems };
|
|
197
|
+
return { base, signersPath: DEFAULT_SIGNERS_PATH, active: false, signers: [], excluded: [], roles: {}, adopted: [], runners: [], excludedRunners: [], passkeys: [], admitted: {}, problems };
|
|
176
198
|
}
|
|
177
199
|
|
|
178
200
|
/**
|
|
@@ -226,6 +248,7 @@ export function readTrustPolicy(source: RecordSource, base: string | null): Trus
|
|
|
226
248
|
adopted: config.adopted ?? [],
|
|
227
249
|
runners,
|
|
228
250
|
excludedRunners,
|
|
251
|
+
passkeys: config.passkeys ?? [],
|
|
229
252
|
admitted: admittedOf(config),
|
|
230
253
|
problems: [],
|
|
231
254
|
};
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { execFileSync } from "node:child_process";
|
|
14
14
|
import { AGENT_RUNS_DIR, LEDGER_BRANCH, foldRun, parseRunFile, readRunFiles, type RunView } from "../runs";
|
|
15
15
|
import { RUN_TRAILER } from "../trailers";
|
|
16
|
+
import { lifecycleRemoteOverride } from "../../lifecycle/ledger-remote";
|
|
16
17
|
import type { RunnerKey } from "./policy";
|
|
17
18
|
import { attestRun } from "./run-statement";
|
|
18
19
|
|
|
@@ -26,7 +27,7 @@ function git(repo: string, args: string[]): string | undefined {
|
|
|
26
27
|
|
|
27
28
|
/** Every run on the ledger, in every member's `_agent-runs`, and the ref and tip read. */
|
|
28
29
|
export function readLedgerRuns(repo: string): { ref: string | null; tip: string | null; runs: RunView[] } {
|
|
29
|
-
for (const ref of [`refs/heads/${LEDGER_BRANCH}`, `refs/remotes
|
|
30
|
+
for (const ref of [`refs/heads/${LEDGER_BRANCH}`, `refs/remotes/${lifecycleRemoteOverride() ?? "origin"}/${LEDGER_BRANCH}`]) {
|
|
30
31
|
const tip = git(repo, ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`])?.trim();
|
|
31
32
|
if (!tip) continue;
|
|
32
33
|
const dirs = new Set<string>();
|
|
@@ -30,7 +30,7 @@ import type { SealCode } from "../records";
|
|
|
30
30
|
import { type TrustPolicy } from "./policy";
|
|
31
31
|
import type { Signer } from "./trust-files";
|
|
32
32
|
import { sshKeygen, verifySshSignature } from "./ssh-commit";
|
|
33
|
-
import { GATE_SEAL_NAMESPACE, gateSealPayload,
|
|
33
|
+
import { checkGateSignature, GATE_SEAL_NAMESPACE, gateSealPayload, sshSignatureKey, verifySshSignatureWith, WEBAUTHN_SEAL_KIND, type SealedGateApproval } from "../../lifecycle/gate-seal";
|
|
34
34
|
import { RELEASE_SEAL_NAMESPACE, releaseSealPayload } from "../identity-gate-rule";
|
|
35
35
|
|
|
36
36
|
export { GATE_SEAL_NAMESPACE, gateSealPayload, gateSealVersion, sealedFieldsOf, type SealedGateApproval } from "../../lifecycle/gate-seal";
|
|
@@ -166,6 +166,8 @@ export function checkRecordSeal(policy: TrustPolicy, r: SealedRecord): SealCheck
|
|
|
166
166
|
* when the signers file at base lists a key for the approver.
|
|
167
167
|
*/
|
|
168
168
|
export function checkGateSeal(policy: TrustPolicy, a: SealedGateApproval): SealCheck {
|
|
169
|
+
// #4646: a seal of kind webauthn is a passkey's assertion, listed in .chant/trust.json, not the signers file.
|
|
170
|
+
if (isWebAuthnSeal(a.seal)) return checkWebAuthnGateSeal(policy, a);
|
|
169
171
|
return checkSeal(policy, {
|
|
170
172
|
principal: a.resolvedBy,
|
|
171
173
|
what: `the approval of gate ${a.gate} by ${a.resolvedBy}`,
|
|
@@ -219,11 +221,41 @@ function checkSeal(policy: TrustPolicy, s: SealSubject): SealCheck {
|
|
|
219
221
|
|
|
220
222
|
/** A gate seal checked with node:crypto (#3785) against the keys `listed` for the approver in the gate namespace. */
|
|
221
223
|
function verifyGate(listed: Signer[], payload: Buffer, signature: string): { ok: true; principal: string; key: string; missing?: undefined } | { ok: false; missing?: false; reason: string } {
|
|
222
|
-
const
|
|
223
|
-
const r = verifySshSignatureWith(signature, payload, GATE_SEAL_NAMESPACE, keys);
|
|
224
|
+
const r = checkGateSignature({ signers: listed }, listed[0]!.principal, { signature }, payload);
|
|
224
225
|
return r.ok ? { ok: true, principal: listed[0]!.principal, key: r.key } : { ok: false, reason: r.reason };
|
|
225
226
|
}
|
|
226
227
|
|
|
228
|
+
const isWebAuthnSeal = (seal: unknown): boolean =>
|
|
229
|
+
typeof seal === "object" && seal !== null && !Array.isArray(seal) && (seal as { kind?: unknown }).kind === WEBAUTHN_SEAL_KIND;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* A passkey's seal on a gate approval (#4646), checked against the passkeys
|
|
233
|
+
* `.chant/trust.json` lists at base for the approver. As with an ssh seal,
|
|
234
|
+
* attestation is on only when the signers file exists at base; with none, a
|
|
235
|
+
* seal that verifies against a listed passkey is intact and unattested.
|
|
236
|
+
*/
|
|
237
|
+
function checkWebAuthnGateSeal(policy: TrustPolicy, a: SealedGateApproval): SealCheck {
|
|
238
|
+
const what = `the approval of gate ${a.gate} by ${a.resolvedBy}`;
|
|
239
|
+
const seal = a.seal as Partial<Record<string, unknown>>;
|
|
240
|
+
if (typeof seal.signer !== "string" || typeof seal.signature !== "string") {
|
|
241
|
+
return { attested: false, code: "seal-signature-invalid", message: `the seal on ${what} is malformed: it needs signer and signature` };
|
|
242
|
+
}
|
|
243
|
+
if (normalise(seal.signer) !== normalise(a.resolvedBy)) {
|
|
244
|
+
return { attested: false, code: "seal-signature-invalid", message: `the seal on ${what} is by ${seal.signer}, and its approver is ${a.resolvedBy || "empty"}` };
|
|
245
|
+
}
|
|
246
|
+
const r = checkGateSignature(policy, a.resolvedBy, seal as { signature: string }, gateSealPayload(a));
|
|
247
|
+
if (r.ok && !policy.active) {
|
|
248
|
+
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 };
|
|
249
|
+
}
|
|
250
|
+
if (r.ok) return { attested: true, message: `sealed by ${a.resolvedBy} with passkey ${r.key}, which .chant/trust.json at base lists`, key: r.key };
|
|
251
|
+
if (r.unlisted) {
|
|
252
|
+
return policy.active
|
|
253
|
+
? { attested: false, code: "seal-signer-unlisted", message: `${a.resolvedBy} has no passkey in .chant/trust.json at base, so the seal can't count` }
|
|
254
|
+
: { 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` };
|
|
255
|
+
}
|
|
256
|
+
return { attested: false, code: "seal-signature-invalid", message: `the seal does not verify for ${a.resolvedBy} against .chant/trust.json at base: ${r.reason}` };
|
|
257
|
+
}
|
|
258
|
+
|
|
227
259
|
/** A seal checked with no signers file: is the signature over these bytes intact? */
|
|
228
260
|
function checkIntegrity(principal: string, payload: Buffer, signature: string, namespace: string): SealCheck {
|
|
229
261
|
if (namespace === GATE_SEAL_NAMESPACE) {
|
|
@@ -20,7 +20,12 @@ const cases: Array<[string, unknown]> = [
|
|
|
20
20
|
adopted: [{ to: commit }, { from: commit, to: "b".repeat(64), note: "import" }],
|
|
21
21
|
runners: [{ principal: "ci", class: "runner", key: ed }],
|
|
22
22
|
admitted: [{ return: "ret-0123456789ab", signers: [{ principal: "dana", key: "ssh-rsa AAAAB3Nza==" }], note: "n" }],
|
|
23
|
+
passkeys: [{ principal: "github:erin", id: "cred-1_x", publicKey: "MCowBQYDK2VwAyEA", rpId: "example.com", origins: ["https://example.com"] }],
|
|
23
24
|
}],
|
|
25
|
+
["a passkey with no origins", { schema: 1, passkeys: [{ principal: "e", id: "c", publicKey: "k", rpId: "example.com", origins: [] }] }],
|
|
26
|
+
["a passkey whose key is padded base64", { schema: 1, passkeys: [{ principal: "e", id: "c", publicKey: "k+/=", rpId: "example.com", origins: ["https://example.com"] }] }],
|
|
27
|
+
["a passkey with an extra key", { schema: 1, passkeys: [{ principal: "e", id: "c", publicKey: "k", rpId: "example.com", origins: ["https://example.com"], alg: -8 }] }],
|
|
28
|
+
["a passkey with no rpId", { schema: 1, passkeys: [{ principal: "e", id: "c", publicKey: "k", origins: ["https://example.com"] }] }],
|
|
24
29
|
["schema 2", { schema: 2 }],
|
|
25
30
|
["no schema", {}],
|
|
26
31
|
["not an object", [1]],
|
|
@@ -202,7 +202,7 @@ export function trustConfigProblems(raw: unknown): string[] {
|
|
|
202
202
|
const check = (field: string, ok: boolean, message: string) => {
|
|
203
203
|
if (!ok) problems.push(`${field}: ${message}`);
|
|
204
204
|
};
|
|
205
|
-
check("/", only(raw, ["schema", "signers", "roles", "adopted", "runners", "admitted"]), "unknown key");
|
|
205
|
+
check("/", only(raw, ["schema", "signers", "roles", "adopted", "runners", "passkeys", "admitted"]), "unknown key");
|
|
206
206
|
check("schema", raw.schema === 1, "expected 1");
|
|
207
207
|
check("signers", optional(raw.signers, isRepoPath), "a path inside the repository, with / separators and no ..");
|
|
208
208
|
check(
|
|
@@ -226,6 +226,20 @@ export function trustConfigProblems(raw: unknown): string[] {
|
|
|
226
226
|
),
|
|
227
227
|
"runner keys: a principal, a class and an ssh-ed25519 key",
|
|
228
228
|
);
|
|
229
|
+
const b64url = (v: unknown): boolean => typeof v === "string" && /^[A-Za-z0-9_-]+$/.test(v);
|
|
230
|
+
check(
|
|
231
|
+
"passkeys",
|
|
232
|
+
optional(raw.passkeys, (a) =>
|
|
233
|
+
Array.isArray(a) &&
|
|
234
|
+
a.every(
|
|
235
|
+
(e) =>
|
|
236
|
+
isObject(e) && only(e, ["principal", "id", "publicKey", "rpId", "origins"]) &&
|
|
237
|
+
nonEmpty(e.principal) && b64url(e.id) && b64url(e.publicKey) && nonEmpty(e.rpId) &&
|
|
238
|
+
Array.isArray(e.origins) && e.origins.length > 0 && e.origins.every(nonEmpty),
|
|
239
|
+
),
|
|
240
|
+
),
|
|
241
|
+
"passkeys: a principal, a credential id, a public key, an rpId and origins",
|
|
242
|
+
);
|
|
229
243
|
check(
|
|
230
244
|
"admitted",
|
|
231
245
|
optional(raw.admitted, (a) =>
|