@intentius/chant 0.124.86 → 0.124.88
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/action-pins.d.ts +1 -0
- package/dist/action-pins.d.ts.map +1 -1
- package/dist/action-pins.js +2 -0
- package/dist/actor.d.ts +12 -0
- package/dist/actor.d.ts.map +1 -0
- package/dist/actor.js +18 -0
- package/dist/bundle-check.d.ts +20 -5
- package/dist/bundle-check.d.ts.map +1 -1
- package/dist/bundle-check.js +20 -5
- package/dist/chant-install.d.ts +98 -0
- package/dist/chant-install.d.ts.map +1 -1
- package/dist/chant-install.js +204 -2
- package/dist/ci-commit.d.ts.map +1 -1
- package/dist/ci-commit.js +1 -2
- package/dist/ci-control.d.ts +1 -1
- package/dist/ci-control.d.ts.map +1 -1
- package/dist/ci-control.js +1 -1
- package/dist/ci-evidence-claims.d.ts +59 -0
- package/dist/ci-evidence-claims.d.ts.map +1 -0
- package/dist/ci-evidence-claims.js +87 -0
- package/dist/ci-evidence-from-job.d.ts +103 -0
- package/dist/ci-evidence-from-job.d.ts.map +1 -0
- package/dist/ci-evidence-from-job.js +162 -0
- package/dist/ci-evidence-jobs.d.ts +69 -10
- package/dist/ci-evidence-jobs.d.ts.map +1 -1
- package/dist/ci-evidence-jobs.js +72 -8
- package/dist/ci-handover.d.ts +12 -0
- package/dist/ci-handover.d.ts.map +1 -1
- package/dist/ci-handover.js +15 -3
- package/dist/ci-identity.d.ts +32 -6
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +40 -8
- package/dist/ci-image.d.ts +47 -9
- package/dist/ci-image.d.ts.map +1 -1
- package/dist/ci-image.js +45 -18
- package/dist/ci-jobs.d.ts +1 -1
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -2
- package/dist/ci-login.d.ts +75 -13
- package/dist/ci-login.d.ts.map +1 -1
- package/dist/ci-login.js +89 -37
- package/dist/ci-product-words.d.ts +20 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +27 -1
- package/dist/ci-product.d.ts +20 -1
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +21 -2
- package/dist/cli/handlers/approve-confirm.d.ts +14 -0
- package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
- package/dist/cli/handlers/approve-confirm.js +46 -0
- package/dist/cli/handlers/build.d.ts +1 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +22 -1
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +38 -14
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
- package/dist/cli/handlers/ci-evidence.js +238 -26
- package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-forge-check.js +34 -17
- package/dist/cli/handlers/generated-check.d.ts +3 -0
- package/dist/cli/handlers/generated-check.d.ts.map +1 -0
- package/dist/cli/handlers/generated-check.js +41 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +3 -0
- package/dist/cli/handlers/local-chant.d.ts +13 -0
- package/dist/cli/handlers/local-chant.d.ts.map +1 -1
- package/dist/cli/handlers/local-chant.js +42 -1
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +42 -5
- package/dist/cli/handlers/run-wave.js +8 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +38 -4
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +66 -0
- package/dist/cli/registry.d.ts +24 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/check-hooks.d.ts +10 -0
- package/dist/components/check-hooks.d.ts.map +1 -1
- package/dist/components/check-hooks.js +21 -3
- package/dist/components/check-steps.js +1 -1
- package/dist/components/pr-checks.d.ts +105 -0
- package/dist/components/pr-checks.d.ts.map +1 -0
- package/dist/components/pr-checks.js +119 -0
- package/dist/components/pr-pipeline.d.ts +34 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +14 -1
- package/dist/components/product-pipeline.d.ts +16 -1
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +17 -2
- package/dist/components/product-plan.d.ts +262 -3
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +243 -11
- package/dist/config.d.ts +10 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -6
- package/dist/control/consumers.d.ts +6 -0
- package/dist/control/consumers.d.ts.map +1 -1
- package/dist/control/consumers.js +6 -0
- package/dist/dead-guards.d.ts.map +1 -1
- package/dist/dead-guards.js +9 -6
- package/dist/discovery/files.d.ts +1 -1
- package/dist/discovery/files.js +1 -1
- package/dist/drift-issue.d.ts +20 -3
- package/dist/drift-issue.d.ts.map +1 -1
- package/dist/drift-issue.js +16 -0
- package/dist/drift-record.d.ts +45 -5
- package/dist/drift-record.d.ts.map +1 -1
- package/dist/drift-record.js +27 -6
- package/dist/floor-table.d.ts +6 -6
- package/dist/floor-table.d.ts.map +1 -1
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +58 -20
- package/dist/floor-table.js +10 -7
- package/dist/forge-check/contract.d.ts +8 -0
- package/dist/forge-check/contract.d.ts.map +1 -1
- package/dist/forge-check/contract.js +4 -1
- package/dist/forge-check/index.d.ts +2 -0
- package/dist/forge-check/index.d.ts.map +1 -1
- package/dist/forge-check/index.js +2 -0
- package/dist/forge-flags.d.ts +10 -0
- package/dist/forge-flags.d.ts.map +1 -1
- package/dist/forge-flags.js +31 -0
- package/dist/forge-remote.d.ts +47 -0
- package/dist/forge-remote.d.ts.map +1 -0
- package/dist/forge-remote.js +69 -0
- package/dist/generated-check.d.ts +74 -0
- package/dist/generated-check.d.ts.map +1 -0
- package/dist/generated-check.js +216 -0
- package/dist/lexicon.d.ts +16 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.d.ts +15 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +49 -3
- package/dist/lifecycle/release-images.d.ts +22 -1
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +27 -3
- package/dist/lifecycle/release-ledger.d.ts +4 -3
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +3 -2
- package/dist/local-chant.d.ts +57 -3
- package/dist/local-chant.d.ts.map +1 -1
- package/dist/local-chant.js +122 -13
- package/dist/op/op-waves-evidence-jobs.d.ts +92 -0
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
- package/dist/op/op-waves-evidence-jobs.js +112 -0
- package/dist/op/op-waves-evidence.d.ts +17 -4
- package/dist/op/op-waves-evidence.d.ts.map +1 -1
- package/dist/op/op-waves-evidence.js +32 -10
- package/dist/op/op-waves-run.d.ts +12 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +54 -3
- package/dist/op/op-waves.d.ts +8 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +10 -0
- package/dist/op/schedule-overdue.d.ts +39 -2
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +89 -7
- package/dist/pr-forge-reads.d.ts +21 -1
- package/dist/pr-forge-reads.d.ts.map +1 -1
- package/dist/pr-forge-reads.js +19 -1
- package/dist/pr-forge.d.ts +7 -1
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +7 -2
- package/dist/pr-plan-note.d.ts +24 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +11 -1
- package/dist/pr-plan-record.d.ts +47 -0
- package/dist/pr-plan-record.d.ts.map +1 -0
- package/dist/pr-plan-record.js +89 -0
- package/dist/pr-post.d.ts +40 -0
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +79 -6
- package/dist/pr-requires.d.ts +8 -0
- package/dist/pr-requires.d.ts.map +1 -1
- package/dist/pr-requires.js +3 -1
- package/dist/ref-gate-init.d.ts +76 -0
- package/dist/ref-gate-init.d.ts.map +1 -0
- package/dist/ref-gate-init.js +144 -0
- package/dist/ref-gate-rules.d.ts +19 -0
- package/dist/ref-gate-rules.d.ts.map +1 -0
- package/dist/ref-gate-rules.js +17 -0
- package/dist/release-floors.d.ts +51 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +66 -16
- package/dist/state-migration.d.ts +23 -0
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +39 -3
- package/dist/state-unlock.d.ts +32 -1
- package/dist/state-unlock.d.ts.map +1 -1
- package/dist/state-unlock.js +31 -0
- package/dist/wave-runtime.mjs +310 -303
- package/dist/workspace/ci-green-cli.d.ts.map +1 -1
- package/dist/workspace/ci-green-cli.js +13 -7
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +4 -3
- package/dist/workspace/drift-cli.d.ts +1 -1
- package/dist/workspace/drift-cli.d.ts.map +1 -1
- package/dist/workspace/drift-cli.js +5 -12
- package/dist/workspace/forge-work.d.ts +3 -2
- package/dist/workspace/forge-work.d.ts.map +1 -1
- package/dist/workspace/forge-work.js +7 -17
- package/dist/workspace/lexicon-outputs.js +2 -2
- package/dist/workspace/release-workflow.d.ts +26 -3
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +48 -6
- package/dist/workspace/trust/check-evidence-report.d.ts +25 -0
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.js +20 -0
- package/dist/workspace/trust/check-evidence.d.ts +59 -13
- package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence.js +101 -24
- 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 +7 -2
- package/dist/workspace/trust/evidence.d.ts.map +1 -1
- package/dist/workspace/trust/evidence.js +5 -0
- 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 +3 -0
- package/dist/workspace/trust/local-evidence.d.ts.map +1 -1
- 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/open-evidence.d.ts +67 -0
- package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
- package/dist/workspace/trust/open-evidence.js +92 -0
- package/dist/workspace/trust/policy.d.ts +56 -1
- package/dist/workspace/trust/policy.d.ts.map +1 -1
- package/dist/workspace/trust/policy.js +103 -2
- package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate-cli.js +65 -3
- package/dist/workspace/trust/ref-gate.d.ts +62 -3
- package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate.js +75 -8
- 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 +8 -1
- package/package.json +1 -1
- package/src/action-pins.ts +2 -0
- package/src/actor.test.ts +12 -0
- package/src/actor.ts +19 -0
- package/src/bundle-check.test.ts +22 -0
- package/src/bundle-check.ts +33 -5
- package/src/chant-install.test.ts +109 -1
- package/src/chant-install.ts +243 -2
- package/src/ci-commit.test.ts +51 -5
- package/src/ci-commit.ts +1 -2
- package/src/ci-control.ts +1 -0
- package/src/ci-evidence-claims.ts +102 -0
- package/src/ci-evidence-from-job.test.ts +147 -0
- package/src/ci-evidence-from-job.ts +195 -0
- package/src/ci-evidence-jobs.ts +85 -10
- package/src/ci-handover.ts +16 -3
- package/src/ci-identity.test.ts +3 -3
- package/src/ci-identity.ts +51 -11
- package/src/ci-image.test.ts +60 -10
- package/src/ci-image.ts +78 -19
- package/src/ci-jobs.ts +7 -2
- package/src/ci-login.test.ts +131 -3
- package/src/ci-login.token-drop.test.ts +204 -0
- package/src/ci-login.ts +137 -39
- package/src/ci-product-words.ts +30 -0
- package/src/ci-product.ts +26 -1
- package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
- package/src/cli/handlers/approve-confirm.test.ts +35 -0
- package/src/cli/handlers/approve-confirm.ts +44 -0
- package/src/cli/handlers/build-source-dir.test.ts +4 -0
- package/src/cli/handlers/build.ts +20 -2
- package/src/cli/handlers/ci-check.ts +35 -13
- package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
- package/src/cli/handlers/ci-evidence.ts +223 -24
- package/src/cli/handlers/ci-forge-check.ts +22 -9
- package/src/cli/handlers/generated-check.ts +39 -0
- package/src/cli/handlers/lifecycle.test.ts +20 -0
- package/src/cli/handlers/lifecycle.ts +4 -0
- package/src/cli/handlers/local-chant.ts +39 -1
- package/src/cli/handlers/pr.ts +43 -5
- package/src/cli/handlers/run-wave.ts +7 -0
- package/src/cli/main.ts +38 -4
- package/src/cli/parse-args.ts +46 -0
- package/src/cli/registry.ts +24 -0
- package/src/components/check-hooks.ts +25 -3
- package/src/components/check-report-summary.test.ts +78 -0
- package/src/components/check-steps.ts +1 -1
- package/src/components/pr-checks.ts +159 -0
- package/src/components/pr-pipeline.ts +41 -1
- package/src/components/product-pipeline.ts +25 -3
- package/src/components/product-plan.test.ts +102 -1
- package/src/components/product-plan.ts +419 -14
- package/src/config.ts +13 -8
- package/src/control/consumers.ts +7 -0
- package/src/dead-guards.test.ts +27 -5
- package/src/dead-guards.ts +9 -6
- package/src/discovery/files.ts +1 -1
- package/src/drift-issue.test.ts +29 -1
- package/src/drift-issue.ts +28 -3
- package/src/drift-record.test.ts +25 -0
- package/src/drift-record.ts +55 -6
- package/src/floor-table.data.ts +58 -20
- package/src/floor-table.ts +12 -9
- package/src/forge-check/contract.ts +11 -1
- package/src/forge-check/forge-check.test.ts +8 -0
- package/src/forge-check/index.ts +2 -0
- package/src/forge-flags.test.ts +25 -1
- package/src/forge-flags.ts +34 -0
- package/src/forge-remote.test.ts +37 -0
- package/src/forge-remote.ts +79 -0
- package/src/generated-check.e2e.test.ts +98 -0
- package/src/generated-check.test.ts +104 -0
- package/src/generated-check.ts +269 -0
- package/src/lexicon.ts +17 -0
- package/src/lifecycle/publish-npm.ts +56 -3
- package/src/lifecycle/release-catalog.test.ts +2 -2
- package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
- package/src/lifecycle/release-images.test.ts +44 -0
- package/src/lifecycle/release-images.ts +39 -3
- package/src/lifecycle/release-ledger.ts +4 -3
- package/src/local-chant.e2e.test.ts +81 -6
- package/src/local-chant.test.ts +22 -3
- package/src/local-chant.ts +130 -13
- package/src/op/op-waves-evidence-jobs.ts +134 -0
- package/src/op/op-waves-evidence.test.ts +37 -4
- package/src/op/op-waves-evidence.ts +32 -11
- package/src/op/op-waves-run.ts +57 -2
- package/src/op/op-waves.ts +11 -0
- package/src/op/schedule-overdue.test.ts +83 -1
- package/src/op/schedule-overdue.ts +107 -9
- package/src/pr-forge-reads-compare.test.ts +2 -1
- package/src/pr-forge-reads.ts +37 -1
- package/src/pr-forge.ts +14 -3
- package/src/pr-plan-note.ts +32 -3
- package/src/pr-plan-record.test.ts +75 -0
- package/src/pr-plan-record.ts +101 -0
- package/src/pr-post-plan-note.test.ts +60 -0
- package/src/pr-post.test.ts +30 -0
- package/src/pr-post.ts +110 -6
- package/src/pr-requires.test.ts +20 -0
- package/src/pr-requires.ts +10 -1
- package/src/ref-gate-init.ts +189 -0
- package/src/ref-gate-rules.ts +26 -0
- package/src/release-floors.ts +88 -16
- package/src/state-migration-record.test.ts +90 -0
- package/src/state-migration.test.ts +1 -1
- package/src/state-migration.ts +52 -3
- package/src/state-unlock.test.ts +33 -1
- package/src/state-unlock.ts +49 -1
- package/src/workspace/ci-green-cli.ts +12 -6
- package/src/workspace/ci-green.ts +4 -3
- package/src/workspace/drift-cli.ts +6 -18
- package/src/workspace/forge-work.ts +7 -14
- package/src/workspace/lexicon-outputs.ts +2 -2
- package/src/workspace/release-workflow.test.ts +70 -0
- package/src/workspace/release-workflow.ts +56 -8
- package/src/workspace/trust/check-evidence-report.ts +33 -0
- package/src/workspace/trust/check-evidence.test.ts +3 -3
- package/src/workspace/trust/check-evidence.ts +110 -28
- package/src/workspace/trust/ci-tag-statement.ts +2 -2
- package/src/workspace/trust/dsse.ts +48 -4
- package/src/workspace/trust/evidence.ts +7 -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.ts +3 -1
- package/src/workspace/trust/op-run-statement.ts +2 -2
- package/src/workspace/trust/open-evidence.ts +129 -0
- package/src/workspace/trust/policy.ts +129 -2
- package/src/workspace/trust/ref-gate-cli.ts +59 -3
- package/src/workspace/trust/ref-gate-pieces.test.ts +175 -0
- package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
- package/src/workspace/trust/ref-gate.ts +90 -8
- 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 +6 -0
- package/src/workspace/trust/trust-files.ts +14 -1
|
@@ -37,8 +37,8 @@ import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
|
37
37
|
import { dirname, isAbsolute, join } from "node:path";
|
|
38
38
|
import type { ReasonCode } from "../reason-codes";
|
|
39
39
|
import { verifyEvidence, type EvidenceErrorCode } from "./evidence";
|
|
40
|
-
import { policyAtBase } from "./provenance";
|
|
41
|
-
import type
|
|
40
|
+
import { policyAtBase, resolveBase } from "./provenance";
|
|
41
|
+
import { runnersAt, type RefRule, type TrustPolicy } from "./policy";
|
|
42
42
|
import {
|
|
43
43
|
OVERRIDE_APPLIED,
|
|
44
44
|
OVERRIDE_LEDGER,
|
|
@@ -172,6 +172,63 @@ export function rulesFor(policy: Pick<TrustPolicy, "refs">, ref: string): { matc
|
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/** The ref gate's rules for one ref, read at base, as a product reads them (#4913). */
|
|
176
|
+
export interface RefGateRules {
|
|
177
|
+
ref: string;
|
|
178
|
+
/** The commit the policy was read at, or null when there is none. */
|
|
179
|
+
base: string | null;
|
|
180
|
+
/** A rule of the policy at base matches the ref. */
|
|
181
|
+
matched: boolean;
|
|
182
|
+
/** The commit status the ref gate's status job sets for the ref, which the forge should require; null when no rule matches. */
|
|
183
|
+
status: string | null;
|
|
184
|
+
/** The checks an update of the ref needs current evidence for, each once, as {@link rulesFor} merges them. */
|
|
185
|
+
checks: RefRule["checks"];
|
|
186
|
+
overrides?: "ledger" | "sealed";
|
|
187
|
+
/**
|
|
188
|
+
* Why the policy at base cannot be read. The gate then refuses every
|
|
189
|
+
* update of the ref and sets no status, so a product should refuse too.
|
|
190
|
+
*/
|
|
191
|
+
problems: string[];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The ref gate's rules for `ref` from the policy at `base` (#4913), the same
|
|
196
|
+
* read {@link decideRefUpdate} makes, for a product that acts on them
|
|
197
|
+
* without deciding an update: an apply that waits for the status the gate
|
|
198
|
+
* sets (`@intentius/chant/ref-gate-rules`), or a forge check that requires
|
|
199
|
+
* it. `base` defaults as `check` and `status` default it: `origin/HEAD`,
|
|
200
|
+
* then `main`, then `master`. A base that names no commit is a problem; no
|
|
201
|
+
* base at all is no policy, so nothing is required.
|
|
202
|
+
*/
|
|
203
|
+
export function refGateRulesAt(repo: string, opts: { ref: string; base?: string }): RefGateRules {
|
|
204
|
+
const resolved = resolveBase(repo, opts.base);
|
|
205
|
+
const none = { ref: opts.ref, base: resolved.commit, matched: false, status: null, checks: [] };
|
|
206
|
+
if (!resolved.commit) return { ...none, problems: opts.base !== undefined && resolved.problem ? [resolved.problem] : [] };
|
|
207
|
+
const policy = policyAtBase(repo, resolved);
|
|
208
|
+
if (policy.problems.length > 0) return { ...none, problems: [...policy.problems] };
|
|
209
|
+
const rules = rulesFor(policy, opts.ref);
|
|
210
|
+
if (!rules.matched) return { ...none, problems: [] };
|
|
211
|
+
return { ref: opts.ref, base: resolved.commit, matched: true, status: rules.status, checks: rules.checks, ...(rules.overrides ? { overrides: rules.overrides } : {}), problems: [] };
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* The status a forge's default branch should require for the ref gate
|
|
216
|
+
* (#4913), for a forge check whose pipeline renders the `ref-gate` job: the
|
|
217
|
+
* policy's status for `refs/heads/<defaultBranch>`, read at
|
|
218
|
+
* `origin/<defaultBranch>` when the checkout has it, else at `HEAD`. With
|
|
219
|
+
* no rule for the branch the job sets no status, so none is required and
|
|
220
|
+
* `note` says so; a policy that can't be read is a `problem`.
|
|
221
|
+
*/
|
|
222
|
+
export function refGateStatusFor(repo: string, defaultBranch: string): { status?: string; note?: string; problem?: string } {
|
|
223
|
+
const remote = `refs/remotes/origin/${defaultBranch}`;
|
|
224
|
+
const rules = refGateRulesAt(repo, { ref: `refs/heads/${defaultBranch}`, base: commitOf(repo, remote) ? remote : "HEAD" });
|
|
225
|
+
if (rules.problems.length > 0) return { problem: `the trust policy can't be read, so the ref gate sets no status to require: ${rules.problems.join("; ")}` };
|
|
226
|
+
if (!rules.matched || !rules.status) {
|
|
227
|
+
return { note: `no refs rule in .chant/trust.json${rules.base ? ` at ${rules.base.slice(0, 8)}` : ""} matches refs/heads/${defaultBranch}, so the ref-gate job sets no status there and none is required` };
|
|
228
|
+
}
|
|
229
|
+
return { status: rules.status };
|
|
230
|
+
}
|
|
231
|
+
|
|
175
232
|
// ── evidence notes ───────────────────────────────────────────────────────
|
|
176
233
|
|
|
177
234
|
/** The envelopes in a note's text: one per line, or the whole note as one envelope or an array of them. */
|
|
@@ -256,7 +313,8 @@ function judgeCheck(repo: string, policy: TrustPolicy, envelopes: readonly unkno
|
|
|
256
313
|
let stale: string | undefined;
|
|
257
314
|
let bad: { code: EvidenceErrorCode; reason: string } | undefined;
|
|
258
315
|
for (const env of envelopes) {
|
|
259
|
-
|
|
316
|
+
// #4869: keys and keyless identities; under keyless.since, keys only for a commit before it.
|
|
317
|
+
const v = verifyEvidence(env, runnersAt(policy, { repo, commit }), repo, commit);
|
|
260
318
|
if (!v.ok) {
|
|
261
319
|
if (claimedCheck(env) === check && !bad) bad = { code: v.code, reason: v.reason };
|
|
262
320
|
continue;
|
|
@@ -509,8 +567,24 @@ export function runPrePush(repo: string, stdin: string, opts: { ledger?: string;
|
|
|
509
567
|
|
|
510
568
|
const short = (s: string | null): string => (s ? s.slice(0, 8) : "(none)");
|
|
511
569
|
|
|
512
|
-
/**
|
|
513
|
-
|
|
570
|
+
/**
|
|
571
|
+
* The command that records the request for an override of `d`'s blocked
|
|
572
|
+
* checks from a checkout (#4913): `check` for the same ref, commit and base
|
|
573
|
+
* the remote decided, so it reaches the same decision and records the
|
|
574
|
+
* request on `chant/lifecycle`, which a pre-receive hook can't move.
|
|
575
|
+
*/
|
|
576
|
+
export function requestCommand(d: Pick<RefDecision, "ref" | "new" | "base">): string {
|
|
577
|
+
return `chant workspace ref-gate check --ref ${d.ref} --at ${d.new ?? "HEAD"}${d.base ? ` --base ${d.base}` : ""}`;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* What the gate says about one decision: each missing check and its command,
|
|
582
|
+
* and how to override a blocked one. At `pre-receive` (#4913) the request
|
|
583
|
+
* can't be recorded where the decision is made, so the refusal prints the
|
|
584
|
+
* exact command that records it from the checkout, then the override and
|
|
585
|
+
* the push that spends it.
|
|
586
|
+
*/
|
|
587
|
+
export function describeDecision(d: RefDecision, opts: { site?: RefGateSite } = {}): string[] {
|
|
514
588
|
const out: string[] = [];
|
|
515
589
|
const verb = d.decision === "admit" ? "admitted" : "refused";
|
|
516
590
|
out.push(`chant ref gate: ${verb} ${d.ref} ${short(d.old)}..${short(d.new)}`);
|
|
@@ -530,9 +604,17 @@ export function describeDecision(d: RefDecision): string[] {
|
|
|
530
604
|
const blocked = d.checks.filter((c) => c.action === "block" && (c.status === "missing" || c.status === "stale"));
|
|
531
605
|
if (blocked.length > 0) {
|
|
532
606
|
out.push(` Attach each check's evidence to ${short(d.new)} (chant workspace ref-gate attach --envelope <file> --at ${short(d.new)}) and push ${EVIDENCE_NOTES_REF} with the ref.`);
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
607
|
+
if (opts.site === "pre-receive") {
|
|
608
|
+
out.push(` To let ${short(d.new)} through without a check, record the request for an override in your checkout (this remote can't):`);
|
|
609
|
+
out.push(` ${requestCommand(d)}`);
|
|
610
|
+
out.push(` then a person listed in ${OVERRIDERS_PATH} at base overrides each check:`);
|
|
611
|
+
for (const c of blocked) out.push(` ${overrideCommand(c.subject, [c.check])}`);
|
|
612
|
+
out.push(` and the push goes again with chant/lifecycle: git push origin chant/lifecycle ${d.new ?? "HEAD"}:${d.ref}`);
|
|
613
|
+
} else {
|
|
614
|
+
out.push(` To let ${short(d.new)} through without a check, a person listed in ${OVERRIDERS_PATH} at base can override it once the request is recorded`);
|
|
615
|
+
out.push(` (the pre-push hook records it, or ${requestCommand(d)}):`);
|
|
616
|
+
for (const c of blocked) out.push(` ${overrideCommand(c.subject, [c.check])}`);
|
|
617
|
+
}
|
|
536
618
|
}
|
|
537
619
|
return out;
|
|
538
620
|
}
|
|
@@ -30,7 +30,7 @@ import type { RunEndLine, RunStartLine, RunView } from "../runs";
|
|
|
30
30
|
import { IN_TOTO_PAYLOAD_TYPE, signEnvelope, verifyEnvelope, type DsseEnvelope } from "./dsse";
|
|
31
31
|
import { STATEMENT_TYPE } from "./evidence";
|
|
32
32
|
import type { KeyObject } from "node:crypto";
|
|
33
|
-
import type { RunnerKey } from "./policy";
|
|
33
|
+
import type { Runner, RunnerKey } from "./policy";
|
|
34
34
|
|
|
35
35
|
export const AGENT_RUN_PREDICATE = "https://intentius.io/chant/agent-run/v1";
|
|
36
36
|
|
|
@@ -138,7 +138,7 @@ const same = (a: unknown, b: unknown) => canonicalJson(a ?? null) === canonicalJ
|
|
|
138
138
|
* well-formed statement whose signer is that key's principal, for this run,
|
|
139
139
|
* and agreeing with its record. Never throws.
|
|
140
140
|
*/
|
|
141
|
-
export function verifyRunStatement(envelope: unknown, runners: readonly
|
|
141
|
+
export function verifyRunStatement(envelope: unknown, runners: readonly Runner[], run: RunView): RunStatementVerdict {
|
|
142
142
|
const v = verifyEnvelope(envelope, runners);
|
|
143
143
|
if (!v.ok) return { status: v.code === "envelope-untrusted" ? "untrusted" : "invalid", code: v.code, reason: v.reason };
|
|
144
144
|
const runner = runners.find((r) => r.principal === v.principal)!;
|
|
@@ -202,7 +202,7 @@ export interface RunAttestation {
|
|
|
202
202
|
const RANK = { mismatch: 0, untrusted: 1, invalid: 2 } as const;
|
|
203
203
|
|
|
204
204
|
/** Judge every statement the ledger holds for `run`. */
|
|
205
|
-
export function attestRun(run: RunView, runners: readonly
|
|
205
|
+
export function attestRun(run: RunView, runners: readonly Runner[]): RunAttestation {
|
|
206
206
|
const verdicts = run.statements.map((s) => verifyRunStatement(s.envelope, runners, run));
|
|
207
207
|
const good = verdicts.find((v): v is Extract<RunStatementVerdict, { status: "verified" }> => v.status === "verified");
|
|
208
208
|
if (good) {
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runner identity an init writes into `.chant/trust.json` (#4869).
|
|
3
|
+
*
|
|
4
|
+
* None of the CI products' inits wrote `.chant/trust.json`, a runner key
|
|
5
|
+
* or an identity, so a keyless runner had nowhere to come from. These are
|
|
6
|
+
* the pieces an init calls: {@link ciRunnerIdentity} names the identity the
|
|
7
|
+
* generated workflow signs as, on the forge it runs on, and
|
|
8
|
+
* {@link withRunnerIdentity} adds it to the file's text under `keyless`,
|
|
9
|
+
* with the principal in `roles.runner`, which ci tags and Op runs need.
|
|
10
|
+
*
|
|
11
|
+
* The subject is the certificate's subject alternative name the
|
|
12
|
+
* certificate authority writes for that job: on GitHub the workflow file at
|
|
13
|
+
* a ref (`https://github.com/<owner>/<repo>/<workflow path>@<ref>`), on
|
|
14
|
+
* GitLab the CI config at a ref (`<server>/<project>//<config path>@<ref>`).
|
|
15
|
+
* A Forgejo job's certificate comes from a private authority, whose
|
|
16
|
+
* issuer and subject the project names itself.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { trustConfigSchema, type TrustConfig } from "./policy";
|
|
20
|
+
|
|
21
|
+
/** The trusted root an init points `keyless.trustedRoot` at, unless told. */
|
|
22
|
+
export const DEFAULT_TRUSTED_ROOT_PATH = ".chant/trusted_root.json";
|
|
23
|
+
|
|
24
|
+
/** One entry of `keyless.identities`. */
|
|
25
|
+
export interface KeylessIdentityEntry {
|
|
26
|
+
principal: string;
|
|
27
|
+
class: "runner" | "service";
|
|
28
|
+
issuer: string;
|
|
29
|
+
subject: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface CiRunnerIdentityInput {
|
|
33
|
+
forge: "github" | "gitlab" | "forgejo";
|
|
34
|
+
/** `owner/repo` on GitHub and Forgejo, the project path on GitLab. */
|
|
35
|
+
repository: string;
|
|
36
|
+
/** The workflow file (GitHub, Forgejo), such as `.github/workflows/chant-pr.yml`, or the CI config path (GitLab, default `.gitlab-ci.yml`). A `*` matches within the file name. */
|
|
37
|
+
workflow?: string;
|
|
38
|
+
/** The ref the job runs at. Default `refs/heads/main`. A pull request job runs at another ref, such as `refs/pull/*\/merge`. */
|
|
39
|
+
ref?: string;
|
|
40
|
+
/** The forge's URL. Default `https://github.com` or `https://gitlab.com`; required on Forgejo. */
|
|
41
|
+
server?: string;
|
|
42
|
+
/** The OIDC issuer. Default GitHub's or the GitLab server; required on Forgejo. */
|
|
43
|
+
issuer?: string;
|
|
44
|
+
/** The subject pattern, instead of the one the forge's job would have. Required on Forgejo. */
|
|
45
|
+
subject?: string;
|
|
46
|
+
/** Default `ci`. */
|
|
47
|
+
principal?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const trim = (u: string): string => u.replace(/\/+$/, "");
|
|
51
|
+
|
|
52
|
+
/** The `keyless.identities` entry for the generated workflow's jobs on `forge`. Throws when the forge's identity cannot be worked out. */
|
|
53
|
+
export function ciRunnerIdentity(input: CiRunnerIdentityInput): KeylessIdentityEntry {
|
|
54
|
+
const ref = input.ref ?? "refs/heads/main";
|
|
55
|
+
const principal = input.principal ?? "ci";
|
|
56
|
+
if (!/^[^\s/][^\s]*\/[^\s]+$/.test(input.repository)) throw new Error(`repository ${JSON.stringify(input.repository)} is not an owner/name path`);
|
|
57
|
+
if (input.forge === "github") {
|
|
58
|
+
if (!input.workflow) throw new Error("a GitHub runner identity names its workflow file, such as .github/workflows/chant-pr.yml");
|
|
59
|
+
const server = trim(input.server ?? "https://github.com");
|
|
60
|
+
return { principal, class: "runner", issuer: input.issuer ?? "https://token.actions.githubusercontent.com", subject: input.subject ?? `${server}/${input.repository}/${input.workflow}@${ref}` };
|
|
61
|
+
}
|
|
62
|
+
if (input.forge === "gitlab") {
|
|
63
|
+
const server = trim(input.server ?? "https://gitlab.com");
|
|
64
|
+
return { principal, class: "runner", issuer: input.issuer ?? server, subject: input.subject ?? `${server}/${input.repository}//${input.workflow ?? ".gitlab-ci.yml"}@${ref}` };
|
|
65
|
+
}
|
|
66
|
+
if (!input.issuer || !input.subject) {
|
|
67
|
+
throw new Error("a Forgejo job's certificate comes from the certificate authority the project runs, so its runner identity names that authority's issuer and the subject it writes");
|
|
68
|
+
}
|
|
69
|
+
return { principal, class: "runner", issuer: input.issuer, subject: input.subject };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* `.chant/trust.json`'s text (or none, for a new file) with `identity` under
|
|
74
|
+
* `keyless.identities` and its principal in `roles.runner`. An identity
|
|
75
|
+
* with the same issuer and subject is not added twice. `trustedRoot` is
|
|
76
|
+
* written when the file sets none. Throws when the result is not a valid
|
|
77
|
+
* trust config.
|
|
78
|
+
*/
|
|
79
|
+
export function withRunnerIdentity(text: string | undefined, identity: KeylessIdentityEntry, opts: { trustedRoot?: string } = {}): string {
|
|
80
|
+
const config: TrustConfig = text === undefined || text.trim() === "" ? { schema: 1 } : (JSON.parse(text) as TrustConfig);
|
|
81
|
+
const keyless = config.keyless ?? { trustedRoot: opts.trustedRoot ?? DEFAULT_TRUSTED_ROOT_PATH, identities: [] };
|
|
82
|
+
if (!keyless.identities.some((i) => i.issuer === identity.issuer && i.subject === identity.subject)) keyless.identities = [...keyless.identities, identity];
|
|
83
|
+
const runners = config.roles?.runner ?? [];
|
|
84
|
+
const next: TrustConfig = {
|
|
85
|
+
...config,
|
|
86
|
+
roles: { ...(config.roles ?? {}), runner: runners.includes(identity.principal) ? runners : [...runners, identity.principal] },
|
|
87
|
+
keyless,
|
|
88
|
+
};
|
|
89
|
+
const parsed = trustConfigSchema.safeParse(next);
|
|
90
|
+
if (!parsed.success) throw new Error(`the trust config with the runner identity is invalid: ${parsed.error.issues.map((i) => `${i.path.join(".") || "/"}: ${i.message}`).join("; ")}`);
|
|
91
|
+
return `${JSON.stringify(next, null, 2)}\n`;
|
|
92
|
+
}
|
|
@@ -32,6 +32,12 @@ const cases: Array<[string, unknown]> = [
|
|
|
32
32
|
["a local key of a runner's class", { schema: 1, local: { keys: [{ principal: "ci", class: "runner", key: ed }] } }],
|
|
33
33
|
["local evidence from nobody", { schema: 1, local: { checks: [{ check: "fmt", from: [] }] } }],
|
|
34
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" }] } }],
|
|
35
41
|
["a ref rule with no checks", { schema: 1, refs: [{ ref: "refs/heads/main", checks: [] }] }],
|
|
36
42
|
["a ref rule on a short ref name", { schema: 1, refs: [{ ref: "main", checks: [{ check: "plan", command: "x" }] }] }],
|
|
37
43
|
["a ref check with no command", { schema: 1, refs: [{ ref: "refs/heads/main", checks: [{ check: "plan" }] }] }],
|
|
@@ -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", "refs", "local"]), "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",
|