Repository navigation
Publish from a job of its own, so pull request jobs have no write token - #233
Merged
Merged
Conversation
The build job runs pull request code and the third-party API action, and held contents, issues and packages write only because the publish steps shared it. It now reads contents and writes pull-requests for the API comment. A publish job, which runs for a push to main and for a tag only, takes the packages the build job built and validated, and holds the write permissions and the publishing secrets. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
API changes: suggested version change None✅ All good: the public API is unchanged.
Public API files✅ The committed API files match the build (6 files). |
The hand-off was verified on a pull request: the build job's packages reached the publish job in build/output, which restored the tools and generated release notes. The publish job runs for a push or a tag again. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Mpdreamz
marked this pull request as ready for review
November 25, 2026 15:49
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.
Pull request jobs no longer hold a write token or the publishing secrets: the publish steps of
ci.ymlmove into a job of their own that runs for a push to main and for a tag only.Prompt summary: After reviewing the permissions of the pull request checks in #232, the owner asked for the remaining finding to be fixed: the
buildjob ran pull request code, and a third-party action, withcontents,issuesandpackageswrite, only because the publish steps shared it. The change is its own pull request, apart from the API onboarding.Why
The
buildjob builds and tests the pull request, runs MSBuild tasks and source generators from its dependencies, and runs the assembly-differ action. It also pushed the canary and release packages, so it heldcontents,issuesandpackageswrite for every run, including pull requests from branches of this repository. A compromised dependency or action in that job could write to the repository's releases and packages.What
A publish job
publishhasneeds: buildandif: github.event_name == 'push'. It holdscontents,issuesandpackageswrite, and is the only job that namesFEEDZ_IO_API_KEY,NUGET_ORG_API_KEYor the token for the release. It checks out the same commit, fetches the tags, restores the tools, and runs the same push steps with the same conditions as before: canary packages to GitHub Packages and feedz.io for a push to a branch; release notes, the GitHub release and nuget.org for a tag.What it publishes
The
buildjob already built, tested and validated the packages. On a push it uploadsbuild/output/*.nupkgas an artifact that expires after a day, andpublishdownloads it intobuild/output. The packages that are pushed are the ones that were tested, not a rebuild.Build job permissions
buildnow hascontents: readandpull-requests: write, the comment and labels of the API step.zizmorfinds nothing about permissions or secrets inci.yml; the remaining findings are theactions/*tags that policy allows and three trusted-publishing notes.Risk: the publish steps only run for a push to main and for a tag, so a pull request cannot run them. I ran the hand-off on this pull request with a temporary commit, since reverted: both
.nupkgfiles reachedbuild/outputin thepublishjob, which restored the tools and generated release notes. The pushes themselves first run when this merges, as canary packages from main, and the release steps with the next tag. A failed canary run only needs a rerun.Stack: 2 of 2, on top of #232; retarget it to
mainonce that merges.Verify
In the run of this pull request, the
buildjob's "GITHUB_TOKEN Permissions" showContents: readandPullRequests: write, and thepublishjob does not run.🤖 Generated with Claude Code