Skip to content

Conversation

@ItsBarryZ
Copy link
Collaborator

@ItsBarryZ ItsBarryZ commented Jul 7, 2025

  • Implements configurable bash command execution tool
  • Supports granular permission control via allowed/denied commands
  • Allows directory restrictions and feature toggles (pipes, redirects)
  • Follows agents framework pattern with dynamic tool descriptions
  • Includes proper async execution with timeout support

Implements configurable bash command execution tool with granular permission control.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@etd-23
Copy link
Collaborator

etd-23 commented Jul 7, 2025

Type Hints

Add Optional for nullable fields:

from typing import List, Optional

allowed_commands: Optional[List[str]] = field(default=None)
working_directories: Optional[List[str]] = field(default=None)

Security Issue

The startswith() check can be bypassed. If "ls" is allowed, "ls && rm -rf /" passes validation.

Consider exact matching or using shlex:

import shlex

def _is_command_allowed(self, command: str) -> bool:
    try:
        parsed = shlex.split(command)
        base_command = parsed[0] if parsed else ""
    except ValueError:
        return False
    
    if self.allowed_commands:
        return base_command in self.allowed_commands

@etd-23
Copy link
Collaborator

etd-23 commented Jul 7, 2025

mostly claude-code suggestions above. A little nit-picky on the typing, but agreed on the security point

Copy link

@rgb-prithvi rgb-prithvi left a comment

Choose a reason for hiding this comment

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

LGTM for the most part, but maybe we should add a small change to the notebook and / or documentation to highlight the tool and show it in action? otherwise I doubt most folks will see this

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.

5 participants