Skip to content

Commit 6543eab

Browse files
tannevaledclaude
andcommitted
ci: grant publishing permissions to the deploy job only
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 e72f232 commit 6543eab

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎.github/workflows/hugo.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ concurrency:
2222
group: "pages"
2323
cancel-in-progress: false
2424

25+
# The build needs nothing beyond the source and the Pages configuration it
26+
# reads to compute the base URL. Publishing rights are granted to the deploy
27+
# job alone, below, so a pull request build cannot replace what is served.
2528
permissions:
2629
contents: read
27-
pages: write
28-
id-token: write
30+
pages: read
2931

3032
env:
3133
# Pin Hugo so site builds don't break when a new release ships
@@ -75,6 +77,10 @@ jobs:
7577
name: github-pages
7678
url: ${{ steps.deployment.outputs.page_url }}
7779
runs-on: ubuntu-latest
80+
permissions:
81+
contents: read
82+
pages: write
83+
id-token: write
7884
needs: build
7985
steps:
8086
- name: Deploy to GitHub Pages

0 commit comments

Comments
 (0)