Skip to main content

Module security

Module security 

Source
Expand description

Runtime security policy types.

Defines CommandPolicy and UrlPolicy – the runtime representations of command execution and URL safety policies. These are constructed from the config-level [CommandPolicyConfig] and [UrlPolicyConfig] at startup time.

CommandPolicy::validate provides the standard command validation logic (allowlist/denylist + dangerous pattern checks). Full URL/SSRF validation lives in clawft-tools::url_safety which depends on external crates (url, ipnet).

Structs§

CommandPolicy
Configurable command execution policy (runtime representation).
UrlPolicy
Runtime URL safety policy for SSRF protection.

Enums§

CommandPolicyError
Errors returned when a command fails policy validation.
PolicyMode
Whether the command policy operates in allowlist or denylist mode.

Constants§

DEFAULT_COMMAND_ALLOWLIST
The default set of safe executable basenames for allowlist mode.
DEFAULT_DANGEROUS_PATTERNS
The default set of dangerous patterns.

Functions§

extract_first_token
Extract the first whitespace-delimited token from a command string, stripping any leading path components (basename extraction).
split_shell_commands
Split a command string on shell compound operators (&&, ||, ;, |).