Repository navigation
fix: add permissions for reusable publish-preview workflow - #8235
Merged
Merged
Conversation
GuillaumeRx
approved these changes
Mar 18, 2026
This was referenced Oct 26, 2026
Merged
gaohan1994
pushed a commit
to gaohan1994/core
that referenced
this pull request
Oct 27, 2026
…ask#11091) <!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Explanation `@metamaskbot publish-preview` calls the shared `MetaMask/github-tools` preview workflow. That workflow checks out the repository and comments on the pull request, so the caller has to grant `contents: read` and `pull-requests: write`. The org token is read-only by default, which is why [MetaMask#8235](MetaMask#8235) added both permissions on this workflow. zizmor reports workflow-level `pull-requests: write` as overly broad ([code scanning alert 206](https://github.com/MetaMask/core/security/code-scanning/206)). A job-level `permissions` block replaces the workflow set rather than adding to it, so this keeps `contents: read` on the workflow and on the `publish-preview` job, and moves `pull-requests: write` onto that job only. The shared workflow is unchanged. The same finding showed up on [MetaMask/metamask-design-system#1620](MetaMask/metamask-design-system#1620). That change adopted this shared caller to fix a preview-token code scanning alert, and zizmor then flagged `pull-requests: write` on the workflow. This applies that permissions fix to the core caller. ## References * https://github.com/MetaMask/core/security/code-scanning/206 * MetaMask/metamask-design-system#1620 * MetaMask#8235 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-b46f099e-f000-4c02-a647-6cd765c63abf?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-b46f099e-f000-4c02-a647-6cd765c63abf&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > CI permission scoping only; no application or secrets logic changes, with the same effective permissions on the job that runs the preview workflow. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7c4a5b1. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.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.
Explanation
The reusable
publish-previewworkflow fromgithub-toolsrequirescontents: read(checkout) andpull-requests: write(PR comment). MetaMask's org restricts default token permissions to read-only, so these must be explicitly declared by the caller.References
Checklist
Note
Low Risk
Low risk: only updates workflow permissions, with no product code or runtime logic changes.
Overview
Ensures the reusable
publish-previewGitHub Actions workflow can run under restricted org defaults by explicitly grantingcontents: read(checkout) andpull-requests: write(PR commenting) permissions.Written by Cursor Bugbot for commit cd67686. This will update automatically on new commits. Configure here.