Potential fix for code scanning alert no. 36: Workflow does not contain permissions#2380
Open
dscpinheiro wants to merge 1 commit into
Open
Potential fix for code scanning alert no. 36: Workflow does not contain permissions#2380dscpinheiro wants to merge 1 commit into
dscpinheiro wants to merge 1 commit into
Conversation
…in permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds explicit GitHub Actions token permissions to the PR change-file validation workflow to reduce inherited default permissions.
Changes:
- Adds a top-level
permissionsblock to.github/workflows/change-file-in-pr.yml. - Grants
contents: readfor checkout and repository content access.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| types: [opened, synchronize, reopened, labeled] | ||
|
|
||
| permissions: | ||
| contents: read |
Contributor
Author
There was a problem hiding this comment.
Not sure this is accurate... The action ran successfully: https://github.com/aws/aws-lambda-dotnet/actions/runs/25923334173/job/76197870515
(The failure is because my branch doesn't have a change file, but seems to be working as expected)
Contributor
|
similar to this pr #2368 i didnt realize there was an issue |
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/aws/aws-lambda-dotnet/security/code-scanning/36
Add an explicit top-level
permissionsblock in.github/workflows/change-file-in-pr.ymlso the workflow does not inherit potentially broad defaults.Best fix without changing functionality: set:
contents: readThis is sufficient for the displayed steps (
actions/checkout, reading changed files, and shell checks) and aligns with CodeQL’s minimal recommendation.Change location: near the top of the workflow, after the
on:trigger block and beforejobs:.No imports, methods, or external dependencies are needed.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.