From 681e566a563c26cc73f3641bbfbfd476713ffd35 Mon Sep 17 00:00:00 2001 From: Arpit Jain Date: Fri, 15 May 2026 15:59:23 +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/tfg-main-pypi.yml | 3 +++ .github/workflows/tfg-nightly-pypi.yml | 3 +++ .github/workflows/tfg-test-pypi.yml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/tfg-main-pypi.yml b/.github/workflows/tfg-main-pypi.yml index 741dc116e..e203d4ae3 100644 --- a/.github/workflows/tfg-main-pypi.yml +++ b/.github/workflows/tfg-main-pypi.yml @@ -3,6 +3,9 @@ name: Deploy tensorflow_graphics to pypi on: workflow_dispatch +permissions: + contents: read + jobs: deploy: if: github.repository == 'tensorflow/graphics' # prevents action from running on forks diff --git a/.github/workflows/tfg-nightly-pypi.yml b/.github/workflows/tfg-nightly-pypi.yml index c77d40483..e29e902d7 100644 --- a/.github/workflows/tfg-nightly-pypi.yml +++ b/.github/workflows/tfg-nightly-pypi.yml @@ -7,6 +7,9 @@ on: # runs daily at 00:30 am - cron: '30 0 * * *' +permissions: + contents: read + jobs: deploy: if: github.repository == 'tensorflow/graphics' # prevents action from running on forks diff --git a/.github/workflows/tfg-test-pypi.yml b/.github/workflows/tfg-test-pypi.yml index bd7496b0a..85c035953 100644 --- a/.github/workflows/tfg-test-pypi.yml +++ b/.github/workflows/tfg-test-pypi.yml @@ -3,6 +3,9 @@ name: Deploy to test-pypi on: workflow_dispatch +permissions: + contents: read + jobs: deploy: if: github.repository == 'tensorflow/graphics' # prevents action from running on forks