Skip to content

Give each workflow's token only the permissions it needs #1333

Open

Description

@sicoyle

Problem

When a workflow doesn't declare permissions:, its GITHUB_TOKEN gets the repository's default permissions, which can include write access to contents, pull requests, issues and more. If a step or third-party action is ever compromised, it can use that token. The OpenSSF Scorecard Token-Permissions check asks for a read-only token at the top level of every workflow, with any write permission granted only on the job that needs it.

In python-sdk, only automerge-queue.yaml sets a top-level permissions: today ({}). These workflows have none:

  • build.yaml and build-tag.yaml (their codecov jobs set contents: read and id-token: write at job level, but the other jobs inherit the default)
  • release-tag.yaml (job-level contents: read only)
  • run-tests.yaml
  • fossa.yaml
  • dapr-bot.yml
  • backport.yaml and dapr-bot-schedule.yml (these call reusable workflows in dapr/.github)

Proposed change

For each workflow:

  1. Add a top-level permissions: contents: read (or permissions: {} where no job reads the repo).
  2. Grant write scopes only on the job that needs them, keeping the existing job-level blocks (for example codecov's id-token: write).
  3. Several workflows do their writes with DAPR_BOT_TOKEN or a PyPI secret, not GITHUB_TOKEN (dapr-bot.yml, release-tag.yaml, build-tag.yaml's upload, backport.yaml, dapr-bot-schedule.yml). Those jobs shouldn't need write scopes on GITHUB_TOKEN.
  4. For jobs that call reusable workflows (uses: dapr/.github/.github/workflows/...), the caller's permissions cap what the called workflow gets, so check what each reusable workflow needs before restricting it. build-tag.yaml already does this for open-issue-on-failure.yml.

Acceptance criteria

  1. Every workflow in .github/workflows/ has a top-level permissions: block that is read-only (contents: read, read-all or {}).
  2. Write scopes appear only at job level, on the jobs that need them.
  3. CI on the PR is green, and the release, bot and scheduled workflows are checked by reading through what they call (or by a test run on a fork).

How to test

  1. actionlint passes on the changed workflows.
  2. The PR's CI runs (build.yaml, run-tests.yaml) pass.
  3. To exercise scheduled and comment-triggered workflows, run them on your fork via workflow_dispatch or the triggering event.
  4. Optionally, run the scorecard CLI with --checks=Token-Permissions against your fork and confirm no findings.

Docs: Controlling permissions for GITHUB_TOKEN.

Activity

  1. AlphaNen commented on Oct 21, 2026

    @AlphaNen

    /assign

  2. added a commit that references this issue on Oct 23, 2026
    9b6431f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions