Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

ignores allowed commands

Open solvermodels opened this issue 1 year ago • 10 comments

Before opening, please confirm:

Operating System

win32

Kiro Version

0.1.42

Bug Description

i have added uv* and uv run* to allowed commands but each time it asks me to run commands manually

Steps to Reproduce

  1. Open Kiro
  2. Add uv* and uv run* to commands allowed for execution
  3. Start Spec
  4. Go through phases to task implementation
  5. almost every uv run system asks users permission

Expected Behavior

every command starting with uv must run automatically

Conversation ID

cdabc538-c752-4395-8ee7-50ec6f7b340d 2a56bc30-b458-4169-b4c0-057782d993dd 02f135b3-18d5-46a1-8971-4acaaa0007be 20dde51a-4dbb-47cf-a13c-9a7213ca0b6b fdb9b3f7-bea7-4250-9d93-b07581934135

Additional Context

No response

solvermodels avatar Aug 05 '25 19:08 solvermodels

Hey @solvermodels, could you provide us the commands that were being run on the chat? The chat may flag certain commands patterns that may require to trust the full command or individual commands, do refer to the documentation providing this information: https://kiro.dev/docs/chat/terminal/#trusted-commands

ykethan avatar Aug 06 '25 04:08 ykethan

I have the understanding that some commands even if they are trusted needs to be manually checked, this is unfortunately inconvenient. there should be checkbox 'i acknowledge all risk and accept them' and then real auto-mode enables

solvermodels avatar Aug 10 '25 20:08 solvermodels

@solvermodels not necessarily, the command is flagged only if the they contain patterns that would manual review. But if the commands are chained for example npm i && npm run build, it can be auto-run if your trusted command has npm * or the partial matches you would like to allow. Do upgrade to the latest version v0.2.0 which contains further improvements on the chained commands. https://kiro.dev/docs/chat/terminal/#chained-commands

ykethan avatar Aug 12 '25 22:08 ykethan

Having the same issue. Trusted based commands like npm* aren't remembered across sessions. Even sometimes within the session I have to re-trust the same command multiple times

pohlipit23 avatar Aug 13 '25 02:08 pohlipit23

uv run python -c "import pytest; print('pytest available')"

When agent tried to run this command it's not chained command but it was flagged. The main reason is no way to make it trust command that kind of commands even if I already set as trust command. And Kiro keep runs that kind of commands.

FYI. I already updated to the latest version.

Image

jen6 avatar Aug 14 '25 15:08 jen6

@ykethan Could you please take a look at my previous comment?

jen6 avatar Aug 17 '25 02:08 jen6

Hey @jen6, thanks for providing this information. In addition to the list of trusted commands, Kiro will also watch for certain patterns within the suggested commands to determine whether or not a command requires your review. So if a command you've already trusted, such as python -c * still requires your review, it might be because it contains a pattern we have flagged for manual review, in this case ; (Command separator). Trusting the full command should not re-flag for a review on the next run You can find the list of patterns in our documentation.

ykethan avatar Aug 18 '25 18:08 ykethan

Was also having the same issue with python -c *

idiovoidi avatar Sep 26 '25 05:09 idiovoidi

For who still suffered by this issue. This hook can prevent agent runs inline python commands.

{
    "id": "ban-inline-python-commands",
    "name": "Discourage Inline Python Commands",
    "description": "Prevents inline Python commands and promotes proper testing practices with dedicated test files",
    "version": "1.0.0",
    "trigger": {
        "event": "before_command_execution",
        "conditions": [
            {
                "field": "command",
                "operator": "matches_regex",
                "value": "(python|uv run python)\\s+-c\\s+[\"'].*[\"']"
            }
        ]
    },
    "prompt": "You're about to run an inline Python command:\n`{{command}}`\n\n**This is discouraged for the following reasons:**\n\n Instead, please:**\n\n1. **For Testing/Verification:**\n   ```bash\n   # Create a proper test file\n   mkdir -p tests\n   cat > tests/test_{{feature_name}}.py << 'EOF'\n   import pytest\n   \n   def test_{{test_name}}():\n       # Your test code here\n       assert True\n   EOF\n   \n   # Run with pytest\n python -m pytest tests/test_{{feature_name}}.py -v\n   ```\n\n2. **For Quick Scripts:**\n   ```bash\n   # Create a script file\n   cat > scripts/{{script_name}}.py << 'EOF'\n   #!/usr/bin/env python3\n   # Your code here\n   EOF\n   \n   # Run the script\n   python scripts/{{script_name}}.py\n   ```\n\n3. **For Exploration/REPL:**\n   ```bash\n   # Use interactive Python instead\n   python\n   # or\n   ipython\n   ```\n\n**Would you like me to help you convert this inline command to a proper test file or script?**\n\nType 'yes' to proceed with the inline command anyway, or 'no' to create a proper file instead.",
    "settings": {
        "enabled": true,
        "auto_approve": false,
        "timeout_seconds": 120,
        "block_execution": true
    },
    "metadata": {
        "author": "Kiro Assistant",
        "created_at": "2025-01-19T00:00:00Z",
        "tags": [
            "best-practices",
            "testing",
            "code-quality",
            "prevention"
        ]
    }
}

jen6 avatar Oct 03 '25 11:10 jen6

Closing this issue as it was reported against an older version of Kiro (v0.x or early v1.x) and has had no activity in several months.

Kiro has shipped significant improvements since these versions, including stability fixes, new features, and major changes across v1.0, v1.1, v2.x, and the current v2.23.x releases. The behavior described here may already be resolved.

If this is still affecting you on the latest version, please open a new issue at https://github.com/kirodotdev/Kiro/issues/new with your current version (kiro-cli --version or Help > About in the IDE), your OS, and steps to reproduce. The latest version is available at https://kiro.dev/downloads/ or via kiro-cli update.

Thank you for taking the time to report this.

AnilMaktala avatar Sep 24 '26 13:09 AnilMaktala