Skip to content

ci: declare workflow-level contents: read on 6 workflows#504

Open
arpitjain099 wants to merge 1 commit into
linuxfoundation:mainfrom
arpitjain099:chore/declare-workflow-perms-readonly
Open

ci: declare workflow-level contents: read on 6 workflows#504
arpitjain099 wants to merge 1 commit into
linuxfoundation:mainfrom
arpitjain099:chore/declare-workflow-perms-readonly

Conversation

@arpitjain099
Copy link
Copy Markdown

Pins the default GITHUB_TOKEN to contents: read on 6 workflows in .github/workflows/ that don't call a GitHub API beyond the initial checkout.

Why

CVE-2025-30066 (March 2025 tj-actions/changed-files supply-chain compromise) exfiltrated GITHUB_TOKEN from workflow logs. Pinning per workflow caps runtime authority irrespective of the repo or org default, gives drift protection if the default ever widens, and is credited per-file by the OpenSSF Scorecard Token-Permissions check.

YAML validated locally with yaml.safe_load on each touched file.

Pins the default GITHUB_TOKEN to contents: read on the workflows in
.github/workflows/ that don't call a GitHub API beyond the initial
checkout. The other workflows in this directory are left implicit
because they need write scopes that a maintainer is better placed
to declare.

Motivation: CVE-2025-30066 (March 2025 tj-actions/changed-files
compromise) exfiltrated GITHUB_TOKEN from workflow logs. Per-workflow
caps bound runtime authority irrespective of repo or org default,
give drift protection if the default ever widens, and are credited
per-file by the OpenSSF Scorecard Token-Permissions check.

YAML validated locally with yaml.safe_load.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e7bdcefd-a45e-4438-8f3e-aee8ba27d36a

📥 Commits

Reviewing files that changed from the base of the PR and between 1181df0 and 6b18b3e.

📒 Files selected for processing (6)
  • .github/workflows/license-header-check.yml
  • .github/workflows/lint.yml
  • .github/workflows/snyk-scan-edge-npm-pr.yml
  • .github/workflows/snyk-scan-npm-pr.yml
  • .github/workflows/yarn-scan-cypress-pr.yml
  • .github/workflows/yarn-scan-pr.yml

Walkthrough

Six GitHub Actions workflows receive explicit top-level permissions declarations, each setting contents: read to restrict the GitHub token to read-only repository access. The changes apply consistently across Snyk NPM, Snyk Edge NPM, Yarn, License Header, and Lint workflows without modifying job or step logic.

Changes

GitHub Actions Token Permissions Hardening

Layer / File(s) Summary
Restrict token permissions to read contents
.github/workflows/snyk-scan-npm-pr.yml, .github/workflows/yarn-scan-cypress-pr.yml, .github/workflows/license-header-check.yml, .github/workflows/yarn-scan-pr.yml, .github/workflows/lint.yml, .github/workflows/snyk-scan-edge-npm-pr.yml
All six workflows add a top-level permissions block explicitly restricting GitHub token access to contents: read.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding workflow-level contents: read permissions to 6 workflows.
Description check ✅ Passed The description is directly related to the changeset, explaining the security rationale behind adding workflow-level permissions and referencing CVE-2025-30066.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@lukaszgryglicki lukaszgryglicki left a comment

Choose a reason for hiding this comment

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

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants