Skip to content

ci: set least-privilege GITHUB_TOKEN permissions (SEC-843) - #398

Open
Matt Sutkus (msuitcase) wants to merge 2 commits into
masterfrom
sec-842/least-privilege-permissions
Open

Matt Sutkus (msuitcase) wants to merge 2 commits into
masterfrom
sec-842/least-privilege-permissions

Conversation

@msuitcase

Copy link
Copy Markdown
Contributor

What

  • Top-level permissions: contents: read.
  • docs job: contents: write, which the gh-pages deploy needs.

Why

The workflow had no permissions: block, so every job got the repo's default token scope. With this change, a job that only builds and tests gets a read-only token.

Testing note

docs only runs on master, so this PR's CI doesn't exercise it. Check the first docs run after merge.

Stack

  1. ci: don't persist GITHUB_TOKEN in checkout (SEC-843) #397: persist-credentials: false
  2. This PR (based on ci: don't persist GITHUB_TOKEN in checkout (SEC-843) #397): merge after it

Part of SEC-842.

actions/checkout writes the job token into .git/config by default, where
any later step (composer install, phpunit, third-party actions) can read
it. Nothing in this workflow needs git credentials after checkout; the
gh-pages deploy authenticates with its own github_token input.

Refs SEC-843
Default the workflow token to read-only. Only the docs job writes to the
repo (gh-pages deploy), so it alone gets contents: write.

Refs SEC-843
@msuitcase
Matt Sutkus (msuitcase) marked this pull request as ready for review November 3, 2026 18:40
Base automatically changed from sec-842/persist-credentials to master November 10, 2026 00:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants