@intentius/chant 0.124.85 → 0.124.87
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/bundle-check.d.ts +102 -0
- package/dist/bundle-check.d.ts.map +1 -0
- package/dist/bundle-check.js +310 -0
- package/dist/chant-install.d.ts +100 -0
- package/dist/chant-install.d.ts.map +1 -0
- package/dist/chant-install.js +158 -0
- package/dist/ci-commit.d.ts +19 -6
- package/dist/ci-commit.d.ts.map +1 -1
- package/dist/ci-commit.js +23 -4
- package/dist/ci-evidence-jobs.d.ts +78 -0
- package/dist/ci-evidence-jobs.d.ts.map +1 -0
- package/dist/ci-evidence-jobs.js +85 -0
- package/dist/ci-image.d.ts +274 -0
- package/dist/ci-image.d.ts.map +1 -0
- package/dist/ci-image.js +635 -0
- package/dist/ci-login.d.ts +150 -0
- package/dist/ci-login.d.ts.map +1 -0
- package/dist/ci-login.js +240 -0
- package/dist/ci-product.d.ts +16 -0
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +17 -0
- package/dist/cli/commands/import-index.js +2 -2
- package/dist/cli/handlers/build.d.ts +8 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +22 -4
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +61 -2
- package/dist/cli/handlers/ci-evidence.d.ts +3 -0
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -0
- package/dist/cli/handlers/ci-evidence.js +174 -0
- package/dist/cli/handlers/components.js +3 -3
- package/dist/cli/handlers/dead-guards.d.ts +3 -0
- package/dist/cli/handlers/dead-guards.d.ts.map +1 -0
- package/dist/cli/handlers/dead-guards.js +35 -0
- package/dist/cli/handlers/graph.js +4 -4
- package/dist/cli/handlers/lifecycle.d.ts +2 -1
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +5 -4
- package/dist/cli/handlers/local-chant.d.ts +16 -0
- package/dist/cli/handlers/local-chant.d.ts.map +1 -0
- package/dist/cli/handlers/local-chant.js +109 -0
- package/dist/cli/handlers/operator.js +2 -2
- package/dist/cli/handlers/search.js +5 -5
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +38 -0
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +28 -0
- package/dist/cli/registry.d.ts +16 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/check-hooks.d.ts +49 -0
- package/dist/components/check-hooks.d.ts.map +1 -1
- package/dist/components/check-hooks.js +64 -4
- package/dist/components/check-steps.d.ts +17 -0
- package/dist/components/check-steps.d.ts.map +1 -1
- package/dist/components/check-steps.js +37 -5
- package/dist/components/product-pipeline.d.ts +23 -0
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +6 -2
- package/dist/components/product-plan.d.ts +143 -0
- package/dist/components/product-plan.d.ts.map +1 -0
- package/dist/components/product-plan.js +145 -0
- package/dist/components/release-compile.d.ts.map +1 -1
- package/dist/components/release-compile.js +2 -2
- package/dist/config.d.ts +39 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +35 -3
- package/dist/dead-guards.d.ts +82 -0
- package/dist/dead-guards.d.ts.map +1 -0
- package/dist/dead-guards.js +436 -0
- package/dist/discovery/files.d.ts +3 -1
- package/dist/discovery/files.d.ts.map +1 -1
- package/dist/discovery/files.js +5 -3
- package/dist/drift-issue.d.ts +152 -0
- package/dist/drift-issue.d.ts.map +1 -0
- package/dist/drift-issue.js +167 -0
- package/dist/floor-table.d.ts +30 -0
- package/dist/floor-table.d.ts.map +1 -0
- package/dist/floor-table.data.d.ts +3 -0
- package/dist/floor-table.data.d.ts.map +1 -0
- package/dist/floor-table.data.js +179 -0
- package/dist/floor-table.js +56 -0
- package/dist/forge-flags.d.ts +90 -0
- package/dist/forge-flags.d.ts.map +1 -0
- package/dist/forge-flags.js +184 -0
- package/dist/lexicon.d.ts +69 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gated-op.d.ts +7 -1
- package/dist/lifecycle/gated-op.d.ts.map +1 -1
- package/dist/lifecycle/gated-op.js +7 -4
- package/dist/local-chant.d.ts +98 -0
- package/dist/local-chant.d.ts.map +1 -0
- package/dist/local-chant.js +307 -0
- package/dist/op/activities/predict-behaviour.js +2 -2
- package/dist/op/op-waves-evidence-spec.d.ts +13 -0
- package/dist/op/op-waves-evidence-spec.d.ts.map +1 -0
- package/dist/op/op-waves-evidence-spec.js +21 -0
- package/dist/op/op-waves-evidence.d.ts +40 -0
- package/dist/op/op-waves-evidence.d.ts.map +1 -0
- package/dist/op/op-waves-evidence.js +58 -0
- package/dist/op/op-waves-run.d.ts +4 -0
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +24 -1
- package/dist/op/op-waves.d.ts +17 -1
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +23 -0
- package/dist/op/schedule-overdue.d.ts +41 -9
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +154 -25
- package/dist/plan-summary.d.ts +25 -0
- package/dist/plan-summary.d.ts.map +1 -1
- package/dist/plan-summary.js +31 -0
- package/dist/pr-plan-note.d.ts +35 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +10 -0
- package/dist/pr-post.d.ts +23 -0
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +125 -3
- package/dist/release-floors.d.ts +33 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +33 -1
- package/dist/state-migration.d.ts +24 -0
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +100 -5
- package/dist/wave-runtime.mjs +309 -302
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +4 -3
- package/dist/workspace/lexicon-outputs.d.ts.map +1 -1
- package/dist/workspace/lexicon-outputs.js +21 -7
- package/dist/workspace/reason-codes.d.ts +3 -0
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +4 -0
- package/dist/workspace/ref-gate.schema.json +85 -0
- package/dist/workspace/search-contract.d.ts +1 -1
- package/dist/workspace/search-contract.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.d.ts +58 -0
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -0
- package/dist/workspace/trust/check-evidence-report.js +109 -0
- package/dist/workspace/trust/check-evidence.d.ts +160 -0
- package/dist/workspace/trust/check-evidence.d.ts.map +1 -0
- package/dist/workspace/trust/check-evidence.js +309 -0
- package/dist/workspace/trust/ci-tag-statement.d.ts +2 -2
- package/dist/workspace/trust/ci-tag-statement.d.ts.map +1 -1
- package/dist/workspace/trust/dsse.d.ts +40 -2
- package/dist/workspace/trust/dsse.d.ts.map +1 -1
- package/dist/workspace/trust/dsse.js +34 -2
- package/dist/workspace/trust/evidence.d.ts +2 -2
- package/dist/workspace/trust/evidence.d.ts.map +1 -1
- package/dist/workspace/trust/keyless-fixture.d.ts +41 -0
- package/dist/workspace/trust/keyless-fixture.d.ts.map +1 -0
- package/dist/workspace/trust/keyless-fixture.js +161 -0
- package/dist/workspace/trust/keyless.d.ts +202 -0
- package/dist/workspace/trust/keyless.d.ts.map +1 -0
- package/dist/workspace/trust/keyless.js +488 -0
- package/dist/workspace/trust/local-evidence.d.ts +123 -0
- package/dist/workspace/trust/local-evidence.d.ts.map +1 -0
- package/dist/workspace/trust/local-evidence.js +259 -0
- package/dist/workspace/trust/op-run-statement.d.ts +2 -2
- package/dist/workspace/trust/op-run-statement.d.ts.map +1 -1
- package/dist/workspace/trust/policy.d.ts +140 -1
- package/dist/workspace/trust/policy.d.ts.map +1 -1
- package/dist/workspace/trust/policy.js +197 -3
- package/dist/workspace/trust/ref-gate-cli.d.ts +33 -0
- package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -0
- package/dist/workspace/trust/ref-gate-cli.js +234 -0
- package/dist/workspace/trust/ref-gate-fixture.d.ts +38 -0
- package/dist/workspace/trust/ref-gate-fixture.d.ts.map +1 -0
- package/dist/workspace/trust/ref-gate-fixture.js +97 -0
- package/dist/workspace/trust/ref-gate.d.ts +187 -0
- package/dist/workspace/trust/ref-gate.d.ts.map +1 -0
- package/dist/workspace/trust/ref-gate.js +432 -0
- package/dist/workspace/trust/run-statement.d.ts +3 -3
- package/dist/workspace/trust/run-statement.d.ts.map +1 -1
- package/dist/workspace/trust/runner-identity.d.ts +56 -0
- package/dist/workspace/trust/runner-identity.d.ts.map +1 -0
- package/dist/workspace/trust/runner-identity.js +65 -0
- package/dist/workspace/trust/trust-files.d.ts.map +1 -1
- package/dist/workspace/trust/trust-files.js +25 -1
- package/package.json +1 -1
- package/src/bundle-check.test.ts +140 -0
- package/src/bundle-check.ts +352 -0
- package/src/chant-install.test.ts +112 -0
- package/src/chant-install.ts +179 -0
- package/src/ci-commit.test.ts +45 -0
- package/src/ci-commit.ts +38 -4
- package/src/ci-evidence-jobs.ts +105 -0
- package/src/ci-image.test.ts +506 -0
- package/src/ci-image.ts +822 -0
- package/src/ci-login.test.ts +235 -0
- package/src/ci-login.ts +307 -0
- package/src/ci-product.ts +18 -0
- package/src/cli/commands/__fixtures__/source-dir-include/chant.config.json +1 -0
- package/src/cli/commands/__fixtures__/source-dir-include/infra.ts +1 -0
- package/src/cli/commands/__fixtures__/source-dir-include/scripts/run-on-load.ts +3 -0
- package/src/cli/commands/__fixtures__/source-dir-root/chant.config.json +1 -0
- package/src/cli/commands/__fixtures__/source-dir-root/infra.test.ts +1 -0
- package/src/cli/commands/__fixtures__/source-dir-root/infra.ts +1 -0
- package/src/cli/commands/__fixtures__/source-dir-root/scripts/run-on-load.ts +3 -0
- package/src/cli/commands/__fixtures__/source-dir-scoped/app.ts +3 -0
- package/src/cli/commands/__fixtures__/source-dir-scoped/chant.config.json +1 -0
- package/src/cli/commands/__fixtures__/source-dir-scoped/infra/net.ts +1 -0
- package/src/cli/commands/__fixtures__/source-dir-scoped/scripts/run-on-load.ts +3 -0
- package/src/cli/commands/import-index.ts +2 -2
- package/src/cli/handlers/build-source-dir.test.ts +64 -0
- package/src/cli/handlers/build.ts +21 -4
- package/src/cli/handlers/ci-check.ts +60 -3
- package/src/cli/handlers/ci-evidence.ts +167 -0
- package/src/cli/handlers/components.ts +3 -3
- package/src/cli/handlers/dead-guards.ts +37 -0
- package/src/cli/handlers/graph.ts +4 -4
- package/src/cli/handlers/lifecycle.ts +5 -4
- package/src/cli/handlers/local-chant.ts +106 -0
- package/src/cli/handlers/operator.ts +2 -2
- package/src/cli/handlers/search.ts +5 -5
- package/src/cli/main.test.ts +7 -0
- package/src/cli/main.ts +38 -0
- package/src/cli/parse-args.ts +21 -0
- package/src/cli/registry.ts +16 -0
- package/src/components/check-evidence-stage.test.ts +80 -0
- package/src/components/check-hooks.ts +84 -4
- package/src/components/check-local-evidence-stage.test.ts +141 -0
- package/src/components/check-steps.ts +56 -6
- package/src/components/product-pipeline.ts +28 -3
- package/src/components/product-plan.test.ts +87 -0
- package/src/components/product-plan.ts +230 -0
- package/src/components/release-compile.ts +2 -2
- package/src/config.ts +44 -3
- package/src/dead-guards.test.ts +206 -0
- package/src/dead-guards.ts +446 -0
- package/src/discovery/files.ts +5 -3
- package/src/drift-issue-bundle.test.ts +31 -0
- package/src/drift-issue.test.ts +206 -0
- package/src/drift-issue.ts +274 -0
- package/src/fit-note.test.ts +44 -0
- package/src/floor-table.data.ts +181 -0
- package/src/floor-table.ts +77 -0
- package/src/forge-flags.test.ts +110 -0
- package/src/forge-flags.ts +208 -0
- package/src/gate-decision-bundle.test.ts +1 -0
- package/src/lexicon.ts +68 -0
- package/src/lifecycle/gated-op.ts +10 -5
- package/src/local-chant.e2e.test.ts +94 -0
- package/src/local-chant.test.ts +162 -0
- package/src/local-chant.ts +341 -0
- package/src/op/activities/predict-behaviour.ts +2 -2
- package/src/op/op-waves-evidence-spec.ts +24 -0
- package/src/op/op-waves-evidence.test.ts +130 -0
- package/src/op/op-waves-evidence.ts +58 -0
- package/src/op/op-waves-run.ts +25 -1
- package/src/op/op-waves.ts +31 -1
- package/src/op/schedule-overdue.test.ts +85 -0
- package/src/op/schedule-overdue.ts +162 -26
- package/src/plan-summary.ts +40 -0
- package/src/pr-plan-note.ts +34 -0
- package/src/pr-post-plan-note.test.ts +146 -0
- package/src/pr-post.ts +127 -3
- package/src/release-floors.ts +47 -1
- package/src/stage-hooks-bundle.test.ts +1 -0
- package/src/state-migration.test.ts +52 -1
- package/src/state-migration.ts +107 -5
- package/src/workspace/ci-green.ts +4 -3
- package/src/workspace/lexicon-outputs.ts +23 -6
- package/src/workspace/reason-codes.test.ts +3 -0
- package/src/workspace/reason-codes.ts +4 -0
- package/src/workspace/ref-gate.schema.json +85 -0
- package/src/workspace/trust/check-evidence-report.ts +115 -0
- package/src/workspace/trust/check-evidence.test.ts +133 -0
- package/src/workspace/trust/check-evidence.ts +327 -0
- package/src/workspace/trust/ci-tag-statement.ts +2 -2
- package/src/workspace/trust/dsse.ts +48 -4
- package/src/workspace/trust/evidence.ts +2 -2
- package/src/workspace/trust/keyless-fixture.ts +214 -0
- package/src/workspace/trust/keyless.test.ts +220 -0
- package/src/workspace/trust/keyless.ts +557 -0
- package/src/workspace/trust/local-evidence.test.ts +127 -0
- package/src/workspace/trust/local-evidence.ts +268 -0
- package/src/workspace/trust/op-run-statement.ts +2 -2
- package/src/workspace/trust/policy.ts +263 -3
- package/src/workspace/trust/ref-gate-cli.ts +244 -0
- package/src/workspace/trust/ref-gate-fixture.ts +125 -0
- package/src/workspace/trust/ref-gate.e2e.test.ts +76 -0
- package/src/workspace/trust/ref-gate.test.ts +247 -0
- package/src/workspace/trust/ref-gate.ts +539 -0
- package/src/workspace/trust/run-statement.ts +3 -3
- package/src/workspace/trust/runner-identity.ts +92 -0
- package/src/workspace/trust/trust-files.test.ts +22 -0
- package/src/workspace/trust/trust-files.ts +54 -1
|
@@ -21,7 +21,29 @@ const cases: Array<[string, unknown]> = [
|
|
|
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
23
|
passkeys: [{ principal: "github:erin", id: "cred-1_x", publicKey: "MCowBQYDK2VwAyEA", rpId: "example.com", origins: ["https://example.com"] }],
|
|
24
|
+
refs: [{ ref: "refs/heads/main", checks: [{ check: "plan", action: "block", command: "chant ci run plan" }, { check: "lint", command: "npm run lint" }], status: "chant/ref-gate", overrides: "ledger" }],
|
|
24
25
|
}],
|
|
26
|
+
["local evidence", { schema: 1, local: { keys: [{ principal: "alice", class: "person", key: ed }, { principal: "agent:s1", class: "agent", key: ed }], checks: [{ check: "fmt" }, { check: "lint", from: ["person", "agent"] }] } }],
|
|
27
|
+
["an empty local", { schema: 1, local: {} }],
|
|
28
|
+
["local evidence for plan", { schema: 1, local: { checks: [{ check: "plan" }] } }],
|
|
29
|
+
["local evidence for a wave's policy", { schema: 1, local: { checks: [{ check: "policy:wave-1" }] } }],
|
|
30
|
+
["local evidence for apply", { schema: 1, local: { checks: [{ check: "apply" }] } }],
|
|
31
|
+
["local evidence for drift", { schema: 1, local: { checks: [{ check: "drift" }] } }],
|
|
32
|
+
["a local key of a runner's class", { schema: 1, local: { keys: [{ principal: "ci", class: "runner", key: ed }] } }],
|
|
33
|
+
["local evidence from nobody", { schema: 1, local: { checks: [{ check: "fmt", from: [] }] } }],
|
|
34
|
+
["local with an extra key", { schema: 1, local: { checks: [], skip: true } }],
|
|
35
|
+
["keyless identities", { schema: 1, keyless: { trustedRoot: ".chant/trusted_root.json", since: commit, fulcio: "https://fulcio.example", timestamp: "https://tsa.example/ts", audience: "sigstore", identities: [{ principal: "ci", class: "runner", issuer: "https://token.actions.githubusercontent.com", subject: "https://github.com/acme/infra/.github/workflows/*@refs/heads/main" }] } }],
|
|
36
|
+
["keyless with no identities", { schema: 1, keyless: { trustedRoot: ".chant/trusted_root.json", identities: [] } }],
|
|
37
|
+
["keyless with no trusted root", { schema: 1, keyless: { identities: [{ principal: "ci", class: "runner", issuer: "https://x.example", subject: "s" }] } }],
|
|
38
|
+
["a keyless identity whose issuer is not a URL", { schema: 1, keyless: { trustedRoot: "r.json", identities: [{ principal: "ci", class: "runner", issuer: "github", subject: "s" }] } }],
|
|
39
|
+
["a keyless identity with a key", { schema: 1, keyless: { trustedRoot: "r.json", identities: [{ principal: "ci", class: "runner", issuer: "https://x.example", subject: "s", key: ed }] } }],
|
|
40
|
+
["a short keyless since", { schema: 1, keyless: { trustedRoot: "r.json", since: "abc", identities: [{ principal: "ci", class: "runner", issuer: "https://x.example", subject: "s" }] } }],
|
|
41
|
+
["a ref rule with no checks", { schema: 1, refs: [{ ref: "refs/heads/main", checks: [] }] }],
|
|
42
|
+
["a ref rule on a short ref name", { schema: 1, refs: [{ ref: "main", checks: [{ check: "plan", command: "x" }] }] }],
|
|
43
|
+
["a ref check with no command", { schema: 1, refs: [{ ref: "refs/heads/main", checks: [{ check: "plan" }] }] }],
|
|
44
|
+
["a ref check with another action", { schema: 1, refs: [{ ref: "refs/heads/main", checks: [{ check: "plan", action: "deny", command: "x" }] }] }],
|
|
45
|
+
["a ref check name with a slash", { schema: 1, refs: [{ ref: "refs/heads/main", checks: [{ check: "a/b", command: "x" }] }] }],
|
|
46
|
+
["a ref rule with an extra key", { schema: 1, refs: [{ ref: "refs/heads/main", checks: [{ check: "plan", command: "x" }], extra: 1 }] }],
|
|
25
47
|
["a passkey with no origins", { schema: 1, passkeys: [{ principal: "e", id: "c", publicKey: "k", rpId: "example.com", origins: [] }] }],
|
|
26
48
|
["a passkey whose key is padded base64", { schema: 1, passkeys: [{ principal: "e", id: "c", publicKey: "k+/=", rpId: "example.com", origins: ["https://example.com"] }] }],
|
|
27
49
|
["a passkey with an extra key", { schema: 1, passkeys: [{ principal: "e", id: "c", publicKey: "k", rpId: "example.com", origins: ["https://example.com"], alg: -8 }] }],
|
|
@@ -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", "passkeys", "admitted"]), "unknown key");
|
|
205
|
+
check("/", only(raw, ["schema", "signers", "roles", "adopted", "runners", "keyless", "passkeys", "admitted", "refs", "local"]), "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,19 @@ 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 httpUrl = (v: unknown): boolean => typeof v === "string" && /^https?:\/\/[^\s]+$/.test(v);
|
|
230
|
+
check(
|
|
231
|
+
"keyless",
|
|
232
|
+
optional(raw.keyless, (k) =>
|
|
233
|
+
isObject(k) && only(k, ["trustedRoot", "identities", "since", "fulcio", "timestamp", "audience"]) &&
|
|
234
|
+
isRepoPath(k.trustedRoot) &&
|
|
235
|
+
optional(k.since, (f) => typeof f === "string" && FULL_COMMIT.test(f)) &&
|
|
236
|
+
optional(k.fulcio, httpUrl) && optional(k.timestamp, httpUrl) && optional(k.audience, nonEmpty) &&
|
|
237
|
+
Array.isArray(k.identities) && k.identities.length > 0 &&
|
|
238
|
+
k.identities.every((e) => isObject(e) && only(e, ["principal", "class", "issuer", "subject"]) && nonEmpty(e.principal) && (e.class === "runner" || e.class === "service") && httpUrl(e.issuer) && nonEmpty(e.subject)),
|
|
239
|
+
),
|
|
240
|
+
"keyless identities (#4869): a trusted root path and identities, each a principal, a class, an issuer URL and a subject pattern",
|
|
241
|
+
);
|
|
229
242
|
const b64url = (v: unknown): boolean => typeof v === "string" && /^[A-Za-z0-9_-]+$/.test(v);
|
|
230
243
|
check(
|
|
231
244
|
"passkeys",
|
|
@@ -255,5 +268,45 @@ export function trustConfigProblems(raw: unknown): string[] {
|
|
|
255
268
|
),
|
|
256
269
|
"admitted signers, by return id",
|
|
257
270
|
);
|
|
271
|
+
check(
|
|
272
|
+
"refs",
|
|
273
|
+
optional(raw.refs, (a) =>
|
|
274
|
+
Array.isArray(a) &&
|
|
275
|
+
a.every(
|
|
276
|
+
(e) =>
|
|
277
|
+
isObject(e) && only(e, ["ref", "checks", "status", "overrides"]) &&
|
|
278
|
+
typeof e.ref === "string" && /^refs\/[^\s\\]+$/.test(e.ref) &&
|
|
279
|
+
optional(e.status, nonEmpty) && optional(e.overrides, (o) => o === "ledger" || o === "sealed") &&
|
|
280
|
+
Array.isArray(e.checks) && e.checks.length > 0 &&
|
|
281
|
+
e.checks.every(
|
|
282
|
+
(c) =>
|
|
283
|
+
isObject(c) && only(c, ["check", "action", "command"]) &&
|
|
284
|
+
typeof c.check === "string" && /^[A-Za-z0-9][A-Za-z0-9._:-]*$/.test(c.check) &&
|
|
285
|
+
optional(c.action, (x) => x === "block" || x === "warn") && nonEmpty(c.command),
|
|
286
|
+
),
|
|
287
|
+
),
|
|
288
|
+
),
|
|
289
|
+
"ref rules: a ref pattern and the checks it requires, each with a command",
|
|
290
|
+
);
|
|
291
|
+
// #4868: keep in step with LOCAL_EVIDENCE_NEVER in ./policy.ts.
|
|
292
|
+
const never = ["plan", "policy", "apply", "drift", "release", "gate", "approval", "confirm"];
|
|
293
|
+
check(
|
|
294
|
+
"local",
|
|
295
|
+
optional(raw.local, (l) =>
|
|
296
|
+
isObject(l) && only(l, ["keys", "checks"]) &&
|
|
297
|
+
optional(l.keys, (a) => Array.isArray(a) && a.every((e) => isObject(e) && only(e, ["principal", "class", "key"]) && nonEmpty(e.principal) && (e.class === "person" || e.class === "agent") && typeof e.key === "string" && SSH_ED25519.test(e.key))) &&
|
|
298
|
+
optional(l.checks, (a) =>
|
|
299
|
+
Array.isArray(a) &&
|
|
300
|
+
a.every(
|
|
301
|
+
(c) =>
|
|
302
|
+
isObject(c) && only(c, ["check", "from"]) &&
|
|
303
|
+
typeof c.check === "string" && /^[A-Za-z0-9][A-Za-z0-9._:-]*$/.test(c.check) &&
|
|
304
|
+
!never.some((n) => c.check === n || (c.check as string).startsWith(`${n}:`)) &&
|
|
305
|
+
optional(c.from, (f) => Array.isArray(f) && f.length > 0 && f.every((x) => x === "person" || x === "agent")),
|
|
306
|
+
),
|
|
307
|
+
),
|
|
308
|
+
),
|
|
309
|
+
"local evidence: person or agent keys, and the checks it stands in for (never plan, policy, apply, drift, release, gate, approval, confirm)",
|
|
310
|
+
);
|
|
258
311
|
return problems;
|
|
259
312
|
}
|