Repository navigation
Fix CodeQL alerts: release jobs never check out a computed ref - #14
Merged
Merged
Conversation
… alerts) CodeQL flagged three steps in release.yml (actions/cache-poisoning/ poisonable-step): the build jobs checked out a commit taken from the prepare job's output, which CodeQL treats as possibly untrusted code running with default-branch privileges. The output existed only for a run that bumps the version and then had to build the new commit. That run now commits the bump, pushes it, and starts a fresh Release run on the default branch (a manual dispatch is allowed for the built-in token), which builds and publishes the commit it started on. Every job now checks out its own run's commit; the release targets github.sha. A local CodeQL 2.27.6 scan of the workflows reports 0 results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xj9ekcxX6iwfrVxah4Jejo
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.
What
Fixes the open code scanning alerts from CodeQL default setup.
actions/cache-poisoning/poisonable-stepinrelease.ymlI counted these by running the same CodeQL release (2.27.6) and default
*-code-scanningsuites locally onmain. This session can't read the alert list on GitHub.The issue
The release build jobs checked out
ref: ${{ needs.prepare.outputs.sha }}. CodeQL can't prove that value is trusted, so it treats it as code that could run with default-branch privileges and write to the Actions cache. In practice only maintainers can start a release, but the pattern is avoidable.The fix
That output existed only for the "bump from the website" run, which committed a version bump and then had to build that new commit. Now that run:
gh workflow run(the built-in token may trigger manual dispatches), then stops.The new run builds, tags and publishes the commit it started on. Every job checks out its own run's commit, and the release targets
github.sha. Nothing changes for you: releasing from the Actions tab or by merging a version bump works the same.docs/releasing.mddescribes the two-run flow.Testing
main, unreleased → release;main, released → nothing;main, unreleased (the second run after a bump) → release;main, released → dry run;Once merged, GitHub's next CodeQL run should close the three alerts.
Generated by Claude Code