Validation rules for commands and worker specifications.
All functions return {:ok, value} on success or
{:error, reason} on failure. Rules are composable using
with chains.
Summary
Functions
Valida que el shell este en la lista de shells permitidos.
Returns la lista de nombres de shells permitidos.
Returns la lista de patrones de comandos peligrosos bloqueados por safe_command/1.
Valida que un comando no exceda la longitud maxima permitida.
Valida que un comando no contenga patrones de inyeccion de shell.
Valida que una cadena de comando no este vacia.
Valida que un comando no coincida con ningun patron peligroso conocido.
Validates that a retry count is non-negative and within limits.
Validates that a timeout value is positive and within reasonable limits.
Valida el nombre de una variable de entorno.
Validates that a string does not contain dangerous path patterns.
Valida una cadena URL.
Functions
Valida que el shell este en la lista de shells permitidos.
@spec allowed_shells() :: [String.t()]
Returns la lista de nombres de shells permitidos.
@spec dangerous_commands() :: [String.t()]
Returns la lista de patrones de comandos peligrosos bloqueados por safe_command/1.
@spec max_length(String.t(), pos_integer()) :: {:ok, String.t()} | {:error, :command_too_long}
Valida que un comando no exceda la longitud maxima permitida.
Valida que un comando no contenga patrones de inyeccion de shell.
Verifica vectores de inyeccion comunes: $(...), backticks, y null bytes.
Valida que una cadena de comando no este vacia.
Valida que un comando no coincida con ningun patron peligroso conocido.
Honours Config.get(:sudo_allowlist, []) for granular sudo exemptions.
When the dangerous match is the "sudo " pattern, the part of the
command after "sudo " is checked against the allowlist (list of
prefixes). If it starts with any allowlisted prefix, the command is
accepted even though it contains "sudo ". Other dangerous patterns
(rm -rf, dd if=, etc.) are never overridable.
@spec valid_retry_count(non_neg_integer()) :: {:ok, non_neg_integer()} | {:error, :invalid_retry_count}
Validates that a retry count is non-negative and within limits.
@spec valid_timeout(pos_integer()) :: {:ok, pos_integer()} | {:error, :invalid_timeout}
Validates that a timeout value is positive and within reasonable limits.
Valida el nombre de una variable de entorno.
Validates that a string does not contain dangerous path patterns.
Valida una cadena URL.