Repository navigation
docs: AGENTS.md 补充负面测试与静态扫描的教训 - #803
Merged
Merged
Conversation
记录 PR #800 实际踩到的坑,避免下次重蹈: - §6 负面测试不要复刻被禁止的模式:为验证 MIN_KEY_SIZE 守卫而写的 assertThatThrownBy(genKeyPairBytes(512)),本身就是 insufficient-key-size 持续报红的原因——静态分析不认你的意图,只看有没有小于 2048 的字面量流进 密钥长度参数。同类陷阱还包括注入测试里的 SQL 拼接、硬编码密钥测试。 - §7 抑制注释是假设,CI 才是判决:同一批改动里 rsa-without-oaep 的 codeql 抑制生效了,insufficient-key-size 的没有;zizmor ignore 也必须紧贴被忽略的 那个 key 而非 on:。给出 merged 前必看的 gating 检查清单。 - §0 补充说明 dev 的分支保护是技术强制而非约定,并明确「单人维护者必须保持 0 个必需审批」,防止后来者按教科书把它调上去导致仓库无法维护。
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.
记录 PR #800 / #802 实际踩到的坑并固化到 AGENTS.md,供后续 AI 代理与贡献者照做。
为什么
两次 CI 红灯都不是本地能发现的问题,且根因反直觉:
MIN_KEY_SIZE守卫真的生效而写的负面测试assertThatThrownBy(() -> genKeyPairBytes(512)),本身就是insufficient-key-size持续报红的原因。静态分析不认意图,只认有没有小于 2048 的整型字面量流进密钥长度参数——连续三轮 CI 红灯期间本地./gradlew test一直全绿。// codeql[rule-id]抑制注释不可全信:同一批改动里rsa-without-oaep的两条抑制生效,insufficient-key-size的那条没有;zizmor: ignore还必须紧贴被忽略的那个 key(pull_request_target:)而非on:,放错位置不报错,只是告警永远不消失。影响面
纯文档,不触碰 Java 代码与 workflow。
自检清单
./gradlew :dynamic-datasource-creator:test :dynamic-datasource-spring:test通过;全模块compileJava compileTestJava通过AGENTS.md为 Markdown,非 Java 文件docs:),一个 commit 做一件事其他信息
本 PR 同时承担一个验证作用:它是给
dev开启分支保护后的第一个 PR。若能被正常合并,即证明「强制走 PR」与「单人维护者可自行合并」两者可以共存(required_approving_review_count显式设为 0,enforce_admins为 true)。