Skip to content

Declare what each workflow may do with the token and stop persisting checkout credentials - #6784

Merged
vinibrsl merged 2 commits into
plausible:masterfrom
Totara-thib:ci-hardening
Nov 2, 2026
Merged

vinibrsl merged 2 commits into
plausible:masterfrom
Totara-thib:ci-hardening

Conversation

@Totara-thib

@Totara-thib Totara-thib commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Hello, two commits on the workflows.

  • The seven workflows without a permissions block declare one: read-only, except packages: write on the GHCR image workflow, pull-requests: read where dorny/paths-filter runs, and pull-requests: write on the Terraform job that posts its plan.
  • Twelve of the fourteen checkouts stop persisting the token. The two that commit with the bot token keep it.

Why: a job that only builds and tests should not hold a token that can write, and these workflows push the community-edition images, publish the tracker to npm and carry the Terraform Cloud token. The default token scopes are wider than any of them need.

Found and fixed by Plumber's analysis, reviewed and submitted by me. I'm also a long time customer of Plausible.

Tests

  • This PR does not require tests

Changelog

  • This PR does not make a user-facing change

Documentation

  • This change does not need a documentation update

Dark mode

  • This PR does not change the UI

@CLAassistant

CLAassistant commented Oct 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Seven workflows had no permissions block, so their jobs received the
repository's default token scopes. The scopes now match what each job
does: the GHCR image workflow keeps packages: write since it logs in
with the job token, the elixir build and e2e jobs and the migrations
check get pull-requests: read for dorny/paths-filter, the Terraform job
gets pull-requests: write for the plan comment it posts, and
everything else is read-only.
actions/checkout writes the job token into .git/config by default, so
every later step, including third-party actions and the packages they
install, can read it. Twelve of the fourteen checkouts never push: the
docs deploy hands its token to the Pages action explicitly, and the
rest only build, test or compare. Those twelve no longer keep the token.
The two checkouts that commit with the bot token (the tracker release
and the tracker version bump) keep it.
@vinibrsl
vinibrsl added this pull request to the merge queue Nov 2, 2026
@vinibrsl

vinibrsl commented Nov 2, 2026

Copy link
Copy Markdown
Member

Thank you!

Merged via the queue into plausible:master with commit 3644844 Nov 2, 2026
22 checks passed
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.

3 participants