Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Give each workflow's token only the permissions it needs

Đang mở
#1,333 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@AlphaNen đang làm issue này rồi.

Từ ngày 21/10/2026.

  • #1334 của @AlphaNen — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.

Ngôn ngữ chính
Python
Star
274
Fork
160
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
70

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của dapr/python-sdk

Tất cả issue của dapr/python-sdk

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.