Skip to content

test: gate action SHA pins, permissions, persist-credentials and job timeouts in CI YAML - #192

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-workflow-hardening
Oct 15, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-workflow-hardening

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds scripts/workflow-hardening.test.mjs, a zero-dependency static gate over every .github/workflows/*.yml, plus its ## Checks entry in README (required by ci-wiring.test.mjs). No file under .github/workflows/ is touched: the existing node --test scripts/*.test.mjs glob picks the gate up.

Rules, each with a fixture self-test:

  1. Every uses: is owner/repo[/path]@<40-hex SHA> with a trailing # <version> comment — the reusable uses: in close-linked-issues.yml included. ./ local actions are exempt; docker:// images must carry an @sha256: digest.
  2. A top-level permissions: block exists; neither it nor any job grants write-all (job-level scoped writes, as scorecard.yml does, are the intended escalation path and pass).
  3. Every actions/checkout step sets with: persist-credentials: false — credited only when it is inside the checkout step, not a neighbouring one.
  4. Every job with runs-on sets timeout-minutes; jobs that call a reusable YAML (which cannot) are exempt.
  5. No YAML files / no uses: lines / no jobs: block is reported rather than passing vacuously.

Mutation-checked against the live tree: re-pinning scorecard.yml's checkout to @v7 fails the gate with scorecard.yml:25 uses actions/checkout@v7 — @v7 is not a 40-hex commit SHA …; the committed files pass. Full suite: 594 passing (was 579), plus check-links.test.sh, check-redirects.test.sh and check-redirects.sh green.

Closes #191


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…ials, timeouts)

Add scripts/workflow-hardening.test.mjs, a zero-dependency static gate over
every .github/workflows/*.yml: each uses: must be pinned to a 40-hex commit
SHA with a trailing # <version> comment (./ local actions exempt, docker://
images by sha256 digest, reusable-workflow uses: included); a top-level
permissions: block must exist and nothing may grant write-all; every
actions/checkout step must set persist-credentials: false; and every job with
runs-on must set timeout-minutes. Each rule has a fixture self-test and the
suite reports instead of passing vacuously when no workflow or no uses: line
is found. The existing node --test scripts/*.test.mjs glob picks it up, so no
workflow edit is needed; README ## Checks lists the gate as ci-wiring requires.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@hive.kubestellar.io>
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Another agent tried to open a PR from scanner/fix-191, but this PR already closes #191. No second PR was opened; please continue here, or rebase the new work onto this branch.

@hivecommons-hive
hivecommons-hive Bot merged commit 0397beb into main Oct 15, 2026
6 of 7 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-workflow-hardening branch October 15, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] Gate workflow hardening (SHA pins, permissions, persist-credentials, timeouts) in CI

0 participants