Skip to content

Project-scope .claw settings can grant tool allow rules and a permission mode to an untrusted repository #3414

In review

Description

@Yeachan-Heo

Found while triaging #3412 (on main 0492eb3).

Config discovery loads two files that ship inside the repository as ConfigSource::Project (rust/crates/runtime/src/config.rs:457 <cwd>/.claw.json, :461 <cwd>/.claw/settings.json). The only trust filter applied to them is strip_untrusted_project_hooks (config.rs:684-691), which removes hooks with the comment "there is no project-hook trust approval flow yet". The permissions object is not filtered. permissions.allow is read from the merged settings (config.rs:2017), and so is permissions.defaultMode (config.rs:2073-2075).

Effect: a cloned repository can commit .claw/settings.json with {"permissions": {"allow": ["bash"]}} (or "defaultMode": "danger-full-access") and get shell commands run without a prompt in a user session opened in that checkout. In --permission-mode read-only this is the #3412 bypass. PR #3413 closes the read-only case only; workspace-write sessions are still exposed through project-scope allow rules.

Precedent: hooks from the same source are already treated as untrusted for exactly this reason. Suggested direction (owner call): treat permissions.allow and an escalating permissions.defaultMode from ConfigSource::Project the same way as hooks: ignore them with a warning until a trust-approval flow exists. deny/ask rules, which only restrict, can stay. User (~/.claw.json, ~/.claw/settings.json) and Local (.claw/settings.local.json, normally gitignored) sources are unaffected.

Related: #3412, #3413.

Activity

  1. sattyamjjain commented on Nov 29, 2026

    @sattyamjjain

    Hey @Yeachan-Heo, one data point from the Claude Code side of the same problem. Today I ran agent-audit-kit 0.6.36 (I maintain it) on a repo whose .claude/settings.json only has {"permissions": {"allow": ["Bash"]}}. It reported missing deny rules and that project settings can override user deny rules, but its broad-allow check fired only on "Bash(*)", not on bare "Bash", which allows the same commands. So if you filter project allow rules, I feel the bare tool name needs the same treatment as the wildcard. defaultMode bypassPermissions in the same file was flagged on its own.

  2. Yeachan-Heo commented on Nov 29, 2026

    @Yeachan-Heo
    ContributorAuthor

    Thanks, that matches. PR #3415 (head cf4cc72) does not match allow patterns at all: strip_untrusted_project_settings removes the whole permissions.allow array from Project-scope files, so bare bash and bash(*) are dropped the same way, with a warning. It also drops permissions.defaultMode (any value) and the legacy top-level permissionMode, and keeps deny/ask. The test project_config_permissions_cannot_grant_access uses the bare-name form ("allow":["bash"]). The PR is waiting on owner sign-off for the policy change.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions