Skip to content

Cursor, Gemini and Droid permission loaders drop an unreadable or unparseable settings file's rules #4652

Closed

Description

@KuSh

#4287 makes the Claude Code loader fail closed when a settings file exists but cannot be read or parsed (#4282). The other hosts' loaders still go through read_json in src/hooks/permissions.rs:

  • a read error is dropped with no warning (std::fs::read_to_string(path).ok()?);
  • a parse error prints [rtk] warning: failed to parse permissions from … and returns None.

Either way, the file's rules are gone. This affects:

  • Droid (droid_settings_scopes): commandDenylist / commandBlocklist are deny rules. RTK uses them to step aside, so Droid's own block fires on the original command.
  • Cursor (load_cursor_rules, ~/.cursor/cli-config.json): Shell(...) deny rules.
  • Gemini (gemini_settings): ask and allow only. Losing them means fewer allows, which is not unsafe.

Measured for Droid on develop + #4287 (rtk hook droid, FACTORY_HOME_OVERRIDE=<dir>, .factory/settings.json = {"commandDenylist":["git push"]}, payload Execute / git push origin main):

settings.json output
valid nothing (RTK steps aside, Droid blocks)
trailing comma updatedInput.command = "rtk git push origin main", parse warning on stderr
chmod 000 updatedInput.command = "rtk git push origin main", no warning

A rewritten rtk git push … no longer matches Droid's own git push denylist entry.

Cursor shows the same pattern (rtk hook cursor, ~/.cursor/cli-config.json = {"permissions":{"deny":["Shell(git push)"]}}):

cli-config.json output
valid {} (RTK steps aside)
trailing comma "permission":"ask", updated_input.command = "rtk git push origin main", parse warning
chmod 000 the same, no warning

Suggested shape: have read_json tell missing, parsed and unreadable/unparseable apart, and have each loader fail closed in its own terms. For Droid and Cursor that means stepping aside, the way a deny match already does. OpenCode's opencode.jsonc has its own issue (#4524).

Activity

  1. rtk-wshm-sync-bot commented on Oct 18, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 90%

    Summary

    Cursor/Droid/Gemini permission loaders silently drop a file's rules on read/parse failure instead of failing closed, enabling deny-rule bypass (e.g. git push) in Droid/Cursor; related to #4287/#4282/#4651.

    📁 Relevant files
    • src/hooks/permissions.rs

    Suggested Actions

    1. Extend read_json in src/hooks/permissions.rs to distinguish missing/parsed/unreadable-or-unparseable, as done for Cla…
    2. Make droid_settings_scopes, load_cursor_rules, and gemini_settings fail closed (step aside) on read/parse errors like a…
    3. Coordinate with Permission loader: a settings file that cannot exist, or holds only a BOM, fails closed #4651 (BOM/missing-file case) and opencode.jsonc with comments: every permission rule is silently dropped #4524 (OpenCode's opencode.jsonc) since they touch the same read_json…
    4. Add regression tests mirroring the measured matrix (valid / trailing comma / chmod 000) for Droid and Cursor

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  2. Ehsan-hash commented on Oct 20, 2026

    @Ehsan-hash
    Contributor

    I am preparing a focused fix for the Cursor and Droid loader failures, with AI assistance. When an existing settings file cannot be read or parsed, RTK should leave the command unchanged so the host can apply its own checks. I am covering malformed/read-error settings, all Droid scopes, and valid/missing/empty controls through the actual hook CLI. Claude and OpenCode behavior are outside this patch. I checked the open PRs, including #4458 and #4658, and found no competing implementation of this specific failure path.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions