Skip to content

feat: always ask for approval for non-readonly commands#510

Merged
droot merged 1 commit into
GoogleCloudPlatform:mainfrom
droot:fix-command-approval
Sep 10, 2025
Merged

feat: always ask for approval for non-readonly commands#510
droot merged 1 commit into
GoogleCloudPlatform:mainfrom
droot:fix-command-approval

Conversation

@droot
Copy link
Copy Markdown
Member

@droot droot commented Aug 26, 2025

Two big changes related to command approval flow.

  • Do not rely on LLM to determine if a command modifies resource or not.
  • If LLM suggests a composite command such as kubectl get pods | wc -l or generic bash script command multiple commands, we will always ask for approval even if the kubectl commands are readonly (this is to avoid exfilteration attacks).

Why

We are seeing requests for using the tool against production clusters and without the above changes, I see a serious risk of prompt injection attacks.

It may appear that the above changes may cause prompt fatigue because it will ask the user to approve commands but majority of the use-cases involves read-only kubectl commands and our current static filter will cover those pretty well and not request user to approve those commands.

Follow ups (coming)

  • Remove the "modifies_resource" parameter in the LLM call completely.
  • Improve the system prompt to steer LLM to avoid using composite calls as much as possible when using kubectl.

fixes #449

image

@droot
Copy link
Copy Markdown
Member Author

droot commented Aug 26, 2025

/cc @zvdy

Comment thread pkg/agent/conversation.go
Copy link
Copy Markdown
Member

@janetkuo janetkuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@droot droot merged commit 630a8e1 into GoogleCloudPlatform:main Sep 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: kubectl-ai downloads binaries without prompting for user permission

3 participants