Validates AST nodes to ensure they are safe for evaluation.
Deprecated
Part of the deprecated ExMCP.Server.Tools API. Planned for removal in 2.0.0.
This module provides security validation for AST nodes that will be evaluated using Code.eval_quoted, preventing code injection attacks.
Summary
Functions
Validates that an AST node contains only safe constructs.
Functions
Validates that an AST node contains only safe constructs.
Returns {:ok, ast} if the AST is safe, or {:error, reason} if unsafe constructs are detected.
Examples
iex> ASTValidator.validate_schema_ast({:%{}, [], [type: "string"]})
{:ok, {:%{}, [], [type: "string"]}}
iex> ASTValidator.validate_schema_ast({:eval, [], ["dangerous code"]})
{:error, "Unsafe AST node: eval"}