Skip to content

ci: complete maintenance workflow authorization - #22063

Merged
ti-chi-bot[bot] merged 1 commit into
pingcap:masterfrom
qiancai:fix-maintenance-workflow-authorization
Nov 16, 2026
Merged

ti-chi-bot[bot] merged 1 commit into
pingcap:masterfrom
qiancai:fix-maintenance-workflow-authorization

Conversation

@qiancai

@qiancai qiancai commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

What is changed, added, or deleted? (Required)

Complete the remaining authorization checks for maintenance workflows:

  • Require the existing shared authorization workflow before link scanning and issue creation. Manual and repository dispatches must come from an allowlisted account with current write access on pingcap/docs-cn master. Scheduled first attempts remain supported, and reruns must pass authorization for the current attempt.
  • Require master in addition to the existing repository check for the keywords workflow.
  • Extend the existing CI regression tests with dispatch, fork, branch/tag, revoked-permission, and rerun cases, and verify that link issue creation requires current authorization.

flush-version.yaml and sync-doc-pr-en-to-zh.yml already use the shared repository, branch, account, permission, and rerun checks introduced in #22058, so their existing protections are retained.

Validation: all eight existing security/default regression scripts passed (including the expanded authorization tests); actionlint -shellcheck= passed for the shared gate and all four reported workflows; git diff --check passed. No production workflow was manually dispatched and no production secrets were used.

Scope: these checks restrict execution of the reviewed workflows. They do not isolate repository-level secrets from a branch writer who can modify workflow definitions; that requires separate repository/environment secret controls.

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions (in Chinese).

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)

What is the related PR or file link(s)?

AI agent involvement

  • The changes in this PR were primarily made by an AI agent on behalf of the PR author.

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Summary by CodeRabbit

  • 自动化流程
    • 手动或仓库事件触发的相关工作流会验证触发者的权限;未通过授权时,不会继续执行受限操作。
    • 链接检查及问题创建仅在当前运行通过授权、检查失败且报告可用时执行。
    • 关键词检查仅在 pingcap/docs-cn 仓库的 master 分支运行。

@qiancai
qiancai requested a review from lilin90 as a code owner November 16, 2026 05:35
@ti-chi-bot ti-chi-bot Bot added missing-translation-status This PR does not have translation status info. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 16, 2026
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

本次更新扩展特权工作流的事件授权检查,为链接检查和问题创建作业增加授权与运行尝试条件,并限制关键词检查仅在 pingcap/docs-cn 的 master 分支运行。

Changes: 链接检查授权

Layer / File(s) Summary
扩展授权事件与测试
.github/workflows/authorize-privileged-workflow.yml, scripts/test-privileged-workflow-actors.py
授权分支现在对 repository_dispatch 调用 check_permission。测试增加授权、拒绝和重跑场景,并为 gate 脚本子进程设置 5 秒超时。
为链接作业增加授权门控
.github/workflows/link.yaml, scripts/test-privileged-workflow-actors.py
linkChecker 依赖授权作业,并检查授权 attempt 是否匹配当前运行尝试。createIssue 还要求授权成功、扫描失败且报告 artifact ID 非空。测试覆盖这些条件。

关键词检查范围

Layer / File(s) Summary
限制关键词检查仓库与分支
.github/workflows/keywords.yaml, scripts/test-privileged-workflow-actors.py
关键词检查仅在仓库为 pingcap/docs-cn 且引用为 refs/heads/master 时运行。测试检查这两个条件。

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant authorize
  participant linkChecker
  participant createIssue
  authorize->>linkChecker: 授权状态和 attempt
  linkChecker->>createIssue: 扫描失败状态和报告 artifact ID
Loading

Possibly related PRs

  • pingcap/docs-cn#22058:该 PR 延续其中的特权工作流授权实现,并扩展其授权检查和回归测试。
  • pingcap/docs-cn#22037:该 PR 继续修改相同的 actor 授权逻辑和测试脚本。

Suggested reviewers: shhdgit

Merge Risk: Minimal · up to d2f0f

The change tightens who can trigger maintenance workflows and which attempts may run link scanning and issue creation. No merge-blocking issue was found. Repository-level secrets are still not isolated from branch writers who can edit workflow definitions, as the author noted.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“ci: complete maintenance workflow authorization”与变更集的主要内容一致。变更为维护类工作流(link 扫描、问题创建、keywords)补充授权检查,并扩展回归测试。标题简洁,未包含噪声内容。
Description check Passed 描述包含模板要求的主要章节:变更内容(已填写详细说明,包括授权要求、keywords 工作流的 master 限制及回归测试扩展)、适用版本(已勾选 master)、相关 PR 链接(引用 #22058)以及 AI agent 参与声明(已勾选)。“Do your changes match any of the following descriptions?”部分保持未勾选,属于可接受的状态。首…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

描述包含模板要求的主要章节:变更内容(已填写详细说明,包括授权要求、keywords 工作流的 master 限制及回归测试扩展)、适用版本(已勾选 master)、相关 PR 链接(引用 #22058)以及 AI agent 参与声明(已勾选)。“Do your changes match any of the following descriptions?”部分保持未勾选,属于可接受的状态。首次贡献者检查清单在模板中标注为可删除的可选部分,描述中已移除,不影响通过。描述内容完整,验证结果和范围限制说明也很充分。

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0895502 and d2f0f51.

Files selected for processing: 4

  • .github/workflows/authorize-privileged-workflow.yml
  • .github/workflows/keywords.yaml
  • .github/workflows/link.yaml
  • scripts/test-privileged-workflow-actors.py

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@qiancai qiancai self-assigned this Nov 16, 2026
@qiancai qiancai added translation/no-need No need to translate this PR. and removed missing-translation-status This PR does not have translation status info. labels Nov 16, 2026
@lilin90
lilin90 requested a balanced review from Copilot November 16, 2026 07:55
@lilin90 lilin90 added the ONCALL Relates to documentation oncall. label Nov 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the maintenance-workflow authorization changes.

No open issues 🎉

What changed in this PR

This PR extends the shared authorization checks introduced in #22058 to the remaining maintenance workflows.

Changes:

  • Require current-attempt authorization before link scanning and issue creation, and support repository dispatches in the shared gate.
  • Restrict the keywords workflow to pingcap/docs-cn on master.
  • Expand regression coverage for dispatches, forks, branches/tags, revoked permissions, reruns, and link-issue authorization.
File Description
scripts/​test-privileged-workflow-actors.py Adds authorization cases, workflow-gate assertions, and a subprocess timeout.
.github/​workflows/​link.yaml Gates link scanning and issue creation on current-attempt authorization.
.github/​workflows/​keywords.yaml Adds the master branch restriction.
.github/​workflows/​authorize-privileged-workflow.yml Applies requester permission checks to repository dispatches.

Review effort: Balanced

@ti-chi-bot ti-chi-bot Bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Nov 16, 2026
@ti-chi-bot

ti-chi-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-11-16 08:05:28.352845404 +0000 UTC m=+1690652.977995681: ☑️ agreed by lilin90.

@qiancai

qiancai commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

/approve

@qiancai qiancai added the lgtm label Nov 16, 2026
@ti-chi-bot ti-chi-bot Bot added the approved label Nov 16, 2026
@qiancai

qiancai commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

/retest

@qiancai

qiancai commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

/approve

@ti-chi-bot

ti-chi-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiancai

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot
ti-chi-bot Bot merged commit 69ec491 into pingcap:master Nov 16, 2026
12 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Nov 17, 2026
2 of 12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm needs-1-more-lgtm Indicates a PR needs 1 more LGTM. ONCALL Relates to documentation oncall. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. translation/no-need No need to translate this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants