Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

Trusted Commands don't work when piped

Open jenyangk opened this issue 1 year ago • 8 comments

Before opening, please confirm:

Operating System

darwin

Kiro Version

0.1.9

Bug Description

Adding all the commands used in a pipe to the Trusted Commands list doesn't allow Kiro to run the commands automatically. It will still prompt to "Trust/Run" the command with pipes.

Image Image

Additionally, it should also recommend adding, in this case:

  • grep *
  • head *

To the Trusted Commands list too.

Steps to Reproduce

  1. Add npx eslint *, grep * and head * to the trusted commands list.
  2. Prompt Kiro to look for linting errors in a Typescript file
  3. A prompt will show asking the user to "Cancel/Trust/Run"

Expected Behavior

Kiro should have trusted the commands even though they were used in a pipe.

Conversation ID

77cb5adb-3365-44bd-8bf4-1c11e58720c5

Additional Context

No response

jenyangk avatar Jul 17 '25 14:07 jenyangk

Running into the same issue as well..hope they fix it soon

AnthonyGrover avatar Jul 18 '25 04:07 AnthonyGrover

Hey @jenyangk, thank you for reaching out. We are currently actively tracking this on https://github.com/kirodotdev/Kiro/issues/22.

ykethan avatar Jul 22 '25 19:07 ykethan

Hi @jenyangk , reopening this issue – thanks for bringing this up. Piped commands are expected to be handled so long as every command in them has been trusted. However, pipe characters within commands, such as the one in grep -B1 -A1 "no-unused-vars\|@typescript-eslint/no-unused-vars" will require the command to be verified.

We will also take into consideration the suggestion to have the option to trust the various parts of a piped command.

jordanvn avatar Jul 24 '25 21:07 jordanvn

Thanks for the clarification! @jordanvn

jenyangk avatar Jul 26 '25 00:07 jenyangk

Hi @jenyangk , reopening this issue – thanks for bringing this up. Piped commands are expected to be handled so long as every command in them has been trusted. However, pipe characters within commands, such as the one in grep -B1 -A1 "no-unused-vars\|@typescript-eslint/no-unused-vars" will require the command to be verified.

We will also take into consideration the suggestion to have the option to trust the various parts of a piped command.

That is not what your documentation says, but it is certainly the behavior I would want to see.
https://kiro.dev/docs/chat/terminal/#full-wildcard-matching--complex-commands states:

"The trust system only checks the beginning of the command string - if it matches, the entire command is trusted, including any chained commands, pipes, or redirects that follow."

That suggests that trusting grep * would also allow for grep foo ./bar.txt && rm -Rf /. Given the tendency of your agent to get creative when terminal commands don't work as expected, I could see it intentionally jailbreaking like this, which means any wildcarded command would become a huge risk.

Can you confirm that the documentation is incorrect and that every command in a chain must be on the approved list?

tejaycar avatar Dec 03 '25 16:12 tejaycar

I can confirm that the documentation is correct, anything after a star is implicitly trusted.

On a fresh install and profile of Kiro, I trusted uv run * and nothing else. Commands like uv run pytest | tail -n 10 work without prompting.

Later, when the agent wanted to run tail -n 10, it came back to ask for permission.

This limitation, even if documented, makes the entire "command trust" system borderline useless. Adding a star to anything makes it possible for anything at all to come after. The alternative is to add a trust rule for every command and argument permutation which is just no feasible.

luke-dingle avatar Mar 11 '26 02:03 luke-dingle

There seems to be a security risk in allowing "*" to run anything (including pipes) as @tejaycar has mentioned. I would expect that * indicates evaluating everything up to a pipe or another operator (&& or ||, etc). This would allow discrete chaining of trusted commands and provide confidence that the agent cannot just suddenly run something like grep foo ./bar.txt && rm -Rf / if grep * is a trusted command.

So, if Kiro encounters a command like uv run * and nothing else, a command like uv run pytest | tail -n 10 would prompt the user. However, if the tail * command is likewise trusted, the uv run pytest | tail -n 10 command would run just fine without prompt.

bbbco avatar Jun 03 '26 16:06 bbbco

I agree that all commands' trust in piped scenarios should be evaluated separately. I often see Kiro start commands with cd like: cd /my/project/folder && do-the-stuff command. The trust option suggests trusting the cd *, which basically makes everything allowed (globally), which is very dangerous and not desired.

alekwo avatar Jun 22 '26 11:06 alekwo