Potential fix for code scanning alert no. 5: Workflow does not contain permissions #51
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/edgee-cloud/amplitude-component/security/code-scanning/5
To fix the problem, we should explicitly restrict
GITHUB_TOKENpermissions for thecoveragejob so it does not inherit broad repository defaults. The minimal safe starting point recommended by CodeQL iscontents: read, and we only need to elevate further if some step in the job actually requires more. The steps incoverageonly check out code, install tooling, run tests/coverage, and call the Coveralls action. These operations typically require only read access to the repository contents; they do not push commits, create releases, or modify issues/PRs.The best targeted fix without changing functionality is:
permissions:block under thecoveragejob withcontents: read.clippyjob already has its ownpermissionsblock; the others can safely inherit any future workflow-level default or be tightened separately later).Concretely, in
.github/workflows/check.yml, undercoverage:(around line 83), insert:No new imports or external dependencies are needed; it is purely a YAML configuration change.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.