Skip to main content

Overview

PicoClaw implements a multi-layered security architecture to protect your system while allowing AI agents to perform useful tasks. The security model focuses on workspace isolation, command filtering, and path validation.

Workspace Sandbox

The primary security mechanism is workspace restriction, which isolates agent file and command access to a configured directory.

Default Configuration

Protected Tools

When restrict_to_workspace: true, the following tools are sandboxed:

How Workspace Restriction Works

Path Resolution

All file paths are resolved and validated before access:

Implementation

From pkg/tools/filesystem.go:

Sandbox Implementations

sandboxFs (Go 1.23+)

Uses os.Root for kernel-level path isolation:
Security:
  • Kernel-enforced path isolation
  • Immune to ../ traversal
  • Symlinks cannot escape root
  • No chroot required

hostFs (Unrestricted)

Direct filesystem access when restrict_to_workspace: false:
⚠️ Warning: Only disable restrictions in controlled environments.

Path Whitelisting

Allow specific paths outside workspace using regex patterns.

Configuration

Pattern Syntax

Regular expressions matched against absolute paths:

whitelistFs Implementation

Combines sandbox with selective host access:

Use Cases

System monitoring:
Network config:
Temporary files:

Exec Tool Security

The exec tool has multiple layers of protection to prevent dangerous commands.

1. Dangerous Pattern Blocking

From pkg/tools/shell.go, these patterns are blocked by default:

Destructive Commands

System Control

Shell Injection

Privilege Escalation

Process Control

Remote Execution

Package Managers

Containers

Version Control

2. Workspace Path Validation

When restrict_to_workspace: true, absolute paths in commands are validated:
Implementation:

3. Safe Paths

These kernel pseudo-devices are always allowed:

4. Custom Patterns

Override or extend default patterns:
Behavior:
  • custom_allow_patterns: Bypass deny patterns for specific commands
  • custom_deny_patterns: Additional blocks beyond defaults
  • enable_deny_patterns: false: Disable all pattern checks (⚠️ dangerous)

5. Execution Timeout

Prevents infinite execution:
Configuration:

6. Process Tree Termination

Kills child processes on timeout (Unix):

Security Boundaries

Consistent Across Execution Paths

The same security restrictions apply everywhere: No bypass possible through subagents or scheduled tasks.

Multi-Agent Isolation

Each agent has its own workspace:
Isolation:
  • File operations scoped to agent workspace
  • Sessions isolated per agent
  • No cross-agent file access

Error Messages

File Access Denied

Command Blocked

Path Traversal

Disabling Restrictions (⚠️ Dangerous)

Method 1: Config File

Method 2: Environment Variable

Method 3: Disable Exec Patterns Only

⚠️ Security Warning: Disabling restrictions allows the agent to:
  • Access any file on your system
  • Execute any command
  • Modify system files
  • Install packages
  • Access sensitive data
Only disable in:
  • Isolated development environments
  • Containers with limited host access
  • Trusted, controlled scenarios

Best Practices

1. Keep Sandbox Enabled

Always use restrict_to_workspace: true unless absolutely necessary.

2. Use Path Whitelisting

Instead of disabling sandbox, whitelist specific paths:

3. Review Custom Patterns

Carefully test custom allow patterns:

4. Use Separate Workspaces

Isolate agents by task:

5. Monitor Agent Actions

Enable debug logging to audit agent commands:

6. Limit Tool Access

Disable unnecessary tools for specific agents:

7. Container Isolation

Run PicoClaw in containers with limited host access:

8. Principle of Least Privilege

  • Start with full restrictions
  • Add whitelisted paths as needed
  • Document all exceptions
  • Review periodically

Security Checklist

  • restrict_to_workspace: true enabled
  • Workspace directory has appropriate permissions (750 or stricter)
  • allow_read_paths / allow_write_paths minimal and documented
  • enable_deny_patterns: true for exec tool
  • Custom allow patterns tested and necessary
  • Agent workspaces isolated per agent
  • Debug logging enabled for audit trail
  • Running in container or restricted environment
  • Regular security review of agent actions
  • Backup of workspace data

Reporting Security Issues

If you discover a security vulnerability in PicoClaw:
  1. Do not open a public issue
  2. Email security details to the maintainers
  3. Include reproduction steps
  4. Wait for confirmation before public disclosure
See project README for contact information.