Repository navigation
ci: verify the release tag before its scripts - #447
Merged
Merged
Conversation
Split the step "Check release tag and commit" as in Pubgrade-Sidecar: the tag checks (annotated, signature verified by GitHub, commit on `main`) run first, in a step (id `commit`) that runs no code of the tagged commit; `scripts/release_version.py` then runs in the new step "Derive release version" (id `version`), without `GH_TOKEN`. The job output `sha` and the CI check read `steps.commit.outputs.sha`. A test checks the order and the wiring: only the checkout and Python setup come before the tag check. Closes #446 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assert the exact steps before the tag check and that the check runs no Python or file of the commit; let other steps sit between the check and the version step. Raised by the pre-push review. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe release workflow now verifies the annotated, GitHub-signed tag and its Sequence diagram for release tag verification before version derivationsequenceDiagram
participant Workflow as Release workflow
participant Git as Git repository
participant GitHub as GitHub API
participant Script as release_version.py
Workflow->>Git: git cat-file
Workflow->>GitHub: gh api signature verification
Workflow->>Git: git merge-base --is-ancestor
Git-->>Workflow: verified commit SHA
Workflow->>Script: python scripts/release_version.py outputs TAG
Script-->>Workflow: version, prerelease, chart_version
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Assert that the tag check runs the signature check and the version step runs `scripts/release_version.py`, that the job has no `GH_TOKEN`, and say why Python setup may only get a fixed version. Raised by the pre-push review. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #447 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 24 24
Lines 2685 2685
=========================================
Hits 2685 2685 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
uniqueg
marked this pull request as ready for review
November 6, 2026 06:38
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_workflows.py" line_range="300" />
<code_context>
+ check = steps["Check release tag and commit"]
+ assert check["id"] == "commit"
+ assert "GH_TOKEN" in check["env"]
+ assert ".verification.verified" in check["run"]
+ # Neither scripts nor Python nor other files of the commit
+ for code in ("scripts/", "python", "./"):
</code_context>
<issue_to_address>
**Unverified tags pass the test**
When the verification marker appears in the run text without an effective signature check, when the tag-verification API call and its result check are removed but `.verification.verified` remains in a comment, `test_release_tag_checked_first` passes line 300 without verifying the tag signature.
Assert the API call and the condition that rejects an unverified response, or execute the step logic in a test.
</issue_to_address>Linked issues
#446 ci: verify the release tag before running its scripts · 3 of 3 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Run the annotated-tag, verified-signature, and commit-on-main checks without executing code from the tagged commit. | ✅ Met | The commit step performs all three checks before Derive release version runs any tagged script. |
| 2 | Run tagged scripts only after the checks, in steps without tokens they do not need. | ✅ Met | Derive release version runs after the checks and has no GH_TOKEN; the job has no job-level token. |
| 3 | Keep the workflow header comment and docs/development.md consistent, if they describe the steps. |
✅ Met | Both describe the checks without specifying their order, so they remain consistent with the workflow. |
Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: tests/test_workflows.py:300
Take the step names from the list of steps, not from a dict keyed by name, so that a second step named "Check release tag and commit" can't hide before the real one. Raised by Sourcery. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
Splits the release workflow's step "Check release tag and commit" the way Pubgrade-Sidecar does:
commit) runs first. It checks that the tag is annotated, that GitHub verified its signature and that the commit is onmain, and outputssha. It runs no code of the tagged commit.version) then runsscripts/release_version.py outputs, withoutGH_TOKEN.shaand the step "Check that CI passed for the release commit" now readsteps.commit.outputs.sha. Allsteps.version.outputs.*references (version,prerelease,chart_version) are unchanged.test_release_tag_checked_first, checks the step order and wiring:scripts/release_version.pywithout the token (none at job level either).The header comment and
docs/development.mddescribe the checks but not their order, so they still match and are unchanged.Closes #446
Verification
pytest tests/test_workflows.py: the new test fails ondevand passes on this branch (69 passed).pre-commit run --all-files(includes actionlint, ruff, mypy, semgrep, gitleaks, ast-grep): passed.CI passedgreen; image push/publish, Trivy upload and integration jobs skipped on pull requests as intended).Declined review findings
preparethat holdsGH_TOKEN("Check that CI passed for the release commit"), so a script could in principle tamper with$GITHUB_PATH/$GITHUB_ENV. This was already the case before this change. By then the tag is signed and its commit is onmain, so the code is trusted. Moving the CI check would go beyond the reorder that ci: verify the release tag before running its scripts #446 asks for, and Pubgrade-Sidecar has the same order.docs/development.mddon't say that the tag checks run first. Neither describes the order of the steps, and the step comment documents it where the code is.🤖 Generated with Claude Code
Summary by Sourcery
Verify release tags before running release-version scripts to prevent untrusted tagged code from executing prematurely.
Bug Fixes:
Enhancements:
Tests: