Skip to content

feat: restrict trust permissions for non-readonly AWS operations in use_aws tool #2443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ritikk
Copy link

@ritikk ritikk commented Jul 31, 2025

Summary

This PR introduces enhanced security controls for the use_aws tool by implementing a new permission evaluation type that restricts session-wide trust for potentially destructive AWS operations.

Changes

Core Implementation

  • New Permission Type: Added PermissionEvalResult::AskWithoutTrust to the permission evaluation system
  • Enhanced Security: Modified use_aws tool to return AskWithoutTrust for write/modify operations, preventing users from accidentally granting session-wide trust for destructive AWS actions
  • Conditional Prompts: Updated ChatSession to conditionally render acceptance prompts based on permission type:
    • Ask: Shows full [y/n/t] prompt with trust option
    • AskWithoutTrust: Shows restricted [y/n] prompt without trust option

Security Model

  • Write Operations: Always require per-action approval regardless of tool trust status
    • Examples: put-object, delete-*, create-*, update-*, etc.
  • Read Operations: Continue to allow trust and session-wide approval
    • Examples: list-*, describe-*, get-*, etc.

Technical Details

  • Added pending_tool_allows_trust flag to track permission level during tool execution
  • Updated trust option handling to respect the new permission constraints
  • Comprehensive test coverage for both trusted and untrusted tool scenarios

Motivation

Previously, users could grant session-wide trust to the use_aws tool for any operation, including potentially destructive actions like deleting S3 buckets or terminating EC2 instances. This created a security risk where a single trust decision could lead to unintended destructive operations throughout the session.

Testing

  • ✅ Added tests for trusted tools with write operations (should use AskWithoutTrust)
  • ✅ Added tests for trusted tools with read operations (should use Allow)
  • ✅ Added tests for untrusted tools with write operations (should use AskWithoutTrust)
  • ✅ Added tests for untrusted tools with read operations (should use Allow)
  • ✅ Verified prompt rendering logic for both permission types

Impact

  • Security: Reduces risk of accidental destructive AWS operations
  • User Experience: Maintains smooth workflow for read-only operations while adding appropriate friction for write operations
  • Backward Compatibility: No breaking changes to existing functionality

Example

Before: User could trust use_aws once and all subsequent AWS operations (including destructive ones) would execute without confirmation.

After:

  • Read operations: Can still be trusted for session-wide approval
  • Write operations: Always require individual confirmation, even for trusted tools

Screenshot:
Screenshot 2025-07-31 at 1 10 39 PM

…se_aws tool

- Introduce new PermissionEvalResult::AskWithoutTrust evaluation type specifically for use_aws tool
- Modify use_aws tool permission logic to return AskWithoutTrust for write/modify operations, preventing users from granting session-wide trust for potentially destructive AWS actions
- Update ChatSession to track pending_tool_allows_trust flag and conditionally render acceptance prompts:
  - Show full [y/n/t] prompt with trust option for PermissionEvalResult::Ask
  - Show restricted [y/n] prompt without trust option for PermissionEvalResult::AskWithoutTrust
- Ensure use_aws write operations (put-object, delete-*, create-*, etc.) always require per-action approval regardless of whether the tool is in the agent's allowed_tools list
- Read-only use_aws operations (list-*, describe-*, get-*) continue to allow trust and session-wide approval
- Add comprehensive test coverage for trusted vs untrusted use_aws tool behavior across read and write operations
- Remove trust option handling when pending_tool_allows_trust is false to prevent 't' input from being processed
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.

1 participant