AI.Tools.Shell.Util (fnord v0.8.27)
View SourceUtility functions for shell command validation and security checking.
This module provides functions to analyze shell commands for potentially dangerous syntax that could be used for command injection or other security vulnerabilities.
Summary
Functions
Checks if a shell command contains disallowed syntax.
Functions
Checks if a shell command contains disallowed syntax.
Returns true
if the command contains dangerous patterns like:
- Pipes, redirection, or logical operators
- Command substitution or process substitution
- Unbalanced quotes or shell escape sequences
- Dangerous characters like newlines, NUL bytes, or zero-width spaces
Examples
iex> AI.Tools.Shell.Util.contains_disallowed_syntax?("ls -l")
false
iex> AI.Tools.Shell.Util.contains_disallowed_syntax?("ls | grep foo")
true
iex> AI.Tools.Shell.Util.contains_disallowed_syntax?("echo 'safe | quoted'")
false