Skip to content

Commit 3511432

Browse files
chore(claude): ask before a glob spelling of the four allowed commit and push forms (#38397)
Closes #38356 Clause-②: no Metadata-protocol: none Rule-change: ruled Ruling-ref: the maintainer, verbatim in the security#2 session on 2026-11-28: 「按建议」 on the delta review 7238071861 of PR #38077, recorded in comment 7241046206 on #38074; the option it chose cards the glob-character guards separately, as this card. The ruling's recorded words name the branch argument; the six commit-file rows (`-F` and `--allow-empty -F`) come from this card's own scope (#38356) and the delta reviewer's measured candidate set. ## 维护者速读 - 用户无感:云端值班席位提交和推送自己的卡分支、信箱分支时,写法里带通配符的变体改为先弹审批,四条原样写法照旧免审批。 - 为什么做:命令行会先把问号、方括号、星号展开成别的内容,免审批规则却按原样匹配,带通配符的写法可能推出不该推的分支。 - 出错会怎样:最坏是席位在这几种少见写法上多弹一次审批;撤回只需删掉这十行。 - 要你做什么:审阅后亲自合并这个草稿 PR。 ## What changes `.claude/settings.json`, `permissions.ask` gains ten rows, after the two literal-`*` push guards from #38077: ``` "Bash(git push -u origin claude/issue-*?*)", "Bash(git push -u origin claude/issue-*[*)", "Bash(git push -u origin claude/mailbox-*?*)", "Bash(git push -u origin claude/mailbox-*[*)", "Bash(git commit -F *\\**)", "Bash(git commit -F *?*)", "Bash(git commit -F *[*)", "Bash(git commit --allow-empty -F *\\**)", "Bash(git commit --allow-empty -F *?*)", "Bash(git commit --allow-empty -F *[*)" ``` Each of the four allowed forms now has an ask guard for `?`, `[` and a literal `*` in its argument. The two push forms already had the literal-`*` guard (#38077), so it is not repeated. Nothing else in the file changes: the allow list, the deny roster (17 GitHub content-write tools) and the hooks are as on `main`. ## Why The shell expands `?`, `[...]` and `*` in the argument against files in the working directory before the command runs. The permission matcher reads the argument as typed, so a spelling that matches only the allow rule could expand into a form the ask rules exist to stop. On `main` the sandbox measurement below shows it: `git push -u origin claude/mailbox-ui-4?pwned-glob`, the `[^a]` and `[!a]` spellings, and the same on the card-branch family, ran without approval and created `refs/heads/pwned-glob` on the sandbox origin. `git commit -F m*` and `-F *` also ran without approval. ## Reach Measured end to end: the CLI binary, driven against a mocked model endpoint in throwaway sandbox repos, default mode unless stated. Precedence is deny, then ask, then allow. **Runs without approval** (unchanged from `main`): - the four bare forms: `git commit -F FILE`, `git commit --allow-empty -F FILE`, `git push -u origin claude/issue-N-SLUG`, `git push -u origin claude/mailbox-SLUG`; - the wrapper, redirect, chain and read-only pipe shapes listed in #38077's Reach section, for example `timeout 30 ...`, `... 2>&1 | tail -5`, two allowed commands joined by `&&` or `;`; - a `*` that is not in the argument: a trailing `# *` comment, or `grep '*'` after a pipe. **An ask rule prompts for** (new rows, this PR): - `?` anywhere in the branch argument of either push family, for example `claude/mailbox-ui-4?pwned-glob`, `claude/issue-?-x`, `claude/mailbox-?i-4`; - `[` anywhere in the branch argument of either push family: `[x]`, `[^a]`, `[!a]`, a range (`[:]` already asked on `main` through the `:**` guard); - `?`, `[` or a literal `*` in the message-file argument of `git commit -F` and `git commit --allow-empty -F`: `m*`, `*`, `m?g`, `ms?`, `m[s]g`, `m[^x]g`, `m[!x]g`, `m[a-z]g`. **An ask rule prompts for** (already on `main`, held): anything after the branch or the message file, a `src:dst` refspec, a literal `*` in the branch argument, and arguments fed through `xargs`. **Prompts for another reason, or matches no rule:** unchanged from `main`, as #38077's Reach section lists. A quoted or backslash-escaped `?`, `[` or `*` in the argument now asks by rule on all four forms, although the shell would not expand it: on the commit forms it ran before this PR; on the push forms a quoted `*` already asked. Glob spellings behind a pipe prompt as a subcommand prompt rather than a top-level rule ask. **Not guarded here:** tilde expansion (`-F ~/x`), which is not a glob and ran before and after. ## Readings - `node scripts/pm/check-settings-deny-roster.mjs`: EXIT=0, `17 content-write tool(s) declared = enforced`. - JSON parse of `.claude/settings.json`: EXIT=0. - `node scripts/pm/mailbox-open.mjs --self-test`: EXIT=0, `93 cases in 10 batteries pass`. - End to end, `main` (ff69bca) against this head (6d072bb), 566 command shapes: 40 that ran without approval now ask by rule. Nothing else changes, and nothing that prompted before runs now. <details><summary>End to end, before (ff69bca) and after (6d072bb)</summary> Each shape is one fresh CLI session in its own sandbox repo with a bare `origin`, a mocked model endpoint that emits the one Bash call, and the head's `permissions` block as project settings. Every prompt was answered "deny". RAN = executed with no prompt. ASK(rule) = an ask rule matched the line. PROMPT(...) = a prompt raised for another reason. Both heads were run in this session, same binary. No session reached a real model endpoint. Sets: the 526 shapes of #38077's review (main 116, xargs/wrapper/chain 41, glob/continuation 29, acceptEdits 10, round-3 extras 9 + 158 + 163) and 40 glob shapes added for this card (9 per commit form, 11 per push family). ``` before after RAN 116 76 ASK(rule) 167 207 PROMPT(subcommandResults) 186 186 PROMPT(other) 87 87 PROMPT(safetyCheck) 4 4 PROMPT(unclassified) 6 6 ``` Every row that changed (all RAN before, ASK(rule) after): ``` set id command e2e p58 git push -u origin claude/mailbox-?i-4 e2e c47 git commit --allow-empty -F * e2e c48 git commit --allow-empty -F m* e2e c49 git commit -F * y y01 git push -u origin claude/mailbox-ui-4?pwned-glob (before: created refs/heads/pwned-glob) y y06 git push -u origin claude/issue-1-x?pwned-glob (before: created refs/heads/pwned-glob) y y18 git commit --allow-empty -F * y y19 git commit --allow-empty -F m* v v1 git push -u origin claude/mailbox-ui-4[^a]pwned-glob (before: created refs/heads/pwned-glob) v v2 git push -u origin claude/issue-1-x[!a]pwned-glob (before: created refs/heads/pwned-glob) glob cf01..cf08 git commit -F m* * m?g ms? m[s]g m[^x]g m[!x]g m[a-z]g glob ca01..ca08 git commit --allow-empty -F (the same eight arguments) glob pi01..pi03 git push -u origin claude/issue-1-x ?pwned-glob [^a]pwned-glob [!a]pwned-glob glob pi06 pi07 git push -u origin claude/issue-1-x? claude/issue-1-x[x] glob pi10 pi11 git push -u origin claude/issue-?-x claude/issue-[1]-x glob pm01..pm03 git push -u origin claude/mailbox-ui-4 ?pwned-glob [^a]pwned-glob [!a]pwned-glob glob pm06 pm07 git push -u origin claude/mailbox-ui-4? claude/mailbox-ui-4[x] glob pm10 pm11 git push -u origin claude/mailbox-?i-4 claude/mailbox-[u]i-4 ``` Held at both heads: the four bare forms RAN (glob cf00, ca00, pi00, pm00; e2e c01, c18, i01, p01), each making its commit or creating its own branch on the sandbox origin; the literal-`*` push shapes and `[:]` asked by rule before and after (pi04, pi05, pi12, pm04, pm05, pm12). Per-set totals, before / after: e2e RAN 29 / 25, y RAN 5 / 1, v RAN 2 / 0, glob RAN 34 / 4; x, z, z2 and acceptEdits identical. </details> <details><summary>Local gate readings at 6d072bb</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 18 commands for this one path; all 18 ran and exited 0. `check:doc-formula-expressions` first exited 3 (prerequisite: `@objectstack/formula` and `@objectstack/lint` unbuilt, nothing measured); after building those two it exited 0. The always-runs tail and the type-check lanes are CI's. </details> Files to read first: `.claude/settings.json`, the ask block, the ten rows after `claude/mailbox-*\\**`. Two-minute check: `node scripts/pm/check-settings-deny-roster.mjs` prints `17 content-write tool(s) declared = enforced`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017xRBcW9L8Noz9BxEwjwiov <!-- signed: security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov --> Co-authored-by: Claude <noreply@anthropic.com>
1 parent f42bcc1 commit 3511432

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎.claude/settings.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@
100100
"Bash(git push -u origin claude/mailbox-*:**)",
101101
"Bash(git push -u origin claude/issue-*\\**)",
102102
"Bash(git push -u origin claude/mailbox-*\\**)",
103+
"Bash(git push -u origin claude/issue-*?*)",
104+
"Bash(git push -u origin claude/issue-*[*)",
105+
"Bash(git push -u origin claude/mailbox-*?*)",
106+
"Bash(git push -u origin claude/mailbox-*[*)",
107+
"Bash(git commit -F *\\**)",
108+
"Bash(git commit -F *?*)",
109+
"Bash(git commit -F *[*)",
110+
"Bash(git commit --allow-empty -F *\\**)",
111+
"Bash(git commit --allow-empty -F *?*)",
112+
"Bash(git commit --allow-empty -F *[*)",
103113
"Bash(xargs git push -u origin claude/issue-*)",
104114
"Bash(xargs git push -u origin claude/mailbox-*)",
105115
"Bash(xargs git commit -F *)",

0 commit comments

Comments
 (0)