Keep the write token out of the build - #96
Open
madonoharu wants to merge 1 commit into
Open
Conversation
The expand job resolved dependencies and ran build scripts with contents/pull-requests/issues write in scope, and with the checkout credentials still on disk. Split it: expand is read-only and hands the snapshot diff over as an artifact, open-pr holds the write permissions but builds nothing, and track only touches issues. The bot branch is now cut from the target branch each run rather than reused, so a stale run cannot resurrect an old snapshot. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
The expand job resolved dependencies and ran build scripts while holding
contents,pull-requestsandissueswrite, with the checkout credentials still on disk. Any build script in the dependency tree could have used them.Split into three jobs so the write token is never in scope while arbitrary code runs:
contents: read,persist-credentials: false. Regenerates the snapshots and hands the diff over as an artifact.contents: write,pull-requests: write, and builds nothing. Applies the patch, pushes, opens the PR.issues: writeonly. Closes or files the tracking issue based onneeds.*.result.Workflow-level
permissions: {}so a job that forgets to declare them gets nothing.While in there: the bot branch is now cut fresh from the target branch each run instead of being reset onto whatever it held, so a stale run can't resurrect an old snapshot.
Verified end to end
Ran it against a throwaway branch with a sentinel line added to
borrow.expanded.rs, the same way #88 was verified. All three jobs passed, and the PR it opened contained exactly the sentinel removal, titledUpdate expanded test artifacts for wasm-bindgen 0.2.127, assigned and labelled. That PR and branch are cleaned up.The no-op path is the one the nightly run takes normally:
expandreportschanged=false,open-pris skipped, andtrackstill closes the tracking issue —needs.open-pr.resultisskipped, which the close condition treats as not-a-failure.🤖 Generated with Claude Code