zai-org / zai-org/feedback

权限「始终允许本项目」记整条命令精确匹配,规则迅速失配;且无规则管理入口

Open
#673 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

使用环境

  • macOS 15(darwin 24.6.0, arm64)
  • ZCode 桌面 3.12.2(build 7410,preview 频道),内置 CLI 0.16.5

问题描述(附本机量化数据)

  1. 「始终允许本项目」对 Bash 记录的是整条命令的精确匹配。本机近几天日志 145 次权限弹窗中 Bash 占 97 次(67%),其中 132 次都选了「始终允许本项目」;默认工作区已积累 322 条 allow 规则,绝大多数是整条命令原文(含多行 python3 -c、复合 && 命令)。参数一变就失配,于是再弹——规则越攒越多,弹窗并没有减少。
  2. 引擎本身支持前缀规则,但桌面弹窗没用上。db 中 ruleset 格式支持 cmd:* 词边界前缀和 glob,suggestedPermissionUpdates 也会生成前缀规则,但桌面弹窗「始终允许」实际落库的大多是精确整串(本机 13 个有规则的项目里只有 2 个存在 :* 规则)。建议弹窗提供「始终允许此类命令(按前缀)」选项,或默认采用前缀规则。
  3. 细粒度权限规则没有任何管理入口。无 /permissions 等价命令、无设置面板,用户无法查看或清理已记住的规则(只能直接改 db.sqlite)。
  4. permission.autoApproveHighRisk 对 Bash 无效。Bash 工具 needsApproval=true,最终仍走 ask 分支,开关形同虚设。
  5. CLI --help 里的 Bash(git *) 示例没有对应解析器(残留文案),Claude Code 迁移用户会误以为支持文件级 permissions 规则。

期望表现

  • 「始终允许」默认或可选记录前缀规则(如 git:*);提供查看/编辑/清除已记住规则的 UI 或命令。
  • autoApproveHighRisk 对 Bash 生效或移除;--help 文案与实际能力一致。

复现步骤

  1. 权限档位选「变更前确认」或「自动编辑文件」。
  2. 让 agent 执行 git status,弹窗选「始终允许本项目」。
  3. 再执行 git log --oneline -5 → 仍然弹窗(上一步记住的是精确整串,未命中)。

日志与数据

  • ~/.zcode/cli/log/zcode-2026-09-1*.jsonltool.permission.resolved 统计(145 次/工具分布/用户选择分布)。
  • ~/.zcode/cli/db/db.sqlite local_setting 表 namespace=permission 的 ruleset 导出(322 条规则样例可提供)。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the permission ruleset in db.sqlite, the Bash permission flow, and the tool.permission.resolved entries in the cited JSONL logs. Check the CLI --help output and the autoApproveHighRisk path to map the current behavior. Done means prefix-rule support, a way to view and edit remembered rules, correct Bash handling for the setting, and help text matching the implemented syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, macos, sqlite
Domain
cli, desktop, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.