Skip to content

Set least-privilege GITHUB_TOKEN scope on CI workflow - #5

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixci-set-least-privilege-github_token-04b169
Draft

Set least-privilege GITHUB_TOKEN scope on CI workflow#5
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixci-set-least-privilege-github_token-04b169

Conversation

@posthog

@posthog posthog Bot commented Aug 16, 2026

Copy link
Copy Markdown

Problem

  • CI runs with the repository default GITHUB_TOKEN scope, which is wider than the job needs. CodeQL flags this as a medium-severity alert with a Vanta compliance deadline of 2026-10-06.
  • .github/workflows/ci.yml declares no permissions: block, so the registry job gets the default token scope instead of the read-only scope it actually uses.
  • The registry job only checks out code and runs typecheck, lint, test, build, and git diff --exit-code r/. Nothing writes to the repo, comments on a PR, publishes a package, or requests an OIDC token, so the extra scope only widens the blast radius.

Changes

  • Add a workflow-level permissions: block that grants contents: read, between the on: and jobs: blocks.
   pull_request:
     branches: [main]
+permissions:
+  contents: read
 jobs:

This matches the pattern merged for the workflows in logo-dev/logo (PR #789, commit 4c6dc96).

Scope

  • This PR covers the logo-api repository only. The same fix for arena and the marketing site ships as separate PRs, one per repo.

Risk

  • Low. The single job is read-only, so contents: read does not restrict any step it runs.

Agent context

  • Checked for in-flight work across open PRs, issues, and branches touching .github/workflows/; found none.

Created with PostHog Desktop from this inbox report, addressing API-927, DASH-414.

Add a workflow-level `permissions:` block with `contents: read` to
`.github/workflows/ci.yml`. The `registry` job only checks out code and
runs read-only steps, so it does not need the default full token scope.

This closes the CodeQL medium-severity alert for this workflow.

Generated-By: PostHog Desktop
Task-Id: 81966967-a939-4197-8666-c73a2f638650
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.

0 participants