@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.
Files changed (384) hide show
  1. package/dist/action-pins.d.ts +1 -0
  2. package/dist/action-pins.d.ts.map +1 -1
  3. package/dist/action-pins.js +2 -0
  4. package/dist/actor.d.ts +12 -0
  5. package/dist/actor.d.ts.map +1 -0
  6. package/dist/actor.js +18 -0
  7. package/dist/bundle-check.d.ts +20 -5
  8. package/dist/bundle-check.d.ts.map +1 -1
  9. package/dist/bundle-check.js +20 -5
  10. package/dist/chant-install.d.ts +98 -0
  11. package/dist/chant-install.d.ts.map +1 -1
  12. package/dist/chant-install.js +204 -2
  13. package/dist/ci-commit.d.ts.map +1 -1
  14. package/dist/ci-commit.js +1 -2
  15. package/dist/ci-control.d.ts +1 -1
  16. package/dist/ci-control.d.ts.map +1 -1
  17. package/dist/ci-control.js +1 -1
  18. package/dist/ci-evidence-claims.d.ts +59 -0
  19. package/dist/ci-evidence-claims.d.ts.map +1 -0
  20. package/dist/ci-evidence-claims.js +87 -0
  21. package/dist/ci-evidence-from-job.d.ts +103 -0
  22. package/dist/ci-evidence-from-job.d.ts.map +1 -0
  23. package/dist/ci-evidence-from-job.js +162 -0
  24. package/dist/ci-evidence-jobs.d.ts +69 -10
  25. package/dist/ci-evidence-jobs.d.ts.map +1 -1
  26. package/dist/ci-evidence-jobs.js +72 -8
  27. package/dist/ci-handover.d.ts +12 -0
  28. package/dist/ci-handover.d.ts.map +1 -1
  29. package/dist/ci-handover.js +15 -3
  30. package/dist/ci-identity.d.ts +32 -6
  31. package/dist/ci-identity.d.ts.map +1 -1
  32. package/dist/ci-identity.js +40 -8
  33. package/dist/ci-image.d.ts +47 -9
  34. package/dist/ci-image.d.ts.map +1 -1
  35. package/dist/ci-image.js +45 -18
  36. package/dist/ci-jobs.d.ts +1 -1
  37. package/dist/ci-jobs.d.ts.map +1 -1
  38. package/dist/ci-jobs.js +7 -2
  39. package/dist/ci-login.d.ts +75 -13
  40. package/dist/ci-login.d.ts.map +1 -1
  41. package/dist/ci-login.js +89 -37
  42. package/dist/ci-product-words.d.ts +20 -1
  43. package/dist/ci-product-words.d.ts.map +1 -1
  44. package/dist/ci-product-words.js +27 -1
  45. package/dist/ci-product.d.ts +20 -1
  46. package/dist/ci-product.d.ts.map +1 -1
  47. package/dist/ci-product.js +21 -2
  48. package/dist/cli/handlers/approve-confirm.d.ts +14 -0
  49. package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
  50. package/dist/cli/handlers/approve-confirm.js +46 -0
  51. package/dist/cli/handlers/build.d.ts +1 -1
  52. package/dist/cli/handlers/build.d.ts.map +1 -1
  53. package/dist/cli/handlers/build.js +22 -1
  54. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  55. package/dist/cli/handlers/ci-check.js +38 -14
  56. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
  57. package/dist/cli/handlers/ci-evidence.js +238 -26
  58. package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
  59. package/dist/cli/handlers/ci-forge-check.js +34 -17
  60. package/dist/cli/handlers/generated-check.d.ts +3 -0
  61. package/dist/cli/handlers/generated-check.d.ts.map +1 -0
  62. package/dist/cli/handlers/generated-check.js +41 -0
  63. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  64. package/dist/cli/handlers/lifecycle.js +3 -0
  65. package/dist/cli/handlers/local-chant.d.ts +13 -0
  66. package/dist/cli/handlers/local-chant.d.ts.map +1 -1
  67. package/dist/cli/handlers/local-chant.js +42 -1
  68. package/dist/cli/handlers/pr.d.ts.map +1 -1
  69. package/dist/cli/handlers/pr.js +42 -5
  70. package/dist/cli/handlers/run-wave.js +8 -0
  71. package/dist/cli/main.d.ts.map +1 -1
  72. package/dist/cli/main.js +38 -4
  73. package/dist/cli/parse-args.d.ts.map +1 -1
  74. package/dist/cli/parse-args.js +66 -0
  75. package/dist/cli/registry.d.ts +24 -0
  76. package/dist/cli/registry.d.ts.map +1 -1
  77. package/dist/components/check-hooks.d.ts +10 -0
  78. package/dist/components/check-hooks.d.ts.map +1 -1
  79. package/dist/components/check-hooks.js +21 -3
  80. package/dist/components/check-steps.js +1 -1
  81. package/dist/components/pr-checks.d.ts +105 -0
  82. package/dist/components/pr-checks.d.ts.map +1 -0
  83. package/dist/components/pr-checks.js +119 -0
  84. package/dist/components/pr-pipeline.d.ts +34 -0
  85. package/dist/components/pr-pipeline.d.ts.map +1 -1
  86. package/dist/components/pr-pipeline.js +14 -1
  87. package/dist/components/product-pipeline.d.ts +16 -1
  88. package/dist/components/product-pipeline.d.ts.map +1 -1
  89. package/dist/components/product-pipeline.js +17 -2
  90. package/dist/components/product-plan.d.ts +262 -3
  91. package/dist/components/product-plan.d.ts.map +1 -1
  92. package/dist/components/product-plan.js +243 -11
  93. package/dist/config.d.ts +10 -6
  94. package/dist/config.d.ts.map +1 -1
  95. package/dist/config.js +11 -6
  96. package/dist/control/consumers.d.ts +6 -0
  97. package/dist/control/consumers.d.ts.map +1 -1
  98. package/dist/control/consumers.js +6 -0
  99. package/dist/dead-guards.d.ts.map +1 -1
  100. package/dist/dead-guards.js +9 -6
  101. package/dist/discovery/files.d.ts +1 -1
  102. package/dist/discovery/files.js +1 -1
  103. package/dist/drift-issue.d.ts +20 -3
  104. package/dist/drift-issue.d.ts.map +1 -1
  105. package/dist/drift-issue.js +16 -0
  106. package/dist/drift-record.d.ts +45 -5
  107. package/dist/drift-record.d.ts.map +1 -1
  108. package/dist/drift-record.js +27 -6
  109. package/dist/floor-table.d.ts +6 -6
  110. package/dist/floor-table.d.ts.map +1 -1
  111. package/dist/floor-table.data.d.ts.map +1 -1
  112. package/dist/floor-table.data.js +58 -20
  113. package/dist/floor-table.js +10 -7
  114. package/dist/forge-check/contract.d.ts +8 -0
  115. package/dist/forge-check/contract.d.ts.map +1 -1
  116. package/dist/forge-check/contract.js +4 -1
  117. package/dist/forge-check/index.d.ts +2 -0
  118. package/dist/forge-check/index.d.ts.map +1 -1
  119. package/dist/forge-check/index.js +2 -0
  120. package/dist/forge-flags.d.ts +10 -0
  121. package/dist/forge-flags.d.ts.map +1 -1
  122. package/dist/forge-flags.js +31 -0
  123. package/dist/forge-remote.d.ts +47 -0
  124. package/dist/forge-remote.d.ts.map +1 -0
  125. package/dist/forge-remote.js +69 -0
  126. package/dist/generated-check.d.ts +74 -0
  127. package/dist/generated-check.d.ts.map +1 -0
  128. package/dist/generated-check.js +216 -0
  129. package/dist/lexicon.d.ts +16 -0
  130. package/dist/lexicon.d.ts.map +1 -1
  131. package/dist/lifecycle/publish-npm.d.ts +15 -0
  132. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  133. package/dist/lifecycle/publish-npm.js +49 -3
  134. package/dist/lifecycle/release-images.d.ts +22 -1
  135. package/dist/lifecycle/release-images.d.ts.map +1 -1
  136. package/dist/lifecycle/release-images.js +27 -3
  137. package/dist/lifecycle/release-ledger.d.ts +4 -3
  138. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  139. package/dist/lifecycle/release-ledger.js +3 -2
  140. package/dist/local-chant.d.ts +57 -3
  141. package/dist/local-chant.d.ts.map +1 -1
  142. package/dist/local-chant.js +122 -13
  143. package/dist/op/op-waves-evidence-jobs.d.ts +92 -0
  144. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
  145. package/dist/op/op-waves-evidence-jobs.js +112 -0
  146. package/dist/op/op-waves-evidence.d.ts +17 -4
  147. package/dist/op/op-waves-evidence.d.ts.map +1 -1
  148. package/dist/op/op-waves-evidence.js +32 -10
  149. package/dist/op/op-waves-run.d.ts +12 -1
  150. package/dist/op/op-waves-run.d.ts.map +1 -1
  151. package/dist/op/op-waves-run.js +54 -3
  152. package/dist/op/op-waves.d.ts +8 -0
  153. package/dist/op/op-waves.d.ts.map +1 -1
  154. package/dist/op/op-waves.js +10 -0
  155. package/dist/op/schedule-overdue.d.ts +39 -2
  156. package/dist/op/schedule-overdue.d.ts.map +1 -1
  157. package/dist/op/schedule-overdue.js +89 -7
  158. package/dist/pr-forge-reads.d.ts +21 -1
  159. package/dist/pr-forge-reads.d.ts.map +1 -1
  160. package/dist/pr-forge-reads.js +19 -1
  161. package/dist/pr-forge.d.ts +7 -1
  162. package/dist/pr-forge.d.ts.map +1 -1
  163. package/dist/pr-forge.js +7 -2
  164. package/dist/pr-plan-note.d.ts +24 -0
  165. package/dist/pr-plan-note.d.ts.map +1 -1
  166. package/dist/pr-plan-note.js +11 -1
  167. package/dist/pr-plan-record.d.ts +47 -0
  168. package/dist/pr-plan-record.d.ts.map +1 -0
  169. package/dist/pr-plan-record.js +89 -0
  170. package/dist/pr-post.d.ts +40 -0
  171. package/dist/pr-post.d.ts.map +1 -1
  172. package/dist/pr-post.js +79 -6
  173. package/dist/pr-requires.d.ts +8 -0
  174. package/dist/pr-requires.d.ts.map +1 -1
  175. package/dist/pr-requires.js +3 -1
  176. package/dist/ref-gate-init.d.ts +76 -0
  177. package/dist/ref-gate-init.d.ts.map +1 -0
  178. package/dist/ref-gate-init.js +144 -0
  179. package/dist/ref-gate-rules.d.ts +19 -0
  180. package/dist/ref-gate-rules.d.ts.map +1 -0
  181. package/dist/ref-gate-rules.js +17 -0
  182. package/dist/release-floors.d.ts +51 -1
  183. package/dist/release-floors.d.ts.map +1 -1
  184. package/dist/release-floors.js +66 -16
  185. package/dist/state-migration.d.ts +23 -0
  186. package/dist/state-migration.d.ts.map +1 -1
  187. package/dist/state-migration.js +39 -3
  188. package/dist/state-unlock.d.ts +32 -1
  189. package/dist/state-unlock.d.ts.map +1 -1
  190. package/dist/state-unlock.js +31 -0
  191. package/dist/wave-runtime.mjs +310 -303
  192. package/dist/workspace/ci-green-cli.d.ts.map +1 -1
  193. package/dist/workspace/ci-green-cli.js +13 -7
  194. package/dist/workspace/ci-green.d.ts.map +1 -1
  195. package/dist/workspace/ci-green.js +4 -3
  196. package/dist/workspace/drift-cli.d.ts +1 -1
  197. package/dist/workspace/drift-cli.d.ts.map +1 -1
  198. package/dist/workspace/drift-cli.js +5 -12
  199. package/dist/workspace/forge-work.d.ts +3 -2
  200. package/dist/workspace/forge-work.d.ts.map +1 -1
  201. package/dist/workspace/forge-work.js +7 -17
  202. package/dist/workspace/lexicon-outputs.js +2 -2
  203. package/dist/workspace/release-workflow.d.ts +26 -3
  204. package/dist/workspace/release-workflow.d.ts.map +1 -1
  205. package/dist/workspace/release-workflow.js +48 -6
  206. package/dist/workspace/trust/check-evidence-report.d.ts +25 -0
  207. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
  208. package/dist/workspace/trust/check-evidence-report.js +20 -0
  209. package/dist/workspace/trust/check-evidence.d.ts +59 -13
  210. package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
  211. package/dist/workspace/trust/check-evidence.js +101 -24
  212. package/dist/workspace/trust/ci-tag-statement.d.ts +2 -2
  213. package/dist/workspace/trust/ci-tag-statement.d.ts.map +1 -1
  214. package/dist/workspace/trust/dsse.d.ts +40 -2
  215. package/dist/workspace/trust/dsse.d.ts.map +1 -1
  216. package/dist/workspace/trust/dsse.js +34 -2
  217. package/dist/workspace/trust/evidence.d.ts +7 -2
  218. package/dist/workspace/trust/evidence.d.ts.map +1 -1
  219. package/dist/workspace/trust/evidence.js +5 -0
  220. package/dist/workspace/trust/keyless-fixture.d.ts +41 -0
  221. package/dist/workspace/trust/keyless-fixture.d.ts.map +1 -0
  222. package/dist/workspace/trust/keyless-fixture.js +161 -0
  223. package/dist/workspace/trust/keyless.d.ts +202 -0
  224. package/dist/workspace/trust/keyless.d.ts.map +1 -0
  225. package/dist/workspace/trust/keyless.js +488 -0
  226. package/dist/workspace/trust/local-evidence.d.ts +3 -0
  227. package/dist/workspace/trust/local-evidence.d.ts.map +1 -1
  228. package/dist/workspace/trust/op-run-statement.d.ts +2 -2
  229. package/dist/workspace/trust/op-run-statement.d.ts.map +1 -1
  230. package/dist/workspace/trust/open-evidence.d.ts +67 -0
  231. package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
  232. package/dist/workspace/trust/open-evidence.js +92 -0
  233. package/dist/workspace/trust/policy.d.ts +56 -1
  234. package/dist/workspace/trust/policy.d.ts.map +1 -1
  235. package/dist/workspace/trust/policy.js +103 -2
  236. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
  237. package/dist/workspace/trust/ref-gate-cli.js +65 -3
  238. package/dist/workspace/trust/ref-gate.d.ts +62 -3
  239. package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
  240. package/dist/workspace/trust/ref-gate.js +75 -8
  241. package/dist/workspace/trust/run-statement.d.ts +3 -3
  242. package/dist/workspace/trust/run-statement.d.ts.map +1 -1
  243. package/dist/workspace/trust/runner-identity.d.ts +56 -0
  244. package/dist/workspace/trust/runner-identity.d.ts.map +1 -0
  245. package/dist/workspace/trust/runner-identity.js +65 -0
  246. package/dist/workspace/trust/trust-files.d.ts.map +1 -1
  247. package/dist/workspace/trust/trust-files.js +8 -1
  248. package/package.json +1 -1
  249. package/src/action-pins.ts +2 -0
  250. package/src/actor.test.ts +12 -0
  251. package/src/actor.ts +19 -0
  252. package/src/bundle-check.test.ts +22 -0
  253. package/src/bundle-check.ts +33 -5
  254. package/src/chant-install.test.ts +109 -1
  255. package/src/chant-install.ts +243 -2
  256. package/src/ci-commit.test.ts +51 -5
  257. package/src/ci-commit.ts +1 -2
  258. package/src/ci-control.ts +1 -0
  259. package/src/ci-evidence-claims.ts +102 -0
  260. package/src/ci-evidence-from-job.test.ts +147 -0
  261. package/src/ci-evidence-from-job.ts +195 -0
  262. package/src/ci-evidence-jobs.ts +85 -10
  263. package/src/ci-handover.ts +16 -3
  264. package/src/ci-identity.test.ts +3 -3
  265. package/src/ci-identity.ts +51 -11
  266. package/src/ci-image.test.ts +60 -10
  267. package/src/ci-image.ts +78 -19
  268. package/src/ci-jobs.ts +7 -2
  269. package/src/ci-login.test.ts +131 -3
  270. package/src/ci-login.token-drop.test.ts +204 -0
  271. package/src/ci-login.ts +137 -39
  272. package/src/ci-product-words.ts +30 -0
  273. package/src/ci-product.ts +26 -1
  274. package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
  275. package/src/cli/handlers/approve-confirm.test.ts +35 -0
  276. package/src/cli/handlers/approve-confirm.ts +44 -0
  277. package/src/cli/handlers/build-source-dir.test.ts +4 -0
  278. package/src/cli/handlers/build.ts +20 -2
  279. package/src/cli/handlers/ci-check.ts +35 -13
  280. package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
  281. package/src/cli/handlers/ci-evidence.ts +223 -24
  282. package/src/cli/handlers/ci-forge-check.ts +22 -9
  283. package/src/cli/handlers/generated-check.ts +39 -0
  284. package/src/cli/handlers/lifecycle.test.ts +20 -0
  285. package/src/cli/handlers/lifecycle.ts +4 -0
  286. package/src/cli/handlers/local-chant.ts +39 -1
  287. package/src/cli/handlers/pr.ts +43 -5
  288. package/src/cli/handlers/run-wave.ts +7 -0
  289. package/src/cli/main.ts +38 -4
  290. package/src/cli/parse-args.ts +46 -0
  291. package/src/cli/registry.ts +24 -0
  292. package/src/components/check-hooks.ts +25 -3
  293. package/src/components/check-report-summary.test.ts +78 -0
  294. package/src/components/check-steps.ts +1 -1
  295. package/src/components/pr-checks.ts +159 -0
  296. package/src/components/pr-pipeline.ts +41 -1
  297. package/src/components/product-pipeline.ts +25 -3
  298. package/src/components/product-plan.test.ts +102 -1
  299. package/src/components/product-plan.ts +419 -14
  300. package/src/config.ts +13 -8
  301. package/src/control/consumers.ts +7 -0
  302. package/src/dead-guards.test.ts +27 -5
  303. package/src/dead-guards.ts +9 -6
  304. package/src/discovery/files.ts +1 -1
  305. package/src/drift-issue.test.ts +29 -1
  306. package/src/drift-issue.ts +28 -3
  307. package/src/drift-record.test.ts +25 -0
  308. package/src/drift-record.ts +55 -6
  309. package/src/floor-table.data.ts +58 -20
  310. package/src/floor-table.ts +12 -9
  311. package/src/forge-check/contract.ts +11 -1
  312. package/src/forge-check/forge-check.test.ts +8 -0
  313. package/src/forge-check/index.ts +2 -0
  314. package/src/forge-flags.test.ts +25 -1
  315. package/src/forge-flags.ts +34 -0
  316. package/src/forge-remote.test.ts +37 -0
  317. package/src/forge-remote.ts +79 -0
  318. package/src/generated-check.e2e.test.ts +98 -0
  319. package/src/generated-check.test.ts +104 -0
  320. package/src/generated-check.ts +269 -0
  321. package/src/lexicon.ts +17 -0
  322. package/src/lifecycle/publish-npm.ts +56 -3
  323. package/src/lifecycle/release-catalog.test.ts +2 -2
  324. package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
  325. package/src/lifecycle/release-images.test.ts +44 -0
  326. package/src/lifecycle/release-images.ts +39 -3
  327. package/src/lifecycle/release-ledger.ts +4 -3
  328. package/src/local-chant.e2e.test.ts +81 -6
  329. package/src/local-chant.test.ts +22 -3
  330. package/src/local-chant.ts +130 -13
  331. package/src/op/op-waves-evidence-jobs.ts +134 -0
  332. package/src/op/op-waves-evidence.test.ts +37 -4
  333. package/src/op/op-waves-evidence.ts +32 -11
  334. package/src/op/op-waves-run.ts +57 -2
  335. package/src/op/op-waves.ts +11 -0
  336. package/src/op/schedule-overdue.test.ts +83 -1
  337. package/src/op/schedule-overdue.ts +107 -9
  338. package/src/pr-forge-reads-compare.test.ts +2 -1
  339. package/src/pr-forge-reads.ts +37 -1
  340. package/src/pr-forge.ts +14 -3
  341. package/src/pr-plan-note.ts +32 -3
  342. package/src/pr-plan-record.test.ts +75 -0
  343. package/src/pr-plan-record.ts +101 -0
  344. package/src/pr-post-plan-note.test.ts +60 -0
  345. package/src/pr-post.test.ts +30 -0
  346. package/src/pr-post.ts +110 -6
  347. package/src/pr-requires.test.ts +20 -0
  348. package/src/pr-requires.ts +10 -1
  349. package/src/ref-gate-init.ts +189 -0
  350. package/src/ref-gate-rules.ts +26 -0
  351. package/src/release-floors.ts +88 -16
  352. package/src/state-migration-record.test.ts +90 -0
  353. package/src/state-migration.test.ts +1 -1
  354. package/src/state-migration.ts +52 -3
  355. package/src/state-unlock.test.ts +33 -1
  356. package/src/state-unlock.ts +49 -1
  357. package/src/workspace/ci-green-cli.ts +12 -6
  358. package/src/workspace/ci-green.ts +4 -3
  359. package/src/workspace/drift-cli.ts +6 -18
  360. package/src/workspace/forge-work.ts +7 -14
  361. package/src/workspace/lexicon-outputs.ts +2 -2
  362. package/src/workspace/release-workflow.test.ts +70 -0
  363. package/src/workspace/release-workflow.ts +56 -8
  364. package/src/workspace/trust/check-evidence-report.ts +33 -0
  365. package/src/workspace/trust/check-evidence.test.ts +3 -3
  366. package/src/workspace/trust/check-evidence.ts +110 -28
  367. package/src/workspace/trust/ci-tag-statement.ts +2 -2
  368. package/src/workspace/trust/dsse.ts +48 -4
  369. package/src/workspace/trust/evidence.ts +7 -2
  370. package/src/workspace/trust/keyless-fixture.ts +214 -0
  371. package/src/workspace/trust/keyless.test.ts +220 -0
  372. package/src/workspace/trust/keyless.ts +557 -0
  373. package/src/workspace/trust/local-evidence.ts +3 -1
  374. package/src/workspace/trust/op-run-statement.ts +2 -2
  375. package/src/workspace/trust/open-evidence.ts +129 -0
  376. package/src/workspace/trust/policy.ts +129 -2
  377. package/src/workspace/trust/ref-gate-cli.ts +59 -3
  378. package/src/workspace/trust/ref-gate-pieces.test.ts +175 -0
  379. package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
  380. package/src/workspace/trust/ref-gate.ts +90 -8
  381. package/src/workspace/trust/run-statement.ts +3 -3
  382. package/src/workspace/trust/runner-identity.ts +92 -0
  383. package/src/workspace/trust/trust-files.test.ts +6 -0
  384. package/src/workspace/trust/trust-files.ts +14 -1
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The claim files a check's step leaves for a signer in another job (#4926),
3
+ * and the variable that names which step or job each check's pass is read
4
+ * from. No import beyond node's, so the wave runner and the generators carry
5
+ * it at no cost.
6
+ *
7
+ * A step that ran a check writes `<dir>/<check>.json` (`:` turned into `-`):
8
+ * the check's name, whether the step saw it pass, and what it said (the
9
+ * claim the statement digests). The step runs the change's code, so the file
10
+ * is data and never enough on its own: `chant ci evidence sign --from-job`
11
+ * signs a check only when the forge reports that step (on GitLab, that job)
12
+ * concluded `success` and the file says the check passed
13
+ * (./ci-evidence-from-job.ts).
14
+ */
15
+ /**
16
+ * The variable a `--from-job` signing step reads its sources from: JSON,
17
+ * each check to the job (default `--from-job`'s) and the step whose
18
+ * conclusion stands for it. A check with no step is read from its job's
19
+ * own status, as on GitLab.
20
+ */
21
+ export declare const EVIDENCE_SOURCES_ENV = "CHANT_EVIDENCE_SOURCES";
22
+ /**
23
+ * What a generated wave command step signs itself (#4926), set by the
24
+ * generator beside the wave's evidence job: `plan` signs `plan:<wave>` and
25
+ * leaves `policy:<wave>` to the evidence job, which reads the policy step's
26
+ * result; `job` signs nothing and leaves both. Either way the step writes
27
+ * `plan:<wave>`'s claim file for that job. Unset, the step signs both as it
28
+ * did (#4870). See ./op/op-waves-evidence.ts.
29
+ */
30
+ export declare const WAVE_EVIDENCE_ENV = "CHANT_WAVE_EVIDENCE";
31
+ /** Where one check's pass is read from (#4926). */
32
+ export interface EvidenceSourceSpec {
33
+ /** The job's name in the run. Default: `--from-job`'s. */
34
+ job?: string;
35
+ /** The step's name in that job, as the forge lists it. Without it, the job's own result. */
36
+ step?: string;
37
+ }
38
+ /** What a check's step wrote for its signer. */
39
+ export interface CheckClaimFile {
40
+ check: string;
41
+ passed: boolean;
42
+ /** What the check said, digested into the statement's `claim`. */
43
+ claim?: string;
44
+ }
45
+ /** The file name a check's claim is kept under: `plan:dev` is `plan-dev.json`. */
46
+ export declare function checkClaimFileName(check: string): string;
47
+ /** Write a check's claim file in `dir`. Returns its path. */
48
+ export declare function writeCheckClaimFile(dir: string, file: CheckClaimFile): string;
49
+ /** A check's claim file in `dir`, or why there is none that counts. Read as data: a file for another check, or of another shape, does not count. */
50
+ export declare function readCheckClaimFile(dir: string, check: string): CheckClaimFile | {
51
+ problem: string;
52
+ };
53
+ /** The sources `CHANT_EVIDENCE_SOURCES` names, or why they do not read. A step name alone stands for `{ step }`. */
54
+ export declare function parseEvidenceSources(raw: string | undefined): {
55
+ sources: Record<string, EvidenceSourceSpec>;
56
+ } | {
57
+ problem: string;
58
+ };
59
+ //# sourceMappingURL=ci-evidence-claims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-evidence-claims.d.ts","sourceRoot":"","sources":["../src/ci-evidence-claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD,mDAAmD;AACnD,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,gDAAgD;AAChD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAK7E;AAED,oJAAoJ;AACpJ,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAWnG;AAED,oHAAoH;AACpH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAqBnI"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * The claim files a check's step leaves for a signer in another job (#4926),
3
+ * and the variable that names which step or job each check's pass is read
4
+ * from. No import beyond node's, so the wave runner and the generators carry
5
+ * it at no cost.
6
+ *
7
+ * A step that ran a check writes `<dir>/<check>.json` (`:` turned into `-`):
8
+ * the check's name, whether the step saw it pass, and what it said (the
9
+ * claim the statement digests). The step runs the change's code, so the file
10
+ * is data and never enough on its own: `chant ci evidence sign --from-job`
11
+ * signs a check only when the forge reports that step (on GitLab, that job)
12
+ * concluded `success` and the file says the check passed
13
+ * (./ci-evidence-from-job.ts).
14
+ */
15
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
16
+ import { join } from "node:path";
17
+ /**
18
+ * The variable a `--from-job` signing step reads its sources from: JSON,
19
+ * each check to the job (default `--from-job`'s) and the step whose
20
+ * conclusion stands for it. A check with no step is read from its job's
21
+ * own status, as on GitLab.
22
+ */
23
+ export const EVIDENCE_SOURCES_ENV = "CHANT_EVIDENCE_SOURCES";
24
+ /**
25
+ * What a generated wave command step signs itself (#4926), set by the
26
+ * generator beside the wave's evidence job: `plan` signs `plan:<wave>` and
27
+ * leaves `policy:<wave>` to the evidence job, which reads the policy step's
28
+ * result; `job` signs nothing and leaves both. Either way the step writes
29
+ * `plan:<wave>`'s claim file for that job. Unset, the step signs both as it
30
+ * did (#4870). See ./op/op-waves-evidence.ts.
31
+ */
32
+ export const WAVE_EVIDENCE_ENV = "CHANT_WAVE_EVIDENCE";
33
+ /** The file name a check's claim is kept under: `plan:dev` is `plan-dev.json`. */
34
+ export function checkClaimFileName(check) {
35
+ return `${check.replace(/[^A-Za-z0-9._-]/g, "-")}.json`;
36
+ }
37
+ /** Write a check's claim file in `dir`. Returns its path. */
38
+ export function writeCheckClaimFile(dir, file) {
39
+ mkdirSync(dir, { recursive: true });
40
+ const path = join(dir, checkClaimFileName(file.check));
41
+ writeFileSync(path, JSON.stringify({ check: file.check, passed: file.passed, ...(file.claim !== undefined ? { claim: file.claim } : {}) }, null, 2) + "\n");
42
+ return path;
43
+ }
44
+ /** A check's claim file in `dir`, or why there is none that counts. Read as data: a file for another check, or of another shape, does not count. */
45
+ export function readCheckClaimFile(dir, check) {
46
+ const name = checkClaimFileName(check);
47
+ let doc;
48
+ try {
49
+ doc = JSON.parse(readFileSync(join(dir, name), "utf-8"));
50
+ }
51
+ catch {
52
+ return { problem: `the job left no readable ${name}` };
53
+ }
54
+ const d = doc && typeof doc === "object" ? doc : {};
55
+ if (d.check !== check || typeof d.passed !== "boolean" || (d.claim !== undefined && typeof d.claim !== "string"))
56
+ return { problem: `${name} is not ${check}'s claim file` };
57
+ return { check, passed: d.passed, ...(typeof d.claim === "string" ? { claim: d.claim } : {}) };
58
+ }
59
+ /** The sources `CHANT_EVIDENCE_SOURCES` names, or why they do not read. A step name alone stands for `{ step }`. */
60
+ export function parseEvidenceSources(raw) {
61
+ if (raw === undefined || raw.trim() === "")
62
+ return { sources: {} };
63
+ let doc;
64
+ try {
65
+ doc = JSON.parse(raw);
66
+ }
67
+ catch (err) {
68
+ return { problem: `${EVIDENCE_SOURCES_ENV} is not JSON: ${err instanceof Error ? err.message : String(err)}` };
69
+ }
70
+ if (!doc || typeof doc !== "object" || Array.isArray(doc))
71
+ return { problem: `${EVIDENCE_SOURCES_ENV} must map each check to its job and step` };
72
+ const out = {};
73
+ for (const [check, v] of Object.entries(doc)) {
74
+ if (typeof v === "string" && v !== "")
75
+ out[check] = { step: v };
76
+ else if (v && typeof v === "object" && !Array.isArray(v)) {
77
+ const o = v;
78
+ if ((o.job !== undefined && (typeof o.job !== "string" || o.job === "")) || (o.step !== undefined && (typeof o.step !== "string" || o.step === ""))) {
79
+ return { problem: `${EVIDENCE_SOURCES_ENV}: ${check}'s job and step must be names` };
80
+ }
81
+ out[check] = { ...(typeof o.job === "string" ? { job: o.job } : {}), ...(typeof o.step === "string" ? { step: o.step } : {}) };
82
+ }
83
+ else
84
+ return { problem: `${EVIDENCE_SOURCES_ENV}: ${check} must name a step, or { job, step }` };
85
+ }
86
+ return { sources: out };
87
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Which checks a job outside the check's own may sign (#4926): `chant ci
3
+ * evidence sign --from-job <job>`, the evidence job after a wave job.
4
+ *
5
+ * The wave job runs the change's code, so whatever could sign in it could
6
+ * sign a check that never passed, and a wave that trades cloud credentials
7
+ * can request no signing token after the trade anyway. The evidence job runs
8
+ * none of that code. It reads the wave job's own record from the forge
9
+ * (./pr-forge-reads.ts `runJobs`) with the job token and signs a check only
10
+ * when:
11
+ *
12
+ * - the job it names ran in this run, for this commit: a job of another run
13
+ * or commit refuses the whole command;
14
+ * - the forge reports the check's step (GitHub, Forgejo) or job (GitLab,
15
+ * which reports no steps) finished with `success`. Change code can fail or
16
+ * pass its own steps, but it cannot make the forge report a passing policy
17
+ * step whose command failed;
18
+ * - with `claims`, the step's claim file (./ci-evidence-claims.ts) says the
19
+ * check passed. Its claim, such as the policy rows, is what the statement
20
+ * digests.
21
+ *
22
+ * Each check signed carries `source: { run, job, step }`, the ids it relied
23
+ * on, so a verifier can look them up.
24
+ */
25
+ import type { ForgeReads } from "./pr-forge-reads.js";
26
+ import { type CheckSource } from "./workspace/trust/check-evidence.js";
27
+ import { type EvidenceSourceSpec } from "./ci-evidence-claims.js";
28
+ /** What {@link checksFromJob} reads. */
29
+ export interface ChecksFromJobInput {
30
+ reads: Pick<ForgeReads, "runJobs">;
31
+ /** This run's id: `GITHUB_RUN_ID`, `CI_PIPELINE_ID`. */
32
+ run: number;
33
+ /** This run's commit: `GITHUB_SHA`, `CI_COMMIT_SHA`. */
34
+ sha: string;
35
+ /** The job the checks ran in, by name. */
36
+ fromJob: string;
37
+ checks: readonly string[];
38
+ /** Each check's job and step; a check with none is read from `fromJob`'s own result. */
39
+ sources?: Readonly<Record<string, EvidenceSourceSpec>>;
40
+ /** The directory of the jobs' claim files. Without it, a check needs only its step's success and signs no claim. */
41
+ claims?: string;
42
+ }
43
+ /** What may be signed, and what not and why. */
44
+ export type ChecksFromJob = {
45
+ sign: Array<{
46
+ check: string;
47
+ claim?: string;
48
+ source: CheckSource;
49
+ }>;
50
+ skipped: Array<{
51
+ check: string;
52
+ reason: string;
53
+ }>;
54
+ } | {
55
+ refused: string;
56
+ };
57
+ /** The checks the run's record lets this job sign (#4926), or why the job it names does not count at all. */
58
+ export declare function checksFromJob(input: ChecksFromJobInput): Promise<ChecksFromJob>;
59
+ /** What {@link signFromJob} does in a job. */
60
+ export interface SignFromJobInput {
61
+ repo: string;
62
+ /** The commit whose `.chant/trust.json` lists the runner identities. */
63
+ base: string;
64
+ fromJob: string;
65
+ checks: readonly string[];
66
+ claims?: string;
67
+ /** The commit to sign. Default: the run's commit. It must be the run's commit. */
68
+ at?: string;
69
+ reads: Pick<ForgeReads, "runJobs">;
70
+ env?: NodeJS.ProcessEnv;
71
+ /** The runner key in place of `CHANT_RUNNER_KEY`. */
72
+ key?: string;
73
+ push?: boolean;
74
+ fetch?: typeof fetch;
75
+ log?: (line: string) => void;
76
+ }
77
+ /** What {@link signFromJob} signed and skipped, or why it refused. */
78
+ export type SignFromJobResult = {
79
+ signed: Array<{
80
+ check: string;
81
+ runner: string;
82
+ commit: string;
83
+ tree: string;
84
+ source: CheckSource;
85
+ }>;
86
+ skipped: Array<{
87
+ check: string;
88
+ reason: string;
89
+ }>;
90
+ pushWarning?: string;
91
+ } | {
92
+ refused: string;
93
+ };
94
+ /**
95
+ * `chant ci evidence sign --from-job` (#4926): this run's id and commit from
96
+ * the job's environment (`GITHUB_RUN_ID` and `GITHUB_SHA` on GitHub and
97
+ * Forgejo, `CI_PIPELINE_ID` and `CI_COMMIT_SHA` on GitLab), the sources from
98
+ * `CHANT_EVIDENCE_SOURCES`, the checks {@link checksFromJob} allows, signed
99
+ * with the job's runner identity and pushed. Without a runner identity it
100
+ * signs nothing and says so, as `sign` does.
101
+ */
102
+ export declare function signFromJob(input: SignFromJobInput): Promise<SignFromJobResult>;
103
+ //# sourceMappingURL=ci-evidence-from-job.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-evidence-from-job.d.ts","sourceRoot":"","sources":["../src/ci-evidence-from-job.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAmF,KAAK,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACrJ,OAAO,EAAkE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/H,wCAAwC;AACxC,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACnC,wDAAwD;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,wDAAwD;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,wFAAwF;IACxF,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACvD,oHAAoH;IACpH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,gDAAgD;AAChD,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAC1H;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AASxB,6GAA6G;AAC7G,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC,CAmErF;AAED,8CAA8C;AAC9C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,qDAAqD;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,sEAAsE;AACtE,MAAM,MAAM,iBAAiB,GACzB;IAAE,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAChL;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAExB;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAmCrF"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Which checks a job outside the check's own may sign (#4926): `chant ci
3
+ * evidence sign --from-job <job>`, the evidence job after a wave job.
4
+ *
5
+ * The wave job runs the change's code, so whatever could sign in it could
6
+ * sign a check that never passed, and a wave that trades cloud credentials
7
+ * can request no signing token after the trade anyway. The evidence job runs
8
+ * none of that code. It reads the wave job's own record from the forge
9
+ * (./pr-forge-reads.ts `runJobs`) with the job token and signs a check only
10
+ * when:
11
+ *
12
+ * - the job it names ran in this run, for this commit: a job of another run
13
+ * or commit refuses the whole command;
14
+ * - the forge reports the check's step (GitHub, Forgejo) or job (GitLab,
15
+ * which reports no steps) finished with `success`. Change code can fail or
16
+ * pass its own steps, but it cannot make the forge report a passing policy
17
+ * step whose command failed;
18
+ * - with `claims`, the step's claim file (./ci-evidence-claims.ts) says the
19
+ * check passed. Its claim, such as the policy rows, is what the statement
20
+ * digests.
21
+ *
22
+ * Each check signed carries `source: { run, job, step }`, the ids it relied
23
+ * on, so a verifier can look them up.
24
+ */
25
+ import { commitAndTree, noRunnerIdentity, recordChecks, runnerEvidenceSigner, signChecks } from "./workspace/trust/check-evidence.js";
26
+ import { EVIDENCE_SOURCES_ENV, parseEvidenceSources, readCheckClaimFile } from "./ci-evidence-claims.js";
27
+ const SUCCESS = "success";
28
+ /** Whether the forge reports `job` passed: GitHub's and Forgejo's conclusion, GitLab's status. */
29
+ function jobPassed(job) {
30
+ return job.conclusion !== undefined ? job.conclusion === SUCCESS : job.status === SUCCESS;
31
+ }
32
+ /** The checks the run's record lets this job sign (#4926), or why the job it names does not count at all. */
33
+ export async function checksFromJob(input) {
34
+ const jobs = await input.reads.runJobs(input.run);
35
+ const found = new Map();
36
+ const jobNamed = (name) => {
37
+ const had = found.get(name);
38
+ if (had !== undefined)
39
+ return had;
40
+ const named = jobs.filter((j) => j.name === name);
41
+ let got;
42
+ if (named.length === 0)
43
+ got = `run ${input.run} has no job named ${name}`;
44
+ else if (named.length > 1)
45
+ got = `run ${input.run} has ${named.length} jobs named ${name}, so which one ran the check is not known`;
46
+ else {
47
+ const j = named[0];
48
+ if (j.run !== undefined && j.run !== input.run)
49
+ got = `job ${name} (${j.id}) belongs to run ${j.run}, not this run ${input.run}`;
50
+ else if (j.headSha === undefined)
51
+ got = `the forge names no commit for job ${name} (${j.id}), so it cannot be bound to ${input.sha.slice(0, 12)}`;
52
+ else if (j.headSha !== input.sha)
53
+ got = `job ${name} (${j.id}) ran for commit ${j.headSha.slice(0, 12)}, not this run's ${input.sha.slice(0, 12)}`;
54
+ else
55
+ got = j;
56
+ }
57
+ found.set(name, got);
58
+ return got;
59
+ };
60
+ const sign = [];
61
+ const skipped = [];
62
+ for (const check of input.checks) {
63
+ const spec = input.sources?.[check] ?? {};
64
+ const name = spec.job ?? input.fromJob;
65
+ const job = jobNamed(name);
66
+ if (typeof job === "string")
67
+ return { refused: job };
68
+ if (!job.done) {
69
+ skipped.push({ check, reason: `job ${name} has not finished (${job.status})` });
70
+ continue;
71
+ }
72
+ let step;
73
+ if (spec.step !== undefined) {
74
+ if (!job.steps) {
75
+ skipped.push({ check, reason: `the forge lists no steps for job ${name}` });
76
+ continue;
77
+ }
78
+ const s = job.steps.filter((x) => x.name === spec.step);
79
+ if (s.length !== 1) {
80
+ skipped.push({ check, reason: s.length === 0 ? `job ${name} has no step named ${JSON.stringify(spec.step)}` : `job ${name} has ${s.length} steps named ${JSON.stringify(spec.step)}` });
81
+ continue;
82
+ }
83
+ if (s[0].conclusion !== SUCCESS) {
84
+ skipped.push({ check, reason: `step ${JSON.stringify(spec.step)} of job ${name} concluded ${s[0].conclusion ?? s[0].status}` });
85
+ continue;
86
+ }
87
+ step = spec.step;
88
+ }
89
+ else if (!jobPassed(job)) {
90
+ skipped.push({ check, reason: `job ${name} ended ${job.conclusion ?? job.status}` });
91
+ continue;
92
+ }
93
+ let claim;
94
+ if (input.claims !== undefined) {
95
+ const file = readCheckClaimFile(input.claims, check);
96
+ if ("problem" in file) {
97
+ skipped.push({ check, reason: file.problem });
98
+ continue;
99
+ }
100
+ if (!file.passed) {
101
+ skipped.push({ check, reason: `job ${name}'s claim file says ${check} did not pass` });
102
+ continue;
103
+ }
104
+ claim = file.claim;
105
+ }
106
+ sign.push({ check, ...(claim !== undefined ? { claim } : {}), source: { run: input.run, job: job.id, ...(step ? { step } : {}) } });
107
+ }
108
+ return { sign, skipped };
109
+ }
110
+ /**
111
+ * `chant ci evidence sign --from-job` (#4926): this run's id and commit from
112
+ * the job's environment (`GITHUB_RUN_ID` and `GITHUB_SHA` on GitHub and
113
+ * Forgejo, `CI_PIPELINE_ID` and `CI_COMMIT_SHA` on GitLab), the sources from
114
+ * `CHANT_EVIDENCE_SOURCES`, the checks {@link checksFromJob} allows, signed
115
+ * with the job's runner identity and pushed. Without a runner identity it
116
+ * signs nothing and says so, as `sign` does.
117
+ */
118
+ export async function signFromJob(input) {
119
+ const env = input.env ?? process.env;
120
+ const log = input.log ?? ((line) => console.error(line));
121
+ const rawRun = env.GITHUB_RUN_ID ?? env.CI_PIPELINE_ID;
122
+ const sha = env.GITHUB_SHA ?? env.CI_COMMIT_SHA;
123
+ if (!rawRun || !/^\d+$/.test(rawRun) || !sha)
124
+ return { refused: "--from-job reads this run from the job's environment: GITHUB_RUN_ID and GITHUB_SHA, or CI_PIPELINE_ID and CI_COMMIT_SHA" };
125
+ let commit;
126
+ try {
127
+ commit = commitAndTree(input.repo, input.at ?? sha).commit;
128
+ }
129
+ catch {
130
+ return { refused: `${input.at ?? sha} is not a commit in this checkout; fetch the run's commit first` };
131
+ }
132
+ if (commit !== sha)
133
+ return { refused: `--at names ${commit.slice(0, 12)}, and this run is for ${sha.slice(0, 12)}; --from-job signs only the run's own commit` };
134
+ const parsed = parseEvidenceSources(env[EVIDENCE_SOURCES_ENV]);
135
+ if ("problem" in parsed)
136
+ return { refused: parsed.problem };
137
+ const decided = await checksFromJob({ reads: input.reads, run: Number(rawRun), sha, fromJob: input.fromJob, checks: input.checks, sources: parsed.sources, ...(input.claims !== undefined ? { claims: input.claims } : {}) });
138
+ if ("refused" in decided)
139
+ return decided;
140
+ for (const s of decided.skipped)
141
+ log(`ci evidence: ${s.check} not signed: ${s.reason}`);
142
+ if (decided.sign.length === 0)
143
+ return { signed: [], skipped: decided.skipped };
144
+ const signer = await runnerEvidenceSigner(input.repo, input.base, { env, ...(input.key ? { key: input.key } : {}), ...(input.fetch ? { fetch: input.fetch } : {}) });
145
+ if (!signer) {
146
+ log(`ci evidence: ${noRunnerIdentity()}, so no check was signed`);
147
+ return { signed: [], skipped: [...decided.skipped, ...decided.sign.map((s) => ({ check: s.check, reason: noRunnerIdentity() }))] };
148
+ }
149
+ const signed = await signChecks(input.repo, commit, decided.sign, signer);
150
+ const pushed = await recordChecks(input.repo, signed, { push: input.push !== false });
151
+ const bySource = new Map(decided.sign.map((s) => [s.check, s.source]));
152
+ for (const s of signed)
153
+ log(`ci evidence: signed ${s.check} at ${s.commit.slice(0, 12)} as ${s.runner}, from job ${bySource.get(s.check).job}${bySource.get(s.check).step ? ` step ${JSON.stringify(bySource.get(s.check).step)}` : ""} of run ${rawRun}`);
154
+ const warning = input.push !== false && !pushed.pushed ? pushed.pushWarning : undefined;
155
+ if (warning)
156
+ log(`ci evidence: the evidence is attached here, and the push did not land: ${warning}`);
157
+ return {
158
+ signed: signed.map((s) => ({ check: s.check, runner: s.runner, commit: s.commit, tree: s.tree, source: bySource.get(s.check) })),
159
+ skipped: decided.skipped,
160
+ ...(warning ? { pushWarning: warning } : {}),
161
+ };
162
+ }
@@ -14,29 +14,88 @@
14
14
  * before posting the note, which then says which checks were signed. The
15
15
  * key is in that one step, in a job that runs none of the change's code.
16
16
  * GitLab posts its notes from a target-branch pipeline that reads every
17
- * open merge request, so there a job of its own after each plan job
18
- * (`<plan job>-evidence`) signs from the plan job's artifact.
17
+ * open merge request, so there a job of its own in that pipeline, before
18
+ * the note job (`<plan job>-evidence`), signs from each merge request's
19
+ * plan job artifact (#4914): a merge request pipeline is built from the
20
+ * change's own files, so no job in it may hold the key. The signing job
21
+ * names the environment {@link GITLAB_EVIDENCE_ENVIRONMENT}, which the
22
+ * key's variable is scoped to, protected; the jobs that run the change
23
+ * name none, so GitLab never hands them the key.
19
24
  * - A wave job (the waves pipeline) gets the key on its `chant run wave`
20
25
  * step, and signs `plan:<wave>` and `policy:<wave>` once the wave is
21
- * planned (../op/op-waves-evidence.ts).
26
+ * planned (../op/op-waves-evidence.ts). A wave with a policy runs it as a
27
+ * step of its own and a `<wave job>-evidence` job signs `policy:<wave>`
28
+ * from that step's result; a wave that trades cloud credentials and signs
29
+ * keyless signs `plan:<wave>` there too (#4926,
30
+ * ./op/op-waves-evidence-jobs.ts).
22
31
  * - A product's check job runs `chant ci check` with the key in
23
32
  * `CHANT_RUNNER_KEY`; the check runner signs each hook (./components/check-steps.ts).
24
33
  *
25
- * The key is a stored secret today. #4869 swaps it for the job's OIDC
26
- * identity: the steps stay where they are and request a token instead.
34
+ * With `identity: "oidc"` (#4869) the same steps sign keyless from the
35
+ * job's OIDC identity: no secret, `CHANT_RUNNER_IDENTITY=oidc` on the
36
+ * signing step, and the job asks the forge for a token, so no product adds
37
+ * that itself: `id-token: write` on GitHub (Forgejo's dialect turns it into
38
+ * `enable-openid-connect: true`), and on GitLab `id_tokens:` with
39
+ * `CHANT_ID_TOKEN_SIGSTORE` for the signing audience. `.chant/trust.json`
40
+ * at base lists the workflow's identity under `keyless`.
27
41
  */
28
42
  import type { ForgeKind } from "./pr-forge.js";
29
43
  /** The variable the signing steps read the key from. */
30
44
  export declare const EVIDENCE_KEY_ENV = "CHANT_RUNNER_KEY";
31
- export { CHECK_EVIDENCE_FLOOR, LOCAL_EVIDENCE_FLOOR } from "./release-floors.js";
32
- /** A pipeline's runner identity (#4870). */
45
+ /** The variable that makes a signing step sign keyless (#4869). */
46
+ export declare const EVIDENCE_IDENTITY_ENV = "CHANT_RUNNER_IDENTITY";
47
+ /** The GitLab `id_tokens` variable a keyless signing job's token comes in (#4869). */
48
+ export declare const EVIDENCE_ID_TOKEN_VAR = "CHANT_ID_TOKEN_SIGSTORE";
49
+ /** The audience a keyless signing job's token is requested for unless told: sigstore's. */
50
+ export declare const EVIDENCE_DEFAULT_AUDIENCE = "sigstore";
51
+ export { CHECK_EVIDENCE_FLOOR, CHECK_JOB_FLOOR, GITLAB_OPEN_EVIDENCE_FLOOR, KEYLESS_EVIDENCE_FLOOR, LOCAL_EVIDENCE_FLOOR, PR_LOOP_EVIDENCE_FLOOR, REF_GATE_STATUS_JOB_FLOOR, WAVE_EVIDENCE_JOB_FLOOR } from "./release-floors.js";
52
+ /**
53
+ * The GitLab environment every signing job names (#4914), with `action:
54
+ * access`, so it creates no deployment. Scope the runner key's CI/CD
55
+ * variable to it and protect it: GitLab then hands the key only to the
56
+ * signing jobs of a protected branch's pipeline, and to none of the jobs
57
+ * that run a merge request's code.
58
+ */
59
+ export declare const GITLAB_EVIDENCE_ENVIRONMENT = "chant-evidence";
60
+ /** Where a GitLab signing job keeps what it signed for each merge request (#4914): `.chant/evidence/<job>/<iid>/evidence.json`. */
61
+ export declare function gitlabOpenEvidenceDir(job: string): string;
62
+ /**
63
+ * The lines of a GitLab signing job in the target branch's plan notes
64
+ * pipeline (#4914): `chant ci evidence sign --open` finds every open merge
65
+ * request's newest `job`, reads its report from the job's artifact at
66
+ * `dir`, fetches the head and signs it against the policy at the branch's
67
+ * commit, and keeps each merge request's `evidence.json` under `out`.
68
+ * With `noForks`, a merge request from a fork is not signed for, as a
69
+ * product plan with `forks: "skip"` plans none.
70
+ */
71
+ export declare function openEvidenceLines(opts: {
72
+ job: string;
73
+ dir: string;
74
+ out: string;
75
+ bin?: string;
76
+ noForks?: boolean;
77
+ }): string[];
78
+ /**
79
+ * A pipeline's runner identity (#4870): a runner key's secret, or (#4869)
80
+ * the job's own OIDC identity. Exactly one.
81
+ */
33
82
  export interface PipelineEvidence {
34
83
  /** The secret (GitHub, Forgejo) or CI/CD variable (GitLab) holding the runner key as PEM. */
35
- runnerKeySecret: string;
84
+ runnerKeySecret?: string;
85
+ /** `oidc` (#4869): sign keyless from the job's OIDC identity, which `.chant/trust.json` at base lists under `keyless.identities`. */
86
+ identity?: "oidc";
87
+ /** With `identity`: the token's audience, as `keyless.audience` in `.chant/trust.json` says. Default `sigstore`. */
88
+ audience?: string;
36
89
  }
37
- /** Refuse a secret name the forge could not hold. */
90
+ /** Refuse a secret name the forge could not hold, and an evidence block that names both identities or neither. */
38
91
  export declare function assertPipelineEvidence(evidence: PipelineEvidence | undefined): void;
39
- /** The signing step's key variable, from the forge's secret. */
92
+ /** Whether the pipeline signs keyless (#4869), so its signing jobs ask the forge for an OIDC token. */
93
+ export declare function evidenceKeyless(evidence: PipelineEvidence | undefined): boolean;
94
+ /** The GitLab `id_tokens:` a keyless signing job requests (#4869); empty with a runner key. */
95
+ export declare function evidenceIdTokens(evidence: PipelineEvidence | undefined): Record<string, {
96
+ aud: string;
97
+ }>;
98
+ /** The signing step's variables: the key from the forge's secret, or (#4869) `CHANT_RUNNER_IDENTITY=oidc`. */
40
99
  export declare function evidenceKeyEnv(forge: ForgeKind, evidence: PipelineEvidence): Record<string, string>;
41
100
  /**
42
101
  * The plan job's evidence step (#4870): fetch the planned commit (the note
@@ -1 +1 @@
1
- {"version":3,"file":"ci-evidence-jobs.d.ts","sourceRoot":"","sources":["../src/ci-evidence-jobs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,wDAAwD;AACxD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,4CAA4C;AAC5C,MAAM,WAAW,gBAAgB;IAC/B,6FAA6F;IAC7F,eAAe,EAAE,MAAM,CAAC;CACzB;AAID,qDAAqD;AACrD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAGnF;AAED,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEnG;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,CAMzH"}
1
+ {"version":3,"file":"ci-evidence-jobs.d.ts","sourceRoot":"","sources":["../src/ci-evidence-jobs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,wDAAwD;AACxD,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,mEAAmE;AACnE,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,sFAAsF;AACtF,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAE/D,2FAA2F;AAC3F,eAAO,MAAM,yBAAyB,aAAa,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE/N;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,mBAAmB,CAAC;AAE5D,mIAAmI;AACnI,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,EAAE,CAG5H;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6FAA6F;IAC7F,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qIAAqI;IACrI,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oHAAoH;IACpH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAID,kHAAkH;AAClH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,GAAG,IAAI,CASnF;AAED,uGAAuG;AACvG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAE/E;AAED,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAExG;AAED,8GAA8G;AAC9G,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGnG;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,CAMzH"}
@@ -14,30 +14,94 @@
14
14
  * before posting the note, which then says which checks were signed. The
15
15
  * key is in that one step, in a job that runs none of the change's code.
16
16
  * GitLab posts its notes from a target-branch pipeline that reads every
17
- * open merge request, so there a job of its own after each plan job
18
- * (`<plan job>-evidence`) signs from the plan job's artifact.
17
+ * open merge request, so there a job of its own in that pipeline, before
18
+ * the note job (`<plan job>-evidence`), signs from each merge request's
19
+ * plan job artifact (#4914): a merge request pipeline is built from the
20
+ * change's own files, so no job in it may hold the key. The signing job
21
+ * names the environment {@link GITLAB_EVIDENCE_ENVIRONMENT}, which the
22
+ * key's variable is scoped to, protected; the jobs that run the change
23
+ * name none, so GitLab never hands them the key.
19
24
  * - A wave job (the waves pipeline) gets the key on its `chant run wave`
20
25
  * step, and signs `plan:<wave>` and `policy:<wave>` once the wave is
21
- * planned (../op/op-waves-evidence.ts).
26
+ * planned (../op/op-waves-evidence.ts). A wave with a policy runs it as a
27
+ * step of its own and a `<wave job>-evidence` job signs `policy:<wave>`
28
+ * from that step's result; a wave that trades cloud credentials and signs
29
+ * keyless signs `plan:<wave>` there too (#4926,
30
+ * ./op/op-waves-evidence-jobs.ts).
22
31
  * - A product's check job runs `chant ci check` with the key in
23
32
  * `CHANT_RUNNER_KEY`; the check runner signs each hook (./components/check-steps.ts).
24
33
  *
25
- * The key is a stored secret today. #4869 swaps it for the job's OIDC
26
- * identity: the steps stay where they are and request a token instead.
34
+ * With `identity: "oidc"` (#4869) the same steps sign keyless from the
35
+ * job's OIDC identity: no secret, `CHANT_RUNNER_IDENTITY=oidc` on the
36
+ * signing step, and the job asks the forge for a token, so no product adds
37
+ * that itself: `id-token: write` on GitHub (Forgejo's dialect turns it into
38
+ * `enable-openid-connect: true`), and on GitLab `id_tokens:` with
39
+ * `CHANT_ID_TOKEN_SIGSTORE` for the signing audience. `.chant/trust.json`
40
+ * at base lists the workflow's identity under `keyless`.
27
41
  */
28
42
  /** The variable the signing steps read the key from. */
29
43
  export const EVIDENCE_KEY_ENV = "CHANT_RUNNER_KEY";
30
- export { CHECK_EVIDENCE_FLOOR, LOCAL_EVIDENCE_FLOOR } from "./release-floors.js";
44
+ /** The variable that makes a signing step sign keyless (#4869). */
45
+ export const EVIDENCE_IDENTITY_ENV = "CHANT_RUNNER_IDENTITY";
46
+ /** The GitLab `id_tokens` variable a keyless signing job's token comes in (#4869). */
47
+ export const EVIDENCE_ID_TOKEN_VAR = "CHANT_ID_TOKEN_SIGSTORE";
48
+ /** The audience a keyless signing job's token is requested for unless told: sigstore's. */
49
+ export const EVIDENCE_DEFAULT_AUDIENCE = "sigstore";
50
+ export { CHECK_EVIDENCE_FLOOR, CHECK_JOB_FLOOR, GITLAB_OPEN_EVIDENCE_FLOOR, KEYLESS_EVIDENCE_FLOOR, LOCAL_EVIDENCE_FLOOR, PR_LOOP_EVIDENCE_FLOOR, REF_GATE_STATUS_JOB_FLOOR, WAVE_EVIDENCE_JOB_FLOOR } from "./release-floors.js";
51
+ /**
52
+ * The GitLab environment every signing job names (#4914), with `action:
53
+ * access`, so it creates no deployment. Scope the runner key's CI/CD
54
+ * variable to it and protect it: GitLab then hands the key only to the
55
+ * signing jobs of a protected branch's pipeline, and to none of the jobs
56
+ * that run a merge request's code.
57
+ */
58
+ export const GITLAB_EVIDENCE_ENVIRONMENT = "chant-evidence";
59
+ /** Where a GitLab signing job keeps what it signed for each merge request (#4914): `.chant/evidence/<job>/<iid>/evidence.json`. */
60
+ export function gitlabOpenEvidenceDir(job) {
61
+ return `.chant/evidence/${job}`;
62
+ }
63
+ /**
64
+ * The lines of a GitLab signing job in the target branch's plan notes
65
+ * pipeline (#4914): `chant ci evidence sign --open` finds every open merge
66
+ * request's newest `job`, reads its report from the job's artifact at
67
+ * `dir`, fetches the head and signs it against the policy at the branch's
68
+ * commit, and keeps each merge request's `evidence.json` under `out`.
69
+ * With `noForks`, a merge request from a fork is not signed for, as a
70
+ * product plan with `forks: "skip"` plans none.
71
+ */
72
+ export function openEvidenceLines(opts) {
73
+ const chant = opts.bin ?? "chant";
74
+ return [`${chant} ci evidence sign --open --job ${opts.job} --from-report ${opts.dir} --base "$CI_COMMIT_SHA" --output ${opts.out}${opts.noForks ? " --no-forks" : ""}`];
75
+ }
31
76
  const SECRET_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
32
- /** Refuse a secret name the forge could not hold. */
77
+ /** Refuse a secret name the forge could not hold, and an evidence block that names both identities or neither. */
33
78
  export function assertPipelineEvidence(evidence) {
34
79
  if (evidence === undefined)
35
80
  return;
81
+ if (evidence.identity !== undefined) {
82
+ if (evidence.runnerKeySecret !== undefined)
83
+ throw new Error("evidence names a runnerKeySecret and an identity; a pipeline signs with one of them (#4869)");
84
+ if (evidence.identity !== "oidc")
85
+ throw new Error(`evidence.identity ${JSON.stringify(evidence.identity)} is not oidc, the one identity chant signs with keyless`);
86
+ if (evidence.audience !== undefined && !/^[\x21-\x7e]+$/.test(evidence.audience))
87
+ throw new Error(`evidence.audience ${JSON.stringify(evidence.audience)} is not printable ASCII with no space`);
88
+ return;
89
+ }
36
90
  if (!SECRET_NAME.test(evidence.runnerKeySecret ?? ""))
37
91
  throw new Error(`evidence.runnerKeySecret ${JSON.stringify(evidence.runnerKeySecret)} is not a secret name: letters, digits and _, not starting with a digit`);
38
92
  }
39
- /** The signing step's key variable, from the forge's secret. */
93
+ /** Whether the pipeline signs keyless (#4869), so its signing jobs ask the forge for an OIDC token. */
94
+ export function evidenceKeyless(evidence) {
95
+ return evidence?.identity === "oidc";
96
+ }
97
+ /** The GitLab `id_tokens:` a keyless signing job requests (#4869); empty with a runner key. */
98
+ export function evidenceIdTokens(evidence) {
99
+ return evidenceKeyless(evidence) ? { [EVIDENCE_ID_TOKEN_VAR]: { aud: evidence.audience ?? EVIDENCE_DEFAULT_AUDIENCE } } : {};
100
+ }
101
+ /** The signing step's variables: the key from the forge's secret, or (#4869) `CHANT_RUNNER_IDENTITY=oidc`. */
40
102
  export function evidenceKeyEnv(forge, evidence) {
103
+ if (evidenceKeyless(evidence))
104
+ return { [EVIDENCE_IDENTITY_ENV]: "oidc" };
41
105
  return { [EVIDENCE_KEY_ENV]: forge === "gitlab" ? `$${evidence.runnerKeySecret}` : `\${{ secrets.${evidence.runnerKeySecret} }}` };
42
106
  }
43
107
  /**