Skip to content

Commit 7a9aedc

Browse files
arpitjain099meta-codesync[bot]
authored andcommitted
ci: declare workflow-scope permissions on five workflows (#478)
Summary: Five workflows currently don't declare a `permissions:` block, so the workflow `GITHUB_TOKEN` falls back to the repository default. This patch pins each to its minimum: - `.github/workflows/build-and-test.yml` -- `contents: read`. Matrix tests across Ubuntu/macOS/Windows and Python 3.9-3.14. No GitHub API write. - `.github/workflows/coverage.yml` -- `contents: read`. `pytest --cov` plus `actions/upload-artifact@v4` for the coverage reports. Artifact upload in v4 doesn't require explicit permissions. - `.github/workflows/deploy-website.yml` -- `contents: write`. The deploy step is `peaceiris/actions-gh-pages@v4` pushing the Docusaurus build to `gh-pages` via `${{ secrets.GITHUB_TOKEN }}`. - `.github/workflows/notebook-ci.yml` -- `contents: read`. Executes `tutorials/balance_diff_diff_brfss.ipynb` via Papermill. No GitHub API write. - `.github/workflows/release.yml` -- `contents: read`. Runs the test matrix and `pypa/gh-action-pypi-publish` against PyPI using `PYPI_API_TOKEN`. The workflow `GITHUB_TOKEN` is unused for the publish. The pattern matches `codeql.yml` (per-job `actions: read, contents: read, security-events: write`), `diff-diff-canary.yml` (workflow-level `contents: read, issues: write` plus a per-job override), and `cleanup-copilot-artifacts.yml` (workflow-level `actions: write`). Third-party action exposure that motivates pinning: `peaceiris/actions-gh-pages`, `pypa/gh-action-pypi-publish`, `actions/setup-python`, `actions/setup-node`. Explicit per-workflow scopes narrow the blast radius if any is compromised (cf. `tj-actions/changed-files` CVE-2025-30066). No behavioural change to any of the five. Pull Request resolved: #478 Differential Revision: D105128528 Pulled By: talgalili fbshipit-source-id: 2621bd590d3b1597123dbffd4de6e50087703941
1 parent a555ce0 commit 7a9aedc

5 files changed

Lines changed: 15 additions & 0 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
# allow this to be scheduled manually in addition to cron
1212
workflow_dispatch:
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
tests:
1619
# Default matrix: bare-import balance on every OS / python combination —

.github/workflows/coverage.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
branches: [ main ]
88
workflow_dispatch:
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
coverage:
1215
runs-on: ubuntu-latest

.github/workflows/deploy-website.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
branches:
55
- main
66

7+
permissions:
8+
contents: write
9+
710
jobs:
811
deploy:
912
name: Deploy to GitHub Pages

.github/workflows/notebook-ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ on:
3939
- '.github/workflows/notebook-ci.yml'
4040
workflow_dispatch:
4141

42+
permissions:
43+
contents: read
44+
4245
jobs:
4346
execute-tutorial:
4447
name: Execute balance_diff_diff_brfss tutorial

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
release:
88
types: [published]
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
tests:
1215
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)