Skip to content

fix(rewrite): auto-allow read-only command rewrites - #1332

Closed
TechWizard9999 wants to merge 1 commit into
rtk-ai:developfrom
TechWizard9999:fix/rewrite-auto-allow-readonly
Closed

TechWizard9999 wants to merge 1 commit into
rtk-ai:developfrom
TechWizard9999:fix/rewrite-auto-allow-readonly

Conversation

@TechWizard9999

Copy link
Copy Markdown
Contributor

Description

This updates rewrite permission verdicts so read-only command chains are treated as explicit allow, while preserving existing security semantics for non-read-only commands.

Related Issue

Closes #1232

Changes Made

  • Added built-in read-only detection in check_command_with_rules
  • Auto-allow read-only segments (ls, grep, rg, find (safe forms), wc, cat, head, tail, stat, file)
  • Kept deny/ask precedence unchanged
  • Preserved Default -> ask behavior for non-read-only commands
  • Added tests for single read-only, compound read-only, mixed chains, ask override, and unsafe find predicates

Testing

  • rtk cargo fmt --all
  • rtk cargo clippy --all-targets
  • Targeted tests for new permission behavior

@pszymkowiak @FlorianBruniaux please review when convenient.

@rtk-release-bot

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet.

@rtk-release-bot rtk-release-bot Bot added the stale label Sep 3, 2026
@rtk-release-bot

Copy link
Copy Markdown
Contributor

Closing this pull request after a prolonged period of inactivity. If this is still relevant, please ask for it to be reopened. Thank you!

@rtk-release-bot rtk-release-bot Bot closed this Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read-only commands (ls/grep/find/wc/cat/tail) should return exit 0 from rtk rewrite, not exit 3

1 participant