Repository navigation
Add immutable-ref CI guard for images and actions - #5
Merged
Merged
Conversation
Add scripts/check_immutable_refs.py and a "Pinned refs" workflow so any future Dockerfile image must be pinned by digest and any GitHub Action by full commit sha (tags are mutable, which is how tag-rewrite supply-chain attacks land). The repo has no Dockerfiles or external actions today, so there is nothing to pin yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wtx3dU8PQvgyubf6ZpNaG3
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
- Guard v5: a blank line clears a pin-exempt marker, blank lines inside a continuation are skipped, continuations join like Docker, "# escape=" is honoured, action.yml runs.image is exempt only for a Dockerfile path, flow-style and "uses :" YAML keys are parsed, every ref on a line is checked, and uses: must be owner/repo[/path]@<40-hex>. - Pinned refs workflow runs the base branch copy of the checker on pull requests; the workflow file itself needs CODEOWNERS or a ruleset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wtx3dU8PQvgyubf6ZpNaG3
…blowup
- An anchor or tag before a block key (`- &step uses: x`, `- !!str uses: x`,
`{ &k uses: x }`) no longer hides the key from the check.
- Verbatim tags with commas (`!<tag:yaml.org,2002:seq> [...]`) now open a
flow collection.
- Each node property must end at whitespace or a bracket, so a run like
`&&&&x` has one split instead of exponentially many (the old pattern hung
on 30 characters).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wtx3dU8PQvgyubf6ZpNaG3
`!<[^>]*>` ran to the end of the line from every comma when the tag was never closed, so a flow line of repeated `,!<` was quadratic (32k repeats took 8s). YAML verbatim tags hold URI characters only, so the tag now stops at whitespace or another `<`; the same line takes 0.04s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wtx3dU8PQvgyubf6ZpNaG3
`bun-version: &v latest` (and `&v` with `latest` on the next line) slipped past the `latest` check because the value was taken to be `&v`, and `uses: &pin owner/repo@<sha>` was wrongly rejected for the same reason. Node properties after the colon are now skipped before the value is read, on the key's own line and on the line below it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wtx3dU8PQvgyubf6ZpNaG3
`container: &c` followed by `{ image: <pinned> }` on the next line was
read as a scalar image and rejected. A continuation that opens a `{` or
`[` collection is now left to the per-line flow scanner, which already
checks the keys inside it, so a mutable image there is still flagged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wtx3dU8PQvgyubf6ZpNaG3
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.
Summary
Adds a CI guard (scripts/check_immutable_refs.py + a Pinned refs workflow) that fails on tag-only or :latest Dockerfile images and on any GitHub Action not pinned by full commit sha. The repo has no Dockerfiles or external actions today, so there is nothing to pin yet; the guard keeps future additions immutable.
Changes
scripts/check_immutable_refs.py: requires any future Dockerfile image to be pinned by digest and any GitHub Action by full commit sha (tags are mutable, which is how tag-rewrite supply-chain attacks land).Testing
python3 scripts/check_immutable_refs.pyexits 0make ci(not applicable: there is no Makefile)Generated by Claude Code