test: assert CI action pinning and token-permission contract (tests/ci-supply-chain.test.mjs) - #301
Open
kubestellar-hive[bot] wants to merge 1 commit into
Open
kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
Adds tests/ci-supply-chain.test.mjs, which parses the CI definitions under .github/ with the existing yaml devDependency and asserts the properties that keep CI's token and action surface safe: third-party actions pinned to 40-character commit SHAs with a reviewable version comment, explicit least-privilege permissions, no pull_request_target trigger, and one agreed Node major across every setup-node step. Test-only: no CI definition, production module, package.json or lockfile is touched. The suite globs the directory, so adding or removing a CI definition needs no test change. Closes #300 Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
Adds one new test-only file,
tests/ci-supply-chain.test.mjs(7 tests), covering the supply-chain and token-surface contract of the CI definitions under.github/.Files claimed by this PR:
tests/ci-supply-chain.test.mjs(new). Nothing else — no CI definition, no production module, nopackage.json, no lockfile, no new dependency (yamlis already a devDependency and is used to parse the YAML rather than regexing it). The diff is one added test file.The gap
All six CI definitions are currently correct: seven
uses:references SHA-pinned with# vXcomments,permissions:declared everywhere, nopull_request_target, Node 22 throughout. No test reads them, so none of that is held in place. A step added asuses: actions/setup-node@v4, a new job with nopermissions:block, or a drift to another Node major all passnpm run test:unittoday.What the 7 assertions cover
uses:is pinned to a 40-character commit SHA — local./actions anddocker://refs excluded, with a comment saying why.# vXcomment, so the SHA stays reviewable.GITHUB_TOKENviapermissions:at top or job level.permissions: write-all.pull_request_targettrigger.actions/setup-nodestep declaresnode-version; a${{ env.X }}reference must resolve in the same file; all files must agree on one Node major.The suite globs the directory, so #295 removing
pdf.ymlneeds no test edit. Theon:key is read through bothonandtruebecause YAML 1.1 parses it as a boolean.Disjointness
Disjoint from #278 (
tests/workflow-scripts.test.mjs), which asserts thepackage.json<->scripts/<->npm runwiring contract; it makes no assertion aboutuses:pinning,permissions:, triggers, ornode-version, and the two PRs share no file.Verification
Local clone of
cncf/endusersat00b44df, node v26.8.2:npm run test:unit: 62 pass, 0 fail (55 before; the 7 new tests are the only change).npx prettier --check tests/ci-supply-chain.test.mjs: clean.Mutation-checked — every assertion was made to fail and then reverted; the working tree is clean:
actions/setup-node@<sha>->@v4# v4.4.0commentpermissions:blockpermissions: write-allpull_request:->pull_request_target:node-version: 22->20${{ env.NODE_VERSION }}with noenv:blockjobs:keyRelated Issue
Closes #300
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5