已合并
chore: 接入 semgrep 敏感信息扫描钩子 #19
masiyu创建于 15 天前
chore: 接入 semgrep 敏感信息扫描钩子 #19
已合并
共 3 个文件变更+4-2
| @@ -44,6 +44,6 @@ stages: | |||
| 44 | name: CI门禁 | 44 | name: CI门禁 |
| 45 | select: selected_by_default | 45 | select: selected_by_default |
| 46 | jobs: | 46 | jobs: |
| 47 | - Build: | 47 | + CI: |
| 48 | name: CI门禁 | 48 | name: CI门禁 |
| 49 | uses: openubmc/openubmc-ci/.gitcode/workflows/ci-build.yml@main | 49 | uses: openubmc/openubmc-ci/.gitcode/workflows/ci-build.yml@main |
| @@ -1,12 +1,13 @@ | |||
| 1 | repos: | 1 | repos: |
| 2 | - repo: https://gitcode.com/openUBMC/pre-commit-hooks | 2 | - repo: https://gitcode.com/openUBMC/pre-commit-hooks |
| 3 | - rev: 0.1.0 | 3 | + rev: 0.1.4 |
| 4 | hooks: | 4 | hooks: |
| 5 | - id: conventional-commit | 5 | - id: conventional-commit |
| 6 | - id: add-signoff-and-change-id | 6 | - id: add-signoff-and-change-id |
| 7 | - id: check-sr | 7 | - id: check-sr |
| 8 | - id: check-json | 8 | - id: check-json |
| 9 | - id: check-yaml | 9 | - id: check-yaml |
| 10 | + - id: semgrep | ||
| 10 | - repo: https://gitcode.com/gh_mirrors/pr/pre-commit-hooks | 11 | - repo: https://gitcode.com/gh_mirrors/pr/pre-commit-hooks |
| 11 | rev: v6.0.0 | 12 | rev: v6.0.0 |
| 12 | hooks: | 13 | hooks: |
| @@ -27,6 +27,7 @@ pre-commit run --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG | |||
| 27 | - **check-sr**: 检查 .sr 文件 | 27 | - **check-sr**: 检查 .sr 文件 |
| 28 | - **check-json**: 检查 JSON 文件 | 28 | - **check-json**: 检查 JSON 文件 |
| 29 | - **check-yaml**: 检查 YAML 文件 | 29 | - **check-yaml**: 检查 YAML 文件 |
| 30 | +- **semgrep**: 使用内置的 92 条敏感词/内部信息规则扫描,命中即阻断提交(仅扫描本次改动的文件(增量),不支持全量扫描;规则跟随钩子仓库统一升级,无需本仓配置) | ||
| 30 | 31 | ||
| 31 | **[pre-commit-hooks (mirrored)](https://gitcode.com/gh_mirrors/pr/pre-commit-hooks)**: | 32 | **[pre-commit-hooks (mirrored)](https://gitcode.com/gh_mirrors/pr/pre-commit-hooks)**: |
| 32 | - **trailing-whitespace**: 修复行尾多余空白(排除 .vscode/) | 33 | - **trailing-whitespace**: 修复行尾多余空白(排除 .vscode/) |
🔵 Low Priority
建议:在 CONTRIBUTING.md 的 pre-commit 钩子说明中补充 semgrep 条目,说明其仅对改动文件增量扫描、命中即阻断、规则集随 openUBMC/pre-commit-hooks 的 rev 升级;若本次确实不打算改文档,则应修正 PR 描述以免与提交内容不符。