Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

Support regular expressions for trusted commands

Open tking2096 opened this issue 7 months ago • 4 comments

Kiro Product

IDE

Feature Description

The basic wildcard creates security concerns because the agent can string together untrusted commands following a trusted command.

For example:

Allow Kiro to run all playwright tests or any 1 test file:

{
  "kiroAgent.trustedCommands": [
    "npx playwright test",
    "npx playwright test *" // ex: tests/example.spec.ts
  ]
}

The agent can easily run any other command in the same line, such as npx playwright test tests/example.spec.ts && rm -rf ~. I regularly see the agent combine commands, so this is a real concern.

We need a way to have tighter control on what commands can be run. Regular expressions could be the solution. The following configuration would achieve the desired result without trusting commands that include & or ;, which would prevent multiple commands from being strung together in a line.

{
  "kiroAgent.trustedCommands": [
    "npx playwright test",
    "^npx playwright test [\\w\\/\\.\\-]+$" // ^npx playwright test [\w\/\.\-]+$ allows a single file path to be specified
  ]
}

Use Case

To allow Kiro to freely run tests and check its work without giving it permission to string together arbitrary commands.

Additional Context

No response

tking2096 avatar Apr 22 '26 15:04 tking2096

🤖 Potential Duplicate Detected

This issue appears to be similar to:

What happens next?

  • ⏰ This issue will be automatically closed in 3 days
  • 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
  • 💬 Comment on the original issue if you have additional information

Why is this marked as duplicate? Both report the same security vulnerability where Kiro can bypass trusted command restrictions by chaining commands with && or ; operators, and both request better command validation mechanisms

github-actions[bot] avatar Apr 22 '26 15:04 github-actions[bot]

The suggestions in #6130 only apply to CLI and the solution of regex is not mentioned. #6189 is talking about multiline commands. This issue is primarily concerned with single line commands.

tking2096 avatar Apr 22 '26 15:04 tking2096

Thank you for your feedback! 🙏

The duplicate label has been removed and this issue has been sent back for maintainer review.

A maintainer will review this issue shortly.

github-actions[bot] avatar Apr 22 '26 15:04 github-actions[bot]

We're doing a periodic backlog review and noticed this issue has been inactive for several months. Kiro has shipped a lot of changes since this was filed — we're now on IDE 1.0.309 and CLI 2.18.1 — and without any community uptake, we can't confidently prioritize it.

Closing to keep the backlog focused, but not as a dismissal. If you're still seeing this or others share the same experience, a new issue with your current version and any updated details would help us pick it back up. Issues with 👍 reactions from the community rise to the top fastest.

AnilMaktala avatar Aug 17 '26 16:08 AnilMaktala