Repository navigation
ci: keep the release-notes write token away from PR-supplied code - #435
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 879c050. Configure here.
Step-level token isolation (PR #435) does not hold within one job: the untrusted step runs lockfile-provided binaries (npm ci install scripts, npm exec, node) that inherit GITHUB_OUTPUT and can rewrite GITHUB_PATH/GITHUB_ENV, so a hijacked dependency could forge the path/b64 outputs or capture the write token via the trusted step's gh execution and push arbitrary files. Split the release-notes job instead: - release-notes (untrusted, contents: read) runs npm ci / npm exec / node, then uploads the changeset via artifact and exports only a boolean flag. - release-notes-commit (trusted, contents: write) runs on a fresh runner, so PATH/ENV tampering from the untrusted job is gone. It recomputes the commit path from PR context and PUTs the downloaded artifact with gh. Addresses Bugbot finding 01d7c393 on PR #435. Co-authored-by: Cursor <cursoragent@cursor.com>
chaitanyapotti
approved these changes
Dec 3, 2026
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.

Motivation and Context
The
release-notesjob grantscontents: write. Its checkout already setpersist-credentials: false, but theCheck release notesstep still carriedGH_TOKENin its environment while running PR-lockfile-provided binaries — the same exposure Cursor Bugbot flagged in torusresearch/loglevel-sentry#52 and fixed in torusresearch/loglevel-sentry#63:npm exec -- changeset statusandnode(binaries installed from the PR's lockfile) withGH_TOKENin its environment, so a hijacked dependency in a PR lockfile could read the job's write token and push anywhere in the repository, bypassing the read-only token GitHub normally enforces for Dependabot workflows.Jira Link
Description
Ports the step-split half of torusresearch/loglevel-sentry#63:
Check release notesstep (id: changeset) now runs every lockfile-provided binary (npm ci,npm exec,node) without any token in its environment. The existing waive/auto-create/fail logic is kept verbatim, and when the changeset must be auto-created the step exports the file path and its base64 content via step outputs.Commit changesetstep holdsGH_TOKENand runs nothing fromnode_modules— onlyghand shell — performing the same Contents-API GET/PUT as before (re-run safe via the existingshalookup).release-notes), and all three outcomes (waive dev-deps, auto-create patch changeset forchore(deps), fail human PRs without a changeset) are unchanged.npm exec/nodeGH_TOKEN)gh+ shell onlyNote
Medium Risk
Touches a job with
contents: writeand Dependabot auto-changeset behavior; a mistake in the step split could break commits or still leak the token.Overview
Hardens the
release-notesjob so thecontents: writetoken is never exposed to code from the PR lockfile.The
Check release notesstep (id: changeset) no longer setsGH_TOKEN. It still runs waive/auto-create/fail logic vianpm ci,npm exec, andnode, and when it auto-creates a Dependabot patch changeset it writespathand base64b64to step outputs instead of calling the Contents API inline.A new
Commit changesetstep runs only when those outputs are set, setsGH_TOKEN, and usesghplus shell to perform the same GET/PUT Contents-API commit (including re-run-safeshahandling). Comments document which steps are trusted vs untrusted.Reviewed by Cursor Bugbot for commit 879c050. Configure here.