Potential fix for code scanning alert no. 13: Workflow does not contain permissions#867
Merged
Potential fix for code scanning alert no. 13: Workflow does not contain permissions#867
Conversation
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds explicit minimal GITHUB_TOKEN permissions to the update-api-list GitHub Actions job to satisfy code scanning/security requirements without changing job behavior. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
…in permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
413d66d to
3b9f1ea
Compare
Dargon789
pushed a commit
that referenced
this pull request
Mar 6, 2026
chore: teeny request migration
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.
Potential fix for https://github.com/Dargon789/google-cloud-node/security/code-scanning/13
In general, the fix is to add an explicit
permissions:block to the workflow or to the specific job, granting only the scopes required for the job’s operations. This constrains theGITHUB_TOKENto the minimal privileges needed and documents those needs.For this specific workflow, the
update-api-listjob needs to be able to create/update branches and open pull requests viagoogleapis/code-suggester@v5. That requires write permission to repository contents and pull requests. The earlier steps (checkout, setup-node,npm install,npm run generate) only need read access to repository contents (and whatever the custom script does withGITHUB_TOKEN, which is typically repo-level). A minimal and functional permission set at the job level is therefore:You should add this block under
update-api-list:and aboveruns-on:in.github/workflows/update-api-list.yaml. No additional imports or methods are required; this is purely a YAML configuration change and does not alter the functional behavior of the job, other than constraining token permissions.Suggested fixes powered by Copilot Autofix. Review carefully before merging.
Summary by Sourcery
CI: