Repository navigation
fix(safety): O117 L3 .git/config allow-list (fail-closed) + config.worktree - #117
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
QiaolongLi1201
force-pushed
the
fix/o117-git-config-l3-precise
branch
from
October 12, 2026 03:01
98a9ee2 to
4daacca
Compare
This was referenced Oct 12, 2026
QiaolongLi1201
force-pushed
the
fix/o117-git-config-l3-precise
branch
2 times, most recently
from
October 12, 2026 05:13
13577b3 to
6f419e2
Compare
…ig.worktree, name keys in last line
…cp remote.*.url by value (PM 口径)
QiaolongLi1201
force-pushed
the
fix/o117-git-config-l3-precise
branch
from
October 12, 2026 06:16
6f419e2 to
218ffba
Compare
QiaolongLi1201
added a commit
that referenced
this pull request
Oct 12, 2026
fix(safety): O123 L3 不再把普通 git commit/checkout/merge 误报为已修改(依赖 #117)
QiaolongLi1201
added a commit
that referenced
this pull request
Oct 12, 2026
QiaolongLi1201
added a commit
that referenced
this pull request
Oct 12, 2026
QiaolongLi1201
added a commit
that referenced
this pull request
Oct 12, 2026
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.
O117 — L3 对 git 配置文件改为放行名单(fail-closed)
Base
1705d9ef(#118)。人工实现。放行名单全文(
GIT_CONFIG_BENIGN_KEYS,只列具体键,无通配、无子节)变化全部落在名单内才不报;名单外任何键(含从没见过的
foo.bar)变化 → 「已被修改」,exit 9。remote / branch(PM 口径,11:03–11:05)
branch.<名>.merge、remote.<名>.fetch。branch.<名>.remote只认.、普通 remote 名([A-Za-z0-9_][A-Za-z0-9._-]*)或下面认可的 URL(它也可直接写 URL,故同样查值)。remote.<名>.url只认https://、ssh://、git@host:path(scp 式)。ext::/fd::/任何<transport>::、file://、git://、http://、本地路径(含C:\)、以-开头、含换行/控制/空白字符 → 报。host/user 以-开头报(先 URL 解码,最多 3 层,覆盖%2D/%252D);port 仅数字;scp 路径以-开头报。pushurl/uploadpack/receivepack/proxy/vcs/tagOpt/mirror、branch.*.pushRemote照报。不放行(规格没列):
extensions.*、core.repositoryformatversion、init.templateDir、user.signingKey、color.<slot>.*。受保护文件
.git/config、.git/config.worktree、.git/worktrees/<name>/config.worktree(新增)。这修掉了 QA 复现的绕过:先设repositoryformatversion=1和extensions.worktreeConfig,再在 config.worktree 里设 hooksPath。事前拦:.git下的路径已经被 O103 拦住(E4 断言),#115/O103 的代码没改。fail-closed
删除 →「被删除」;换成软链 →「被换成软链」;换成目录 →「被换成目录」;git 解析失败 →「无法解析」。全部 exit 9。
QA 三条合门
core.*/alias.*/url.*/include*/init.*/user.*/color.*都不通配(C4 断言名单全文)。section 和变量名不区分大小写,子节按 git 语义保留大小写;带子节的键一律不放行。git config --file <临时文件> --no-includes --list -z,cwd 是临时目录,HOME是临时目录,GIT_CONFIG_NOSYSTEM=1,GIT_CONFIG_GLOBAL=/dev/null。不在被测仓库里跑 git,不跟 include;解析失败按 fail-closed 处理。remote.origin.uploadpack(B6)、core.fsmonitor和[Core] FSMonitor(B9)都会被报。文案(UX)
未完成:sh x.sh:受保护路径已被修改,.git/config 改了core.hooksPath(不在安全清单内);卡在:.git/config 改了core.hooksPath(不在安全清单内).git/config changedcore.hooksPath(not on the safe list)a、b、c等 5 个 /and 2 more。混写时只点名名单外的键。只写键名,不写值。[moss-o117-protected-path-detail]标记,把键名和原因从工具结果带到 run-outcome(exec_background 也带)。测试
test/o117-git-config-l3-precise.spec.mjs:A 名单内不报;B 名单外被报(hooksPath、uploadpack、foo.bar、fsmonitor 大小写变体);C fail-closed;D execTool 端到端;E config.worktree 绕过;F 文案;G 进程级moss -p跑git config user.name x→ exit 0(zh+en)。git remote add https+ 真实git push -u/设上游 → 不报,进程级moss -pexit 0;A5/A8/A9/G3:ext::sh -c …、/tmp/evil、ssh://-oProxyCommand=…、%2D/%252D变体 → 报,-pexit 9;A7:pushurl/uploadpack 等 → 报。git diff 1705d9ef HEAD -- src | git apply -R):40 条变红,含 E1/E2 绕过和 G1 -p。npm run check绿;npm test373 个文件全过(Node 22)。