Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Give each workflow's token only the permissions it needs

クローズ
#1,333 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@AlphaNen がすでに取り組んでいます。

2026年10月21日 から。

  • #1334 @AlphaNen による — マージ済み

評価

この issue はまだ評価されていません。

説明

good first issue help wanted

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.

主要言語
Python
スター
274
フォーク
160
平均マージ
2日 2時間
マージ済み PR(30日)
71

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dapr/python-sdk のほかの issue

dapr/python-sdk の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。