Repository navigation
pin-github-actions: check pins by parsing YAML, and fail closed on aliases - #4
Merged
Merged
Conversation
…iases The bundled check_pins.py matched uses: lines, so flow-style steps, quoted keys, multi-line refs and refs behind YAML aliases or merge keys passed unpinned.
GitHub enforces it while reading the workflow itself, so no YAML form gets past it. The repo check stays for pull-request feedback where no admin can turn the policy on.
added 2 commits
November 13, 2026 08:35
A repo without Node fell through to 'use zizmor', which an agent treated as a new tool and skipped, so no check was added. Runners have Node; install yaml in the step.
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.
The bundled
check_pins.pymatcheduses:lines with a regex, so valid YAML could carry an unpinned action past it. This replaces it withcheck-action-pins.mjs, which parses the YAML.Expected vs actual
Expected: any
usesthat GitHub will run, and that isn't a full SHA (or an image digest fordocker://), fails the check.Actual with
check_pins.py, each of these passed:On this file,
check_pins.pyreported one finding,>-, as if it were the ref, and caught none of the six.check-action-pins.mjsreports all six. It also stops flagginguses:text insiderun:scripts.The change
scripts/check-action-pins.mjsparses each workflow andaction.ymlwithyaml, and readsusesonly where GitHub does:jobs.<id>.uses,jobs.<id>.steps[].usesandruns.steps[].uses.jobsorruns, an alias, a merge key or a non-stringusesfails the check instead of being expanded. Expanding them only works if our parser expands them exactly as GitHub's does, and a mismatch is a bypass.scripts/check-action-pins.test.mjshas 13 tests usingnode:test, covering each form above plus reusable workflows,docker://digests and composite actions.yamlcomes from the repo's dev dependencies, or is installed in the CI step when there's nopackage.json; GitHub-hosted runners include Node.yaml@2.9.1installed using--ignore-scripts, plus the tests.Trade-off: the checker is no longer standard-library-only. A YAML parser is the minimum needed to read
usesthe way GitHub does.Checks
examples/pin-a-workflow.md, the old and new checkers report the same four refs, and both skip the local./action.node --test: 13 passed.npx skills@1.7.6 add . --listlists both skills. Installed copies for Claude Code and Codex match the source.yaml. The check failed before pinning and passed after. Recorded inexamples/pin-a-workflow.md.Rollback is a revert of this PR.