Skip to content

Commit 96bdf82

Browse files
tannevaledclaude
andauthored
ci: grant publishing permissions to the deploy job only (#10)
The workflow-level permissions block applied to every job, so the build that runs on a pull request held a token able to publish the site. Nothing leaked: the deploy job is gated on the branch and a pull request never reaches it. But a pull request build is exactly where third-party code runs -- a dependency resolved during the build, an action at a floating tag -- and it should not run holding a token it has no use for. The publishing grant moves down to the deploy job. The workflow keeps only what the build actually reads. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 09c7d04 commit 96bdf82

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎.github/workflows/deploy-pages.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ on:
1111
pull_request:
1212
workflow_dispatch:
1313

14+
# The build needs nothing beyond the source and the Pages configuration it
15+
# reads to compute the base URL. Publishing rights are granted to the deploy
16+
# job alone, below, so a pull request build cannot replace what is served.
1417
permissions:
1518
contents: read
16-
pages: write
17-
id-token: write
19+
pages: read
1820

1921
concurrency:
2022
group: pages
@@ -52,6 +54,10 @@ jobs:
5254
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
5355
needs: build
5456
runs-on: ubuntu-latest
57+
permissions:
58+
contents: read
59+
pages: write
60+
id-token: write
5561
environment:
5662
name: github-pages
5763
url: ${{ steps.deployment.outputs.page_url }}

0 commit comments

Comments
 (0)