Potential fix for code scanning alert no. 29: Workflow does not contain permissions#1484
Closed
rocketstack-matt wants to merge 1 commit intomainfrom
Closed
Potential fix for code scanning alert no. 29: Workflow does not contain permissions#1484rocketstack-matt wants to merge 1 commit intomainfrom
rocketstack-matt wants to merge 1 commit intomainfrom
Conversation
…in permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a security code scanning alert by adding explicit permissions to a GitHub Actions workflow. The change restricts the GITHUB_TOKEN to only have read access to repository contents, following the principle of least privilege.
Key Changes
- Added minimal permissions block to workflow file to address security vulnerability
| @@ -1,4 +1,6 @@ | |||
| name: Build Calm Hub For Unit Test Coverage | |||
| permissions: | |||
There was a problem hiding this comment.
[nitpick] The permissions block should be placed after the 'name' field but before the 'on' field for better organization and clarity. Consider adding a blank line before the permissions block to improve readability.
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/finos/architecture-as-code/security/code-scanning/29
To fix the problem, add a
permissionsblock to the workflow file to explicitly set the minimal required permissions for theGITHUB_TOKEN. Since the workflow only needs to read repository contents, setcontents: readat the top level of the workflow (just after thename:line and beforeon:). This will apply the restriction to all jobs in the workflow. No other changes are needed, as none of the steps require additional permissions.Suggested fixes powered by Copilot Autofix. Review carefully before merging.