literal_eval

python · ast
sanitizer✓ Reviewed · 2026-09-04
RoleSanitizer
WeaknessCWE-95
WatchesArgument[0] -> ReturnValue
Kindcode-injection
Confidencehigh
Corroboration3

Evaluates a limited Python literal grammar, but deeply nested or large input can still exhaust interpreter resources.

Argument map · what each slot does

The pack does not provide a callable signature for this record; the watched access path is shown directly.

ArgAccess pathPurposeWatched
Argument[0]Argument[0]The access path Atropos marks for this model.▲ sanitizer
The weakness
CWE-95
Eval Injection

Input is evaluated dynamically without neutralizing language directives.

What goes wrong
Attacker's-eye view · code-injection

An attacker supplies syntax that is evaluated with the process's privileges.

// modeled boundary: Argument[0] -> ReturnValue literal_eval(attacker_influenced_value);
To decide if this call is a bug, check
1Keep code and data separate.
2Replace evaluation with a parser or allow-list.
3Constrain the execution context if evaluation remains.
These checks require the surrounding codebase. The model names the boundary; it does not decide reachability or prove that a guard dominates every path.
Is this a bug in your code?Atropos stops here — by design

Atropos identifies Argument[0] -> ReturnValue as a code-injection sanitizer. It cannot see whether untrusted data reaches this call in your repository.

Lachesis is the codebase-level step: it traces reachability and guards for this symbol.

Check this symbol in Lachesis
Reviewed guidance

Safer direction: Bound input size and nesting before evaluation, or parse against an explicit schema.

Unsafe shape
ast.literal_eval(request.body);
Safer shape
json.loads(request.body);
The family · code-injection
Model facts · verbatim from the pack
RoleKindAccess pathModel IDConfidence
sanitizercode-injectionArgument[0] -> ReturnValuepython.ast.literaleval.a0-rethigh · corrob. 3
Referencesdocs.python.org