From 6d8a95aedc09479478b86921aa6ce69b3e1bc753 Mon Sep 17 00:00:00 2001 From: Arpit Jain Date: Fri, 15 May 2026 15:57:18 +0900 Subject: [PATCH] ci: declare workflow-level contents: read on 3 workflows 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 --- .github/workflows/build_nightly.yml | 4 ++++ .github/workflows/build_pull_request.yml | 4 ++++ .github/workflows/build_push.yml | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/.github/workflows/build_nightly.yml b/.github/workflows/build_nightly.yml index 08536becb43..14bc2cb9c5b 100644 --- a/.github/workflows/build_nightly.yml +++ b/.github/workflows/build_nightly.yml @@ -4,6 +4,10 @@ on: - cron: 0 0 * * * env: CACHE_VERSION: xxxxx1 + +permissions: + contents: read + jobs: build: uses: "./.github/workflows/build_and_test.yml" diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml index af552ea0779..c01f7568b53 100644 --- a/.github/workflows/build_pull_request.yml +++ b/.github/workflows/build_pull_request.yml @@ -6,6 +6,10 @@ on: - stable env: CACHE_VERSION: xxxxx1 + +permissions: + contents: read + jobs: build: uses: "./.github/workflows/build_and_test.yml" diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index 3c44cb84341..6ab895134fc 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -6,6 +6,10 @@ on: - stable env: CACHE_VERSION: xxxxx1 + +permissions: + contents: read + jobs: build: uses: "./.github/workflows/build_and_test.yml"