Repository navigation
chore(security): pin Actions to SHAs and fix CodeQL findings - #22
Merged
Merged
Conversation
Task A: pin all 10 uses: in pr-ci.yml to 40-char commit SHAs. Task B: fix CodeQL alerts in forked code: - insecure-randomness: randomInt() in id-generator/crypto, counter in e2e helpers - polynomial-redos: linear stripTrailingSlashes() replaces /\/+\$/ at 4 sites - weak-crypto: sha256 replaces md5 in anthropicHandler debug fingerprints - biased-cryptographic-random: randomInt() replaces modulo on randomBytes - insufficient-password-hash: documented as lookup-index false positives
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.
摘要
一个提交同时完成两件事:加固 GitHub Actions 设置(Task A)与修复 15 个 CodeQL 告警(Task B)。全部改动最小化、自包含,便于向上游
TencentCloud/TencentDB-Agent-Memory重新套用。Task A — Actions 固定 SHA
pr-ci.yml中全部 10 处uses:固定到 40 位 commit SHA(保留# v4注释):11d5960a326750d5838078e36cf38b85af67726249933ea5288caeca8642d1e84afbd3f7d68200200057852bfaa89a56745cba8c7296529d2fc39830ea165f8d65b6e75b540449e92b4886f43607fa02d3f86a106a0bac45b974a628896c90dbdf5c8093Task B — CodeQL 修复
id-generator.ts的randomBase36()改用crypto.randomInt()(一次修复 sqlite/mongodb/metadata-service 三处调用点);e2e helper 的随机用户名后缀改为模块内自增计数器。/\/+$/全部替换为线性stripTrailingSlashes()(sdk 导出复用,MemoryCore 本地定义)。对抗性输入"/".repeat(n)+"x"实测:原正则 n=128000 需 7952ms(二次增长),新实现 n=400000 仅 0.3ms;20 万+ 用例等价性校验 0 差异。createHmac也建模为弱哈希 sink,故改 HMAC 并不能关闭该告警。anthropicHandler.ts调试指纹md5→sha256。generatePassword()改用crypto.randomInt(),消除% 63偏差。验证
MemoryCore:npm run build(tsdown + 脚本 tsc)通过;针对 src 的tsc --noEmit前后错误数均为 228,无新增。sdk/memory-core/typescript:npm run build(tsc)通过。MemoryProxy:npm run typecheck仍为基线上既有的 6 个错误,无新增。已知限制
MemoryProxy无测试,typecheck 在基线即失败(既有问题)。insufficient-password-hash告警保留(判定为查询索引误报,已注释说明)。/\/+$/模式未被 CodeQL 标记,为保持最小 diff 未改动。