Give each workflow's token only the permissions it needs
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.yamlandbuild-tag.yaml(their codecov jobs setcontents: readandid-token: writeat job level, but the other jobs inherit the default)release-tag.yaml(job-levelcontents: readonly)run-tests.yamlfossa.yamldapr-bot.ymlbackport.yamlanddapr-bot-schedule.yml(these call reusable workflows in dapr/.github)
Proposed change
For each workflow:
- Add a top-level
permissions: contents: read(orpermissions: {}where no job reads the repo). - Grant write scopes only on the job that needs them, keeping the existing job-level blocks (for example codecov's
id-token: write). - Several workflows do their writes with
DAPR_BOT_TOKENor a PyPI secret, notGITHUB_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 onGITHUB_TOKEN. - 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.yamlalready does this foropen-issue-on-failure.yml.
Acceptance criteria
- Every workflow in
.github/workflows/has a top-levelpermissions:block that is read-only (contents: read,read-allor{}). - Write scopes appear only at job level, on the jobs that need them.
- 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
actionlintpasses on the changed workflows.- The PR's CI runs (
build.yaml,run-tests.yaml) pass. - To exercise scheduled and comment-triggered workflows, run them on your fork via
workflow_dispatchor the triggering event. - Optionally, run the scorecard CLI with
--checks=Token-Permissionsagainst your fork and confirm no findings.
- 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
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.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dapr/python-sdk
-
Add the OpenSSF Scorecard GitHub Action and publish the resultsCó thể đã có người làm @AdepuSriCharan đã nhận 3 ngày trước. Đang mởgood first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dapr/python-sdk#1332 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
SDK Alignment of Workflow ExamplesCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởdapr-ext-workflow good first issue kind/enhancement P2
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 72/100
dapr/python-sdk#853 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 47/100
dapr/python-sdk#1346 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Add PyPI keywords and project links to the dapr packageCó thể đã có người làm @SpinachDigital đã nhận 4 ngày trước. Đang mởgood first issue help wanted kind/enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 20/100
dapr/python-sdk#1335 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
ci/release-failure release
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
dapr/python-sdk#1320 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của dapr/python-sdk
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
nansencenter/geodataset#39 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
awslabs/visual-asset-management-system#804 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
follow-up
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[18.0] werkzeug: AttributeErrorĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
odoo/odoo#297927 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
link-rot
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100