Potential fix for code scanning alert no. 78: Workflow does not contain permissions#370
Open
poopoothegorilla wants to merge 1 commit intodevelopfrom
Open
Potential fix for code scanning alert no. 78: Workflow does not contain permissions#370poopoothegorilla wants to merge 1 commit intodevelopfrom
poopoothegorilla wants to merge 1 commit intodevelopfrom
Conversation
…in permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Contributor
✅ API Diff Results - No breaking changes |
chainchad
reviewed
Feb 25, 2026
Comment on lines
5
to
11
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build-test-matrix: | ||
| runs-on: ubuntu-latest | ||
|
|
Contributor
There was a problem hiding this comment.
Suggested change
| permissions: {} | |
| jobs: | |
| build-test-matrix: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read |
For PoLP, would always suggest blanking out perms on the workload level and setting just the permissions on each job individually. If you do this, make sure you give it to each job.
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/smartcontractkit/chainlink-evm/security/code-scanning/78
To fix the issue, we should explicitly restrict
GITHUB_TOKENpermissions in this workflow. Since none of the jobs perform repository writes via the API or push commits, they can safely run with read‑only repository contents permissions. The recommended pattern is to add apermissions:block at the top level of the workflow so it applies to all jobs (build-test-matrix,build-test, andcheck-tidy), unless a job overrides it.The single best fix is to add:
near the top of
.github/workflows/build-test.yml, alongsidename:andon:. This documents the intent and ensures the token stays limited even if organization defaults change. No other code or steps need to be modified, and no additional permissions (likepull-requests: write) are necessary based on the provided snippet.Concretely:
.github/workflows/build-test.yml.permissions:block after theon:declaration (line 3–4 area).No imports or additional methods are required; this is purely a configuration change in the workflow YAML.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.