From 946b99e93dfe242bfaf5fca19f098c4279352507 Mon Sep 17 00:00:00 2001 From: "hf-security-analysis[bot]" <265538906+hf-security-analysis[bot]@users.noreply.github.com> Date: Wed, 23 Sep 2026 11:24:26 +0000 Subject: [PATCH] Scope GITHUB_TOKEN permissions per job A job with no `permissions:` block inherits whatever the repository hands out. Each block added here grants what that job's own steps need and nothing more. --- .github/workflows/ci.yml | 6 ++++++ .github/workflows/python-release.yml | 4 ++++ .github/workflows/trufflehog.yml | 4 ++++ .github/workflows/update_spaces.yml | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f580ef35..b31462462 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,9 +13,13 @@ env: HF_ALLOW_CODE_EVAL: 1 CI_HEADERS: ${{ secrets.CI_HEADERS }} +permissions: {} + jobs: check_code_quality: + permissions: + contents: read runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -34,6 +38,8 @@ jobs: flake8 tests src metrics test: + permissions: + contents: read needs: check_code_quality strategy: fail-fast: false diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index d680802aa..d2e65f7e5 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -8,8 +8,12 @@ on: env: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN_DIST }} +permissions: {} + jobs: python_release: + permissions: + contents: read runs-on: ubuntu-latest steps: diff --git a/.github/workflows/trufflehog.yml b/.github/workflows/trufflehog.yml index 578b4a01b..958465145 100644 --- a/.github/workflows/trufflehog.yml +++ b/.github/workflows/trufflehog.yml @@ -3,8 +3,12 @@ on: name: Secret Leaks +permissions: {} + jobs: trufflehog: + permissions: + contents: read runs-on: ubuntu-latest steps: - name: Checkout code diff --git a/.github/workflows/update_spaces.yml b/.github/workflows/update_spaces.yml index c932144d2..237c09169 100644 --- a/.github/workflows/update_spaces.yml +++ b/.github/workflows/update_spaces.yml @@ -8,8 +8,12 @@ on: env: CI_HEADERS: ${{ secrets.CI_HEADERS }} +permissions: {} + jobs: update-hub-repositories: + permissions: + contents: read runs-on: ubuntu-latest steps: - name: Checkout repository