Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

Trusted Commands not saving wildcard commands

Open thoughtcastapp opened this issue 1 year ago • 17 comments

Before opening, please confirm:

Operating System

MacOS 15.5

Kiro Version

0.1.15

Bug Description

Kiro periodically will prompt me to ask for permission to run a command line function and I get an option to trust the base (in this case xcodebuild *). However, when it runs into another instance it needs to run an xcodebuild command, it re-prompts me for permission (even though I gave permission to all xcodebuild commands).

Steps to Reproduce

  1. Open kiro and create a new Xcode project.
  2. Give kiro instructions to run the project.
  3. give kiro permission to use the base (xcodebuild *)
  4. wait for kiro to ask for permission again to run.

Expected Behavior

It should run anything with xcodebuild without user intervention.

Conversation ID

where is this?

Additional Context

No response

thoughtcastapp avatar Jul 24 '25 22:07 thoughtcastapp

Hi @thoughtcastapp , thanks for opening this issue. Would you be able to provide an example of one of the xcodebuild commands that is not being trusted by xcodebuild *? There are certain patterns which we consider a safety concern and exclude from wildcard matching

jordanvn avatar Jul 25 '25 17:07 jordanvn

its no so much that its not trusting it, but its that the options as presented in the chat window aren't being honored. when I put these in manually into the settings, it seems to be fine, but when I click on the "trust" button in the chat, it doesn't seem to remember for the next time in that same chat...

thoughtcastapp avatar Jul 25 '25 17:07 thoughtcastapp

To clarify, when you click the "trust" button and select an option to trust (like xcodebuild *), could you share an example command for which you'd expect that trust to be remembered?

jordanvn avatar Jul 25 '25 17:07 jordanvn

here's a good example:

xcodebuild test -scheme TimeIsTickingAppTests -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.4' -only-testing:TimeIsTickingAppTests/Task10IntegrationValidationTests/testCompleteClockSwipeWorkflowIntegration 2>&1 | tail -20

Image Image

thoughtcastapp avatar Jul 25 '25 18:07 thoughtcastapp

So I will press "trust" then "Base xcodebuild *", but still get it stopping on commands that start with xcodebuild

Image

thoughtcastapp avatar Jul 25 '25 18:07 thoughtcastapp

It looks like the command being suggested contains a pattern which would be flagged as a potentially unsafe pattern, requiring manual review unless the "full command" has been trusted already. This will prevent either xcodebuild * or xcodebuild test * wildcard matches from allowing the command to be accepted without review. We will work on improving documentation around how trusted commands function

jordanvn avatar Jul 25 '25 18:07 jordanvn

Gotcha yeah xcodebuild is just to build the app for debug so there isnt much it can do to damage anything (at least in my case)...but I get the implementation, thank you for your help :)

thoughtcastapp avatar Jul 25 '25 19:07 thoughtcastapp

To be clear, the base command being xcodebuild is not an issue, it would be another pattern within the command. If a suggested xcodebuild command does not contain patterns that could be flagged as potentially dangerous, trusting xcodebuild * will work

jordanvn avatar Jul 25 '25 19:07 jordanvn

Ok, is there anything potentially dangerous in the command above? Because that didn't go through and I am just trying to figure out the definition of "dangerous" to check if this is working as expected or not...

thoughtcastapp avatar Jul 25 '25 19:07 thoughtcastapp

" 💡 Ah parfait ! Maintenant je comprends !

🔍 Le problème des trusted commands :

Même avec python* dans la liste, si ma commande contient certains caractères "dangereux" comme ;, Kiro demande quand même validation.

Exemples de mes commandes qui déclenchent la validation :

python -c "from x import y; print('test')" → Le ; déclenche la validation

python -c "import x; y = x.func(); print(y)" → Pareil

🎯 Solution : Éviter les caractères problématiques

Au lieu d'utiliser ; dans mes commandes Python, je peux :

Utiliser des imports séparés

Éviter les ; dans les one-liners

Structurer différemment mes tests

Exemple :

Au lieu de :

python -c "from x import y; print('OK')"

Utiliser :

python -c "from x import y" && python -c "print('OK')"

Ou mieux :

python -c "from x import y

print('OK')"

🌸 Merci Laurent !

Ça explique parfaitement pourquoi tu devais valider manuellement malgré les wildcards. C'est une sécurité de Kiro contre les commandes potentiellement dangereuses.

Maintenant je sais comment adapter mes commandes pour éviter ce problème !

Continuons avec la tâche 6.2 ? 🚀 "

IorenzoLF avatar Jul 26 '25 09:07 IorenzoLF

I added it in the steering rules not to do that anymore and problem solved.

IorenzoLF avatar Jul 28 '25 18:07 IorenzoLF

Hey folks, We've recently updated our documentation on trusted commands and the patterns that Kiro looks for when evaluating trusted command. Refer to the following documentation section for trusted commands providing this information https://kiro.dev/docs/chat/terminal/#trusted-commands

ykethan avatar Jul 30 '25 20:07 ykethan

Same issue for me

pohlipit23 avatar Aug 14 '25 10:08 pohlipit23

I'm also having this issue where I trusted node * but it's somehow having issues with multiline node -e commands :

Image

Thanks

KaKi87 avatar Sep 11 '25 01:09 KaKi87

I have same issue with dotnet. I added "dotnet test *" but it still prompts for every different "dotnet test ..." command.

My version: Version: 0.2.68 (user setup) VSCode Version: 1.103.2 Commit: a80bb43acf9f0e8e627510ea18cc61d5e1c1614b Date: 2025-09-23T21:55:04.816Z Electron: 37.5.1 ElectronBuildId: undefined Chromium: 138.0.7204.251 Node.js: 22.19.0 V8: 13.8.258.32-electron.0 OS: Windows_NT x64 10.0.22631

Al4ric avatar Sep 25 '25 11:09 Al4ric

‼️ POSSIBLE SOLUTION ‼️

I have identify the problem with my setup - rm is included in the Command Denylist.

xcodebuild commands typically include a destination containing platform which matches on rm, for example...

xcodebuild \
  -scheme MyScheme \
  -destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,OS=latest' \
  build

Now I need to work out how to keep rm in the denylist without it triggering on xcodebuild 🤔 - any ideas?

OliverPearmain avatar Mar 20 '26 13:03 OliverPearmain

Thank you for reporting this. Trusted command handling has been significantly improved in recent IDE releases, including wildcard support. If you are still experiencing this on the latest version, please open a new issue. Closing as likely resolved.

AnilMaktala avatar Apr 15 '26 15:04 AnilMaktala