Skip to content

Conversation

@asterwyx
Copy link
Contributor

@asterwyx asterwyx commented Jan 20, 2026

Summary by Sourcery

CI:

  • Delete the call-synchronize-to-dtk6 GitHub Actions workflow configuration.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 20, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Removes the GitHub Actions workflow responsible for calling the synchronize-to-dtk6 workflow, effectively disabling that automation.

File-Level Changes

Change Details Files
Remove the GitHub Actions workflow that triggered synchronization to DTK6.
  • Delete the call-synchronize-to-dtk6.yml workflow file from .github/workflows, including all jobs, triggers, and configuration associated with synchronizing to DTK6
.github/workflows/call-synchronize-to-dtk6.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: asterwyx

The full list of commands accepted by this bot can be found 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

Synchronizing is no more needed.
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

这段代码是一个 GitHub Actions 工作流配置文件,用于在 Pull Request 事件发生时调用另一个仓库 (linuxdeepin/dtk) 中的工作流,以实现代码同步。根据 diff 信息,这个文件被删除了。

以下是对该被删除文件的代码审查意见,涵盖了语法逻辑、代码质量、性能和安全方面:

1. 语法逻辑

  • 语法正确性:YAML 语法结构正确,缩进规范,符合 GitHub Actions 的配置要求。
  • 触发逻辑
    • 使用了 pull_request_target 事件。这是一个特殊的事件,它运行在基础仓库的上下文中(即拥有基础仓库的写权限),而不是派生仓库(PR 来源)的上下文中。
    • paths-ignore 配置合理,排除了打包相关目录(debian, archlinux, .obs)和 CI 配置目录(.github),这意味着只有源代码变更才会触发同步,这是符合预期的逻辑。
  • 调用逻辑
    • uses 关键字正确引用了外部工作流。
    • secrets: inherit 允许将当前仓库的 Secrets 传递给被调用的工作流,这是实现跨仓库操作(如推送代码)所必需的。

2. 代码质量

  • 硬编码引用
    • uses: ...@master:引用了 master 分支。在 CI/CD 最佳实践中,建议引用具体的 Tag 或 Commit SHA,以确保构建的可复现性。如果 master 分支上的工作流发生了破坏性变更,可能会导致此流水线意外失败。
  • 可维护性
    • 文件名 call-synchronize-to-dtk6.yml 和 Job 名 call-synchronize 清晰地表达了其用途。

3. 代码性能

  • 触发频率:通过 paths-ignore 过滤掉了非核心文件的变更,有效减少了不必要的 CI 运行,节省了 GitHub Actions 的配额和运行时间,这是很好的性能优化实践。

4. 代码安全

  • 严重安全隐患:pull_request_target + 代码执行
    • 问题pull_request_target 事件赋予了工作流基础仓库的写入权限(Token 权限)。虽然这个工作流本身只是 call 另一个工作流,但如果被调用的 synchronize-to-dtk6.yml 工作流中有检出代码(checkout)并执行脚本(如运行测试、构建或运行自定义脚本)的操作,且该操作未对来源代码进行严格审查,攻击者可以提交恶意的 PR,利用这个高权限 Token 篡改基础仓库代码或窃取 Secrets。
    • 现状分析:根据 with 参数传递的 source_reposource_ref,被调用的工作流很可能会去拉取 PR 中的代码。如果该被调用工作流直接信任并执行了这些代码,则存在严重安全风险。
  • Secrets 传递
    • secrets: inherit 将当前仓库的所有 Secrets 传递给了外部仓库的工作流。如果 linuxdeepin/dtk 仓库被攻陷或其工作流逻辑被恶意修改,可能会导致 Secrets 泄露。建议仅传递必要的特定 Secret,而不是全部继承。

改进建议

如果该文件需要恢复或重新编写,建议进行以下改进:

  1. 安全性加固

    • 确认被调用的 synchronize-to-dtk6.yml 工作流逻辑是否安全。它应该只读取 PR 代码的差异进行同步,而绝不应该在未隔离的环境中执行 PR 中的代码。
    • 如果可能,尽量避免使用 pull_request_target,或者在调用工作流中明确限制权限(例如设置 permissions: contents: write 仅给必要的权限,而不是默认的 read-all)。
  2. 引用稳定性

    • uses: ...@master 改为引用具体的版本号(如 @v1.0.0)或 Commit SHA,以防止上游变动导致的不稳定。
  3. 权限最小化

    • 在文件顶层添加 permissions 字段,仅授予工作流执行所需的最小权限。

改进后的示例代码(仅供参考):

name: Call synchronize to dtk6
on:
  pull_request_target:
    paths-ignore:
      - "debian/**"
      - "archlinux/**"
      - ".obs/**"
      - ".github/**"
    types: [closed] # 建议考虑是否仅在 PR 合并后(closed 且 merged)触发同步,而不是 PR 打开时就触发,避免未审查代码的同步

permissions:
  contents: write # 仅授予写入内容的权限,根据实际需求调整

jobs:
  call-synchronize:
    # 使用具体的 Tag 或 SHA 替代 master
    uses: linuxdeepin/dtk/.github/workflows/synchronize-to-dtk6.yml@v1.2.0 
    secrets: inherit
    with:
      dest_repo: linuxdeepin/dtk6declarative
      source_repo: ${{ github.event.pull_request.head.repo.full_name }}
      source_ref: ${{ github.event.pull_request.head.ref }}
      pull_number: ${{ github.event.pull_request.number }}

总结

该文件被删除可能是出于以下原因:

  1. 该同步逻辑已过时或不再需要(例如 dtk6 已停止维护或同步方式改变)。
  2. 出于安全考虑,移除了这种基于 pull_request_target 的自动化同步机制,转而采用更安全的人工审核或其他 CI 流程。

如果该功能仍需使用,请务必重点关注上述提到的安全风险,特别是关于 pull_request_target 的潜在代码注入风险。

@zccrs
Copy link
Member

zccrs commented Jan 20, 2026

同步到gitee的这个失败了不影响这个提交,这个改动是github action的变化,本次未同步过去不要紧,直接合入了。

@zccrs zccrs merged commit bbe233a into master Jan 20, 2026
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants