ci: declare minimum permissions on CodeQL workflow#1041
Open
arpitjain099 wants to merge 1 commit into
Open
Conversation
labianchin
approved these changes
Jun 5, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1041 +/- ##
=========================================
Coverage 91.92% 91.92%
Complexity 283 283
=========================================
Files 27 27
Lines 1015 1015
Branches 86 86
=========================================
Hits 933 933
Misses 54 54
Partials 28 28 🚀 New features to boost your workflow:
|
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
7967a1e to
8dd5ab0
Compare
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.
Currently
.github/workflows/codeql-analysis.ymlcarries nopermissionsblock, so the analyze run inherits whatever the repo or org defaultGITHUB_TOKENscope is set to. This PR declares the three scopes the workflow actually needs at the top level:actions: read,contents: read, andsecurity-events: writefor the SARIF upload step. It is the same shape the current GitHub CodeQL starter template recommends.The reason to nail this down explicitly even when the inherited default may already be reasonable is the supply-chain threat surfaced by CVE-2025-30066 (the March 2025
tj-actions/changed-filescompromise): a tampered third-party action can readGITHUB_TOKENout of the runner and the blast radius is whatever scope the token carries. Pinning the workflow scope caps the runtime authority of every action that runs inside it, gives drift protection if the org default ever widens, and is what OpenSSF Scorecard's Token-Permissions check actually credits.YAML validated locally with
yaml.safe_load.