Skip to content

Fix CodeQL alerts: release jobs never check out a computed ref - #14

Merged
Amet13 merged 1 commit into
mainfrom
claude/jolly-euler-otjl5h
Nov 26, 2026
Merged

Amet13 merged 1 commit into
mainfrom
claude/jolly-euler-otjl5h

Conversation

@Amet13

@Amet13 Amet13 commented Nov 26, 2026

Copy link
Copy Markdown
Owner

What

Fixes the open code scanning alerts from CodeQL default setup.

Language Alerts After this PR
GitHub Actions 3 × actions/cache-poisoning/poisonable-step in release.yml 0
Python 0 0
JavaScript/TypeScript 0 0
Rust 0 0

I counted these by running the same CodeQL release (2.27.6) and default *-code-scanning suites locally on main. 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:

  1. bumps and commits as before, and pushes to the default branch;
  2. starts a fresh Release run on the default branch with 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.md describes the two-run flow.

Testing

  • Local CodeQL scan of the changed workflows: 0 results, down from 3.
  • The release decision logic was re-run for every case:
    • push to main, unreleased → release;
    • push to main, released → nothing;
    • manual run on main, unreleased (the second run after a bump) → release;
    • manual run on main, released → dry run;
    • manual run on another branch → dry run.
  • The workflow YAML parses.

Once merged, GitHub's next CodeQL run should close the three alerts.


Generated by Claude Code

… 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
@Amet13
Amet13 merged commit fba95d5 into main Nov 26, 2026
17 checks passed
@Amet13
Amet13 deleted the claude/jolly-euler-otjl5h branch November 26, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants