chore: apply least privilege permissions to github actions

Merged
YA
4mo ago
+57-0

Proposed changes (including videos or screenshots)

This PR applies the principle of least privilege to GITHUB_TOKEN permissions across all GitHub Actions workflows by setting permissions: {} globally and explicitly re-granting only the minimum permissions required per job, as part of a supply chain security hardening effort.

Workflows relied on GitHub’s default token scopes, which may grant more access than most jobs actually need. Scoping permissions at the job level reduces the attack surface in the event that a GitHub Action, third-party dependency, or CI component is compromised, helping mitigate the impact of potential supply chain attacks and limiting unnecessary repository access.

This change only affects the permissions granted to the workflow GITHUB_TOKEN. Operations authenticated using explicitly configured Personal Access Tokens (PATs) continue to have the scopes assigned to those tokens and are not affected by workflow permissions settings.

Issue(s)

SB-975

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Chores
    • Applied explicit, least-privilege GitHub Actions token permissions across CI/CD workflows by disabling default workflow permissions and granting only the required job scopes (typically contents: read), with targeted exceptions for publishing (e.g., GitHub Pages deploy with contents: write) and security reporting (e.g., CodeQL with security-events: write).