Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is already the default so why do we need to explicitly set it here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevalmorabia97 you're right that the effective scope may already be contents: read on this repo today if the default token scope is set to the restrictive value. The reasons to declare it explicitly anyway:

  1. It documents the actual scope this workflow needs, so a reviewer does not have to check repo-level token settings to know.
  2. It survives repo-default changes. If the default is ever flipped back to permissive (the legacy default which grants contents: write across the board), every workflow that did not explicitly cap stays permissive too.
  3. It matches the in-repo convention: 12 of the 13 sibling workflows in .github/workflows/ already declare permissions: explicitly (bandit.yml, build-docs.yml, ci.yml, etc.); this PR brings the lone remaining one in line.

Defense-in-depth precedent: the tj-actions/changed-files supply-chain attack (CVE-2025-30066, March 2025) showed how an over-scoped GITHUB_TOKEN exfiltrates credentials when a third-party action is compromised. Pinning per workflow caps the blast radius regardless of what the repo default is at any given moment.

Happy to close if you'd prefer to rely on the default.

contents: read

jobs:
code-quality:
runs-on: ubuntu-latest
Expand Down