feat(ci): add dependabot, codeql and dependency review gates - #7
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
fork 仓库缺少供应链门禁:依赖更新无自动化、代码无静态安全扫描、PR 引入的依赖无审查。本 PR 落地供应链门禁第一批。
改动
新增 3 个文件:
.github/dependabot.yml:Dependabot 每周一 03:00(Asia/Shanghai)检查 Maven(根目录)与 npm(frontend)依赖更新,open-pull-requests-limit: 10。maven-minor-patch/npm-minor-patch,applies-to: version-updates),减少每周 PR 数量;安全更新不走 group,保持单独 PR 以突出紧急度。.github/workflows/codeql.yml:CodeQL 静态安全扫描。push main + pull_request(branches: [main])+ 每周 cron。java-kotlin(autobuild 走 ./mvnw,init 前用 setup-java@v4 显式提供 temurin 17 避免 JDK 不匹配)与javascript-typescript(build-mode: none,前端无需构建)。security-and-quality:在默认规则集上叠加 security-extended 与质量规则,覆盖更全的漏洞面;代价是分析耗时与需人工复核的告警略多,符合本批"安全加固"目标。timeout-minutes: 60(Java 编译较久);permissions:contents: read/security-events: write/actions: read。.github/workflows/dependency-review.yml:依赖审查,pull_request 全量触发,fail-on-severity: high(命中 high 及以上漏洞即 PR 失败)。Maven pom.xml 与 frontend/package-lock.json 由 action 自动发现。Vulnerability alerts 状态
已通过
PUT /repos/KDB-Wind/ragent/vulnerability-alerts启用(返回 204),GET 确认 204。启用后 GitHub 报告默认分支现存 58 个漏洞(1 critical / 23 high / 32 moderate / 2 low),后续由 Dependabot 安全更新自动消化。dependency graph 对 public 仓库自动启用。验证方式
npx --yes yaml-lint三个 yaml 全部通过;actionlint v1.7.12 对两个 workflow 无错误无警告(退出码 0)。非目标(第二批)
风险说明
security-and-quality可能产生少量需人工判定的告警,属预期成本。