Repository navigation
feat(safety): O101 间接写受保护路径三层检测(inline/script/post-run) - #101
Merged
Merged
Conversation
…post-run) Three layers on top of O94/O97: 1) Inline python -c / node -e / bash -c with protected-path literals 2) Pre-run scan of workspace scripts (skip npm test/pytest/node --test) 3) Post-run metadata snapshot (mtime/size/hash only) → O98 incomplete Best-effort interception, not a sandbox. No auto-restore; notices say 「已被修改」not「已拦截」. Delayed background writes are a known limit.
- Attach layer-3 notice on signal-kill and non-zero exit paths too (command already ran; detect after any exit). - A1–A3 assert O101 inline source metadata (revert-red for O101 path; -p deny itself still covered by O97 mentions). - D4 asserts filterExpectedGitMetadataChanges empties git porcelain.
|
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.
Summary(中文)
实现 O101(间接写受保护路径),规格见仓库外
/workspace/specs/O101.md(本 PR 按该规格验收)。在 O94/O97 之上补三层(尽力拦截,不是沙箱;无自动还原;无项目/环境/模型可关闭或缩小检测的开关):
python -c/node -e/bash -c中字面受保护路径 → 走 O94 确认(-p拒绝);提示带脚本名与行号。npm test/pytest/node --test等不展开。~/.ssh、.env*、.git/{config,HEAD,refs,hooks}的 mtime/size/hash(内容与完整哈希不进日志/outcome/工具结果)。命中后文案用「已被修改」而非「已拦截」;接 O98 run-outcome → 未完成 + 非 0;不自动还原。受保护路径定义复用 O94/O97,不另起一份。
相对 Grok 草稿的适配
adf2d987cherry-pick 到 tipf26ff95a(含 fix(loop-guard): O96 do not treat lint/test non-zero exits as broken exec #97/fix(config): O93 agent.reasoningBudget 支持 config set/show/env #98)。source元数据(撤修复变红);-p拒绝本身仍可由 O97 命令行 mention 覆盖。filterExpectedGitMetadataChanges清空普通 git porcelain 的 HEAD/refs 误报。开销(验收 F)
真 API:
takeProtectedPathSnapshot+ After +diffProtectedPathSnapshots(head9f07daf1),15 条受保护路径,n=100(warmup 5)。此前 PR 里 ~0.38 ms 是更松的 box 口径;上表为同 fixture 对照。DeepSeek 首装 5 次中位数 / 长任务 ≤5% 增量仍待 UX/QA(无 key 可不挡)。
已知局限(文档已写)
&/nohup)可能躲过事后对比。Summary (English)
Implements O101 (indirect writes to protected paths) per
/workspace/specs/O101.md.Three layers on O94/O97 (best-effort, not a sandbox; no auto-restore; no kill-switch projects/env/model can disable or shrink):
python -c/node -e/bash -cliterals → O94 confirm (-pdenies); prompt names script + line.npm test/pytest/node --test.~/.ssh,.env*,.git/{config,HEAD,refs,hooks}(mtime/size/hash only — never contents / full hashes in logs/outcome/tool results). Notices say 「已被修改」/ “modified”, not intercepted. Wires to O98 run-outcome → incomplete + non-zero. No auto-restore.Protected-path definitions are reused from O94/O97 only.
Adapted from Grok draft
adf2d987onto tipf26ff95a(fix(loop-guard): O96 do not treat lint/test non-zero exits as broken exec #97+fix(config): O93 agent.reasoningBudget 支持 config set/show/env #98).Test plan
node test/o101-indirect-writes.spec.mjs— 26/26 passo94-protected-paths73/73,o97-followup19/19,run-completion-o98ok,shell-write-detect36/36,shell-write-sandbox57/57npm run check— format/lint/typecheck 0Spec pointers
/workspace/specs/O101.md/workspace/research/o101-indirect-writes.md