Skip to content

Security: developerfred/ElixirClaw

SECURITY.md

Security Policy

Supported Versions

VersionSupported
0.1.x

Reporting a Vulnerability

If you discover a security vulnerability, please send an email to the maintainer. All security vulnerabilities will be promptly addressed.

Security Model

Threat Model

ElixirClaw is a node client for OpenClaw Gateway. The primary security concerns are:

  1. Command Injection - Malicious commands injected through system.run
  2. Path Traversal - Access to unauthorized files via path manipulation
  3. Denial of Service - Resource exhaustion via large messages
  4. Unauthorized Access - Gateway connection without proper authentication

Security Features Implemented

1. Command Sanitization

All system commands are sanitized before execution:

# Sanitize command argumentsdefpsanitize_command_args(args)whenis_list(args)domax_args=50max_arg_length=10000iflength(args)>max_argsdo{:error,:too_many_args}elsesanitized=Enum.map(args,&to_string/1)sanitized=Enum.map(sanitized,&sanitize_single_arg/1)sanitized=Enum.take(sanitized,max_args)sanitized=Enum.map(sanitized,fnarg->String.slice(arg,0,max_arg_length)end){:ok,sanitized}endend
  • Maximum 50 arguments per command
  • Maximum 10000 characters per argument
  • Control characters stripped
  • Whitespace trimmed

2. Shell Argument Escaping

Notification arguments are escaped to prevent shell injection:

defpsanitize_shell_arg(arg)whenis_binary(arg)doarg|>String.replace("\\","\\\\")# Escape backslashes|>String.replace("\"","\\\"")# Escape quotes|>String.slice(0,1000)# Limit lengthend

3. Device Validation

Camera devices are validated before use:

defpvalidate_device(device)whenis_binary(device)dosafe = device |> String.replace(~r/[^a-zA-Z0-9_\-\.\/], "", global: true) |> String.slice(0, 255)
if safe == device or safe == "", do: {:ok, safe}, else: {:error, :invalid_device}
end
  • Only alphanumeric characters, underscores, hyphens, dots, and slashes allowed
  • Maximum 255 characters

4. Message Size Limits

Protocol messages are limited to prevent DoS:

@max_message_size1_000_000# 1MB limit

5. Capability Checking

All node operations require explicit capability grants:

defpcheck_cap(cap)doconfig=Application.get_all_env(:elixir_claw)||%{}allowed=config[:caps]||[]ifcapinallowed||allowed==:alldo{:ok,cap}else{:error,:capability_not_allowed}endend

6. Command Allowlisting

System commands can be restricted to an allowlist:

defpvalidate_command(cmd)whenis_binary(cmd)andbyte_size(cmd)>0doconfig=Application.get_all_env(:elixir_claw)||%{}allowed=config[:allowed_commands]||[]allowed_commands=[:all|allowed]if:allinallowed_commands||cmdinallowed_commandsdo{:ok,cmd}else{:error,:command_not_allowed}endend

7. TLS/SSL Support

All gateway connections use TLS:

defpconnect_gateway(host,port,token)do# TLS connection with certificate verificationend

Configuration Recommendations

Production Deployment

  1. Restrict Capabilities

    config:elixir_claw,caps: ["camera.snap","screen.snap"],# Only allow what's neededallowed_commands: ["echo","date"]# Whitelist specific commands
  2. Enable TLS Verification

    config:elixir_claw,verify_ssl: true
  3. Set Resource Limits

    config:elixir_claw,max_command_timeout: 30_000,# 30 seconds maxmax_message_size: 1_000_000# 1MB max

Security Audit History

  • v0.1.0 (2026-02-19)
    • Fixed command injection vulnerability in system.run
    • Added input sanitization for all user-controlled inputs
    • Implemented capability-based access control
    • Added message size limits

Contact

For security issues, please contact the maintainer directly.

There aren't any published security advisories