Repository navigation
test(safety): O97a ln/touch/rm/shred 受保护路径用例 + O97b .moss/config.json 不泄密 - #99
Merged
Merged
Conversation
…s/config.json no-leak
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
O97a + O97b:#92 合后跟进(只加测试)
对应 QA 安全复审
qa/o97-pr92-security-review.md§3 里的两条存疑项 1、2。这个 PR 只新增一个测试文件test/o97-followup-protected-and-config.spec.mjs,src 一行没改。O97a:ln / touch / rm / shred
detectShellWriteTargets:ln -s、ln -sf、touch、touch -c、rm、rm -f、shred、shred -u都识别为写目标(8 条)。findProtectedWrite:同样 8 条命令,在文件被锁时都会被拦;换成别的文件则不拦。.git/、~/.ssh、shell rc、.env、.moss/config.json时,都能命中,类别和操作(write 或 delete)也对;普通文件不命中。O97b:
.moss/config.json不泄密先局部读,再 edit 项目里的
.moss/config.json(里面放了一个特征明显的 apiKey)。断言:拒绝信息里写明「not attached for credential files」;不带[full file:;不出现密钥、apiKey/"model"、首行、字符/字节/行数;文件仍然锁着、内容没改。撤掉拦截会变红(实测)
shell-write-detect.ts里ln和touch/rm/unlink/shred两个 case 删掉:17/19 红(剩下 2 条是「不误拦」护栏)。tool-helpers.ts里isMossCredentialPath的判断删掉:O97b 变红。shell-write-detect、partial-read-recovery、o94-protected-paths一起跑共 66/66 绿。npm run check本地绿(Node 22.16)。顺带发现(不在本 PR 范围,请 QA 看)
read_file不带 offset 读项目.moss/config.json时,工具结果里的 apiKey 是原文(假的sk-ZZZ…实测没被脱敏)。本 PR 只断言局部读回附这条路径;完整读要不要拦或脱敏,请 QA 定。