Open
chore: 接入 semgrep 敏感信息扫描钩子 #17
chore: 接入 semgrep 敏感信息扫描钩子 #17
Open
masiyuAdd on 2 days ago
masiyu
masiyuCollaborators
2 days ago

当前PR是否有AI参与:

    1. AI Agent 平台: opencode
    2. AI 模型: deepseek-v4.1-flash
    3. Prompt上下文: 为 pre-commit 接入 semgrep 敏感信息扫描钩子,同步更新 pre-commit 配置、CONTRIBUTING 文档及 PR 流水线任务名

PR功能描述 / 为什么需要这个合入:

本 PR 从 feat/semgrep-hook-0.1.4 分支合并到 main,包含 1 个提交,修改 3 个文件。

在提交阶段接入 semgrep 敏感信息扫描,统一拦截敏感词/内部信息泄露,命中即阻断提交,与社区门禁保持一致。

变更类型

修改方案:

  • .pre-commit-config.yaml:openUBMC/pre-commit-hooks 的 rev 升级至 0.1.4,并在该钩子组中新增 semgrep 钩子(内置敏感词/内部信息规则,仅对本次改动文件做增量扫描,命中即阻断)。
  • CONTRIBUTING.md:在 pre-commit 钩子说明中补充 semgrep 条目及增量扫描说明。
  • .gitcode/workflows/PR-pipeline_hwproxy.yml:将 stages.CI.jobs 下的任务键由 Build 调整为 CI。

验证方案:

  • 本地 pre-commit run --all-files 可正常执行(semgrep 仅扫描改动文件)。
  • YAML 语法检查通过(.pre-commit-config.yaml、工作流文件均可正常解析)。
  • 提交时 semgrep 钩子可对命中敏感信息的改动进行阻断。

测试建议:

  • 执行 pre-commit install 后,修改一个含敏感词的临时文件并尝试提交,确认 semgrep 阻断生效。
  • 确认 CI 门禁任务正常触发(任务键已为 CI)。

自验证报告:

该PR关联的issue

(格式为 fixes #<issue号>, 或者resolves #<issue号>): 无

希望检视人员了解:

semgrep 钩子仅支持增量(改动文件)扫描,不支持 --all-files 全量扫描;规则集跟随 pre-commit-hooks 仓库 rev 统一升级,各仓无需本地维护规则文件。

关联 Issue:https://gitcode.com/openUBMC/pre-commit-hooks/issues/7

likedislike
Merge blocked
masiyumasiyuCollaborators
2 days ago Created pull request, commit caf48fd6
masiyumasiyuCollaborators
2 days ago Associated issue: [需求]: 社区支持gitleaks敏感信息拦截门禁
openUBMC-robotopenUBMC-robotCollaborators
2 days ago Set zjp99,chendanming as approver
openUBMC-robotopenUBMC-robotCollaborators
2 days ago Added label: sig/sig-framework
openUBMC-robot
openUBMC-robotCollaborators
2 days ago Comments:

欢迎来到 openUBMC 社区

Hey @m0_64526648 , 感谢你对社区的贡献.

机器人使用手册

有关指令的使用,可以点击 说明文档 或 论坛 查看详情。开发人员可以在每个PR或Issue下方评论特定指令来触发机器人任务。您可以自助配置此仓库的 PR 合并规则,更多详情,请参阅机器人自助配置使用手册。

联系指引

有疑问可以联系 SIG: sig-framework ,
维护者是: @chendanming, @zjp99 ,
优秀贡献者是: @leessential, @qq_32768419 .

likedislike
152 messages are collapsed here。 See more
Oopenubmc-ci-botCollaborators
11 hours ago Added label: limit_1k_suc
Oopenubmc-ci-botCollaborators
11 hours ago Removed label: ci-running
openubmc-ci-botCollaborators
11 hours ago Comments:
任务名称结果
pre-commit检查✅ SUCCESS
PR描述检查✅ SUCCESS
防投毒检查✅ SUCCESS
开源合规检查✅ SUCCESS
编译构建✅ SUCCESS
UT测试✅ SUCCESS
IT测试❌ FAILED
代码覆盖率❌ FAILED
修改行数检查✅ SUCCESS
头文件检查✅ SUCCESS
ARM UT测试✅ SUCCESS
likedislike
Oopenubmc-ci-botCollaborators
11 hours ago Added label: ci-failed
openubmc-ci-botCollaborators
11 hours ago Comments:

CI已执行结束,查看流水线详情:流水线链接

likedislike