Skip to content

[Grok/dsh 10] 权限模式与持久规则 #142

Closed

Description

@Blackman99

Parent

#132

Ticket: 10

Status: ready-for-agent

User Stories: 24, 25, 27(见父规格)

What to build

用户在界面或兼容参数中控制 allow/ask/deny、自动审批及记住授权,并得到与实际工具执行一致的结果。

Acceptance criteria

  • 逐项验证固定版本的规则匹配和模式语义,包含复合命令、路径、显式 ask、记住授权和管理员锁定。
  • 显式 deny 永远不能被 allow、自动审批、旧授权或客户端入口绕过;拒绝确实无副作用。
  • 授权范围、保存失败、重启恢复与撤销在 UI 可理解,不误称本次允许为永久规则。
  • 用真实工具测试界面和非交互结果,更新说明并保持所有现有检查通过。

Blocked by

Delivery contract

用户于2026-09-20批准当前测试与任务拆分。按父规格的已安装产物/真实终端和公开协议测试验收;实际实现须带适用的文档、Changeset及必要检查。ready-for-agent表示任务已定义,不表示前置任务已完成,也不授权自动开始本轮实施、购买付费资源或发布软件版本。

Activity

  1. self-assigned this
    on Sep 21, 2026
  2. Blackman99 commented on Sep 21, 2026

    @Blackman99
    OwnerAuthor

    按用户2026-09-20的实施授权领取 Ticket10 / #142;本次只记录领取,未启动实施工作者,也不表示已实现。已重新读取 #132 及全部80票正文/评论和实际 blocked-by(native 177 边)。#141/#149/#160 已在 rewrite/grok-dsh-20260920 集成并关闭;当前独立就绪票为 #142、#150、#152、#153、#154、#165、#189、#193。本波并行领取前四张,未领取任何被阻塞后继(含 #143/#144/#145/#147/#151/#155/#156/#157/#158/#159/#163/#171/#179/#187/#192/#197/#203/#212),也未领取本波未选的其他就绪票。

    实施必须从独立集成树精确基线 2232130e9ce287aa85bc3270bb3383ab079e4efd 开始。前置 #136 与 #141 已关闭,同一提交已保留在 rewrite/grok-dsh-20260920;集成证据见 #136 (comment) 与 #141 (comment) 。#160/#149/#161/#140/#139/#138/#137/#135/#134/#133 仍为已集成关闭基线 #160 (comment) 、#149 (comment) 、#161 (comment) 、#140 (comment) 、#139 (comment) 、#138 (comment) 、#137 (comment) 、#135 (comment) 、#134 (comment) 与 #133 (comment) 。

    范围按原验收:逐项验证固定版本的规则匹配和模式语义,包含复合命令、路径、显式 ask、记住授权和管理员锁定;显式 deny 永远不能被 allow、自动审批、旧授权或客户端入口绕过,拒绝确实无副作用;授权范围、保存失败、重启恢复与撤销在 UI 可理解,不误称本次允许为永久规则;用真实工具测试界面和非交互结果,更新说明并保持所有现有检查通过。后续实施/审查子代理使用 My CPA - Grok 4.6(grk-4.6)。仅在实施、独立审查和集成验收通过后关闭。main、现有未跟踪文件及其他工作树不改动;不授权付费资源,#212仍须新的明确最终发布/默认切换批准。

  3. Blackman99 commented on Sep 22, 2026

    @Blackman99
    OwnerAuthor

    Ticket 10 / #142 不能集成。两位独立 grk-4.6 审查员均拒绝 worker HEAD e73dbe3610176c9a2c9ffc32f7e8b51831522816(基线 2232130e9ce287aa85bc3270bb3383ab079e4efd 是祖先;范围 7b9d080 → ea6b4d8 → 22fb50b → e73dbe3)。未 git fetch 后 cherry-pick、未推送、未关闭。隔离集成 HEAD 仍为 2232130e9ce287aa85bc3270bb3383ab079e4efd(2232130 )。main 仍为 43b5da1。

    集成控制器在 live JS 评估器 packages/cli/bin/rust-acp-file-approval.mjs 上独立复现(deny Bash(rm -rf *) + always-approve):

    • { rm -rf /; }、{rm -rf /}、true && { rm -rf /; }、function x { rm -rf /; }、bash -c "{ rm -rf /; }" → allow / always-approve
    • bash -c $'rm -rf /' → allow / always-approve
    • 未包装 rm -rf / 才 deny
    • dontAsk 下 sort --compress-pro=gzip file 与 sort --compress-p=gzip file → allow / read-only shell command;完整 --compress-program= 才被排除
    • 冻结指南 L165 的 git cat-file / ls-tree / check-ignore / show-ref / for-each-ref / rev-list / name-rev / count-objects / check-attr 在 dontAsk 下被拒而不是只读自动允许
    • permission::load_claude_settings 只读 cwd .claude/settings.json 与 settings.local.json,不读 ~/.claude/*、不向上走到仓库根(冻结 22-permissions-and-safety.md L279)

    CONTROL_FLOW / isUnsplittable 不含 {/};shellWords 不解码 $'...'。这违反 AC2:显式 deny 不能被 always-approve 绕过。

    修复要求:在同一 worker 工作树 /Users/zhaodongsheng/.grok/worktrees/my-projects-codsh/subagent-01a0c27f-1e3c-7cb2-ac33-722e488d1061 上修 live JS 与 rust/src/permission.rs,补 packed/ACP 用例覆盖 brace / ANSI-C -c / unique-prefix / Claude 规则来源,再经两位独立审查。不要在集成分支上手合。#132 spec 与 #212 不关闭。

  4. Blackman99 commented on Sep 23, 2026

    @Blackman99
    OwnerAuthor

    Integrated on rewrite/grok-dsh-20260920 at 0e8e8b0.

    Cherry-picked f6600c4..f119daf (15 commits) from the #142 worktree onto a0504be. The integrated tree matches f119daf.

    Verification in the integration worktree:

    • pnpm run typecheck: pass
    • TMPDIR=/tmp pnpm test: 81 files, 2284 tests passed
    • cargo fmt --check, clippy -D warnings, cargo test --locked --workspace: pass (223 + 61 + 2 + 379)
    • pnpm run build:rust, then TMPDIR=/tmp python3 scripts/rust-permission-pty-test.py: PASS
      Evidence /tmp/codsh-rust-permission-k22iawgh
      deny_pathname_glob rejected under always-approve plus Bash(rm -rf *) (the user rejected tool bash)
      git_branch_bare_upstream and git_branch_long_track blocked under dontAsk (not on the allow list)
      git_cat_file stayed allowed

    Pushed a0504be..0e8e8b0 without force. #170 stays open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions