.claude/skills/ac-security-sandbox/SKILL.md
Security sandbox for autonomous coding. Use when validating commands, configuring permissions, managing allowlists, or ensuring safe execution.
npx skillsauth add adaptationio/skrillz ac-security-sandboxInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Defense-in-depth security for autonomous code execution.
Provides three layers of security:
from scripts.security_sandbox import SecuritySandbox
sandbox = SecuritySandbox(project_dir)
# Check if command is allowed
is_safe, reason = sandbox.validate_command("npm install")
if is_safe:
# Execute command
pass
else:
print(f"Blocked: {reason}")
sandbox.configure_allowlist([
"ls", "cat", "head", "tail",
"npm", "node", "python",
"git", "grep"
])
# Enable sandbox mode
sandbox_config = {
"enabled": True,
"isolation": "strict",
"network": "restricted"
}
permissions = {
"allow": [
"Read(./**)", # Read project files
"Write(./**)", # Write project files
"Edit(./**)", # Edit project files
],
"deny": [
"Read(/etc/**)", # No system files
"Write(/usr/**)", # No system writes
"Bash(rm -rf /)", # No destructive commands
]
}
ALLOWED_COMMANDS = {
# File inspection
"ls", "cat", "head", "tail", "wc", "grep", "find",
# File operations
"cp", "mv", "mkdir", "chmod", "touch",
# Node.js
"npm", "node", "npx", "yarn", "pnpm",
# Python
"python", "python3", "pip", "pip3",
# Version control
"git",
# Process management
"ps", "lsof", "sleep", "pkill",
# Build tools
"make", "cmake", "cargo", "go",
# Testing
"jest", "pytest", "vitest", "playwright"
}
async def bash_security_hook(input_data, tool_use_id, context):
command = input_data.get("tool_input", {}).get("command", "")
# Extract all commands (handles pipes, &&, etc.)
commands = extract_commands(command)
for cmd in commands:
if cmd not in ALLOWED_COMMANDS:
return {
"decision": "block",
"reason": f"Command '{cmd}' not in allowlist"
}
return {} # Allow execution
def extract_commands(command: str) -> list[str]:
"""
Extract base commands from complex command strings.
Examples:
"npm install && npm test" → ["npm", "npm"]
"cat file.txt | grep error" → ["cat", "grep"]
"git add . && git commit -m 'msg'" → ["git", "git"]
"""
# Parse command string
# Handle: pipes (|), chains (&&, ||), semicolons (;)
# Return list of base command names
DANGEROUS_PATTERNS = [
r"rm\s+-rf\s+/", # Recursive delete root
r"dd\s+if=", # Direct disk writes
r"mkfs", # Format filesystems
r":(){ :|:& };:", # Fork bombs
r"chmod\s+777", # Overly permissive
r"curl.*\|\s*bash", # Pipe to shell
r"wget.*\|\s*sh", # Pipe to shell
]
# Allowed in project directory only
RESTRICTED_COMMANDS = {
"rm": lambda path: path.startswith("./"),
"mv": lambda src, dst: src.startswith("./") and dst.startswith("./"),
"cp": lambda src, dst: dst.startswith("./"),
}
{
"sandbox": {
"enabled": true,
"isolation": "strict"
},
"permissions": {
"filesystem": {
"read": ["./**", "~/.config/claude/**"],
"write": ["./**"],
"deny": ["/etc/**", "/usr/**", "~/.ssh/**"]
},
"network": {
"allow": ["localhost", "api.anthropic.com"],
"deny": ["*"]
}
},
"allowlist": {
"commands": ["npm", "node", "git", "python"],
"custom": []
}
}
sandbox = SecuritySandbox(project_dir)
await sandbox.initialize()
# Loads config, sets up hooks
is_safe, reason = sandbox.validate_command(command)
# Returns (True, None) or (False, "reason")
is_allowed = sandbox.validate_path(path, operation="write")
# Checks against filesystem permissions
hook = sandbox.create_pre_tool_hook()
# Returns hook function for Claude SDK
sandbox.add_allowed_command("my-custom-tool")
# Adds to allowlist (persists to config)
# Get recent security events
events = sandbox.get_audit_log(limit=100)
for event in events:
print(f"{event.timestamp}: {event.action} - {event.command}")
All security decisions are logged:
// .claude/security-audit.jsonl
{"timestamp": "2025-01-15T10:00:00Z", "action": "ALLOW", "command": "npm install", "reason": null}
{"timestamp": "2025-01-15T10:01:00Z", "action": "BLOCK", "command": "rm -rf /", "reason": "Dangerous pattern"}
{"timestamp": "2025-01-15T10:02:00Z", "action": "ALLOW", "command": "git commit", "reason": null}
sudo commandsreferences/ALLOWLIST.md - Complete command listreferences/PATTERNS.md - Blocked patternsreferences/AUDIT.md - Audit log formatscripts/security_sandbox.py - Core SecuritySandboxscripts/command_validator.py - Command validationscripts/path_validator.py - Path validationscripts/audit_logger.py - Security audit loggingdevelopment
Setup secure web-based terminal access to WSL2 from mobile/tablet via ttyd + ngrok/Cloudflare/Tailscale. One-command install, start, stop, status. Use when you need remote terminal access, web terminal, browser-based shell, or mobile access to WSL2 environment.
development
Complete development workflows where Claude writes the code while Gemini and Codex provide research, planning, reviews, and different perspectives. Claude remains the main developer. Use for complex projects requiring expert planning and multi-perspective reviews.
development
Systematic progress tracking for skill development. Manages task states (pending/in_progress/completed), updates in real-time, reports progress, identifies blockers, and maintains momentum. Use when tracking skill development, coordinating work, or reporting progress.
testing
Comprehensive testing workflow orchestrating functional testing, example validation, integration testing, and usability assessment. Sequential workflow for complete skill testing from examples through scenarios to integration validation. Use when conducting thorough testing, pre-deployment validation, ensuring skill functionality, or comprehensive quality checks.