Commit graph

8 commits

Author SHA1 Message Date
LaZzyMan
ce3dfab18c fix(permissions): allow non-core tools to bypass coreTools allowlist
The coreTools configuration was incorrectly restricting all tools including
MCP, Skill, Agent, and other dynamically discovered tools. These tools should
not be subject to the coreTools whitelist as they are either:
- Dynamically discovered from user configuration (MCP tools)
- Essential for system operation (skill, agent, exit_plan_mode, ask_user_question)

This fix introduces a CORE_TOOLS set that explicitly lists built-in tools
subject to coreTools allowlist. Tools not in this set bypass the check.

Fixes #2782

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-03 10:39:39 +08:00
LaZzyMan
585bce06d2 Merge branch 'fix-permission-issues' into fix/acp-permission-flow 2026-03-27 10:05:01 +08:00
LaZzyMan
dd518de5b0 fix(acp): align permission flow across clients 2026-03-26 23:25:04 +08:00
LaZzyMan
a5a8ec5d67 feat: human-readable permission labels, deny rule feedback, and multi-dir search tests
- Add buildHumanReadableRuleLabel() to convert raw permission rules into
  natural-language descriptions for the 'Always Allow' UI options
- Add PermissionManager.findMatchingDenyRule() to surface which deny rule
  caused a tool to be blocked, improving error messages in coreToolScheduler
- Update ToolConfirmationMessage to use friendly labels with i18n support
- Add comprehensive tests for new permission features and multi-directory
  search in glob, grep, and ripGrep tools
- Fix integration test for tool-control allowedTools configuration
2026-03-24 19:47:07 +08:00
LaZzyMan
6fee1ebeb8 fix workspace dirs 2026-03-11 15:24:08 +08:00
LaZzyMan
715fc1a649 feat(permissions): prevent shell bypass of Read/Edit/WebFetch rules
Shell commands that are semantically equivalent to file/network tool
operations are now analyzed and matched against Read/Edit/Write/
WebFetch/ListFiles permission rules, preventing agents from bypassing
configured rules via the run_shell_command tool.

New file: packages/core/src/permissions/shell-semantics.ts
- extractShellOperations(cmd, cwd) => ShellOperation[]
- Covers 50+ commands: cat/head/tail/diff/grep/rg/ls/find/tree,
  touch/mkdir/cp/mv/rm/chmod/chown/sed/awk/dd/curl/wget + redirects
- Handles transparent prefixes: sudo (-u/-g flag values), env, timeout
  (skips DURATION), nohup, nice, time, etc.
- Tokenizer respects single/double quotes and backslash escapes
- Redirect extraction: >, >>, <, 2>, &>

Changes: packages/core/src/permissions/permission-manager.ts
- DECISION_PRIORITY constant for combining decisions
- evaluateSingle(): after base Bash-rule decision, evaluate virtual ops
  from shell semantics and return the most restrictive result
- evaluateShellVirtualOps(): evaluate ShellOperation list via evaluateSingle
- hasRelevantRules(): also check virtual ops so confirmation dialog appears
  when Read/Edit/etc. rules match equivalent shell commands

Changes: packages/core/src/permissions/index.ts
- Export extractShellOperations and ShellOperation

Tests: packages/core/src/permissions/shell-semantics.test.ts
- 52 unit tests: read/list/write/edit/web_fetch ops, redirections,
  prefix commands (sudo -u, timeout DURATION), quotes, variable filtering
2026-03-11 11:45:44 +08:00
LaZzyMan
db0e373ad7 feat test tool permissions 2026-03-10 16:30:22 +08:00
LaZzyMan
eeb4d85785 feat(permissions): add permission system and rename folder trust command 2026-03-04 19:24:43 +08:00