Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

Bug: Trusted Commands Wildcard Pattern Matching Failure

Open ttalamo123 opened this issue 1 year ago • 4 comments

Summary

Trusted commands with wildcard patterns (e.g., "ls *") are not being recognized when executing commands that should match the pattern. The system continues to prompt for approval even after the wildcard pattern has been marked as "universally trusted."

Environment

  • Operating System: macOS 26.1 (Build 25B5062e)
  • Platform: darwin
  • Shell: zsh
  • Kiro Model: claude-sonnet-4.5

Expected Behavior

When a command pattern like "ls *" is added to the trusted commands list, any command starting with ls followed by any arguments should be automatically approved without prompting the user.

For example, if "ls *" is trusted, these commands should execute without approval prompts:

  • ls -la
  • ls ~/.kiro/settings/
  • ls -lh *.png
  • ls -la /tmp/

Actual Behavior

Despite having "ls *" in the trusted commands list, Kiro continues to prompt for approval on every ls command variation. The wildcard pattern matching is not working as expected.

Steps to Reproduce

  1. Execute an ls command (e.g., ls -la ~/.kiro/)
  2. When prompted, approve the command and select "Trust universally" with pattern "ls *"
  3. Execute a different ls command variation (e.g., ls -lh /tmp/)
  4. Observe that Kiro prompts for approval again, despite the wildcard pattern being trusted

Configuration Evidence

Trusted Commands Location

~/Library/Application Support/Kiro/User/settings.json

Other Affected Wildcard Patterns

The issue appears to affect all wildcard patterns, not just ls:

  • "mv *" - trusted but still prompts
  • "xcodebuild *" - trusted but still prompts
  • "swift *" - trusted but still prompts
  • "chmod *" - trusted but still prompts

Impact

  • Severity: Medium
  • Frequency: Every command execution that should match a trusted pattern
  • User Experience: Significantly degrades workflow efficiency as users must repeatedly approve commands they've already marked as universally trusted
  • Workaround: None effective

Root Cause Analysis

The trusted commands feature appears to be performing exact string matching instead of pattern matching. When comparing an executed command against the trusted list, the system is not properly interpreting the * wildcard as "match any characters."

Suggested Fix

Implement proper glob pattern matching or regex matching for trusted commands:

  1. When a command is executed, iterate through trusted commands
  2. For patterns containing *, convert to regex or use glob matching
  3. If the executed command matches any trusted pattern, auto-approve
  4. Example: "ls *" should match any command matching regex ^ls\\s.*$

Reproduction Rate

100% - occurs every time a command is executed that should match a trusted wildcard pattern

ttalamo123 avatar Oct 21 '25 01:10 ttalamo123

Yeah, came here just to report the same. In my case, it randomly asks me to accept a command, even though the command was marked as trusted with the wildcard symbol (e.g. go test *)

casidiablo avatar Oct 23 '25 13:10 casidiablo

Might be related to #3499

jfiore-pg avatar Oct 25 '25 18:10 jfiore-pg

same here wtf

calvin-oen avatar Jan 05 '26 06:01 calvin-oen

Hi @ttalamo123 , We have implemented significant improvements in recent versions of Kiro. We recommend upgrading to the latest version to benefit from these enhancements. If you continue to experience issues after upgrading, please submit a new issue with detailed information about the problem.

AnilMaktala avatar Jan 12 '26 15:01 AnilMaktala