Repository navigation
Description
Summary
Deeply nested .dsrs containers recurse through the text parser without a depth check. A serialized Program can also express a deep child chain in a flat node arena, whose validation recursively calls check_node; either lower-trust input can exhaust a host stack before returning an error. This requires a host to parse a lower-trust program. The repository's HTTP server has no artifact-upload route.
Affected code
Program::load_dsrsreads the caller-selected artifact and passes its text to the recursive parser (entrypoint):crates/dspy-rs/src/ir/text/mod.rs:49-71.- Each nested child calls
target;targetcallsexpragain, growing the Rust call stack for each nestedseq(root_control):crates/dspy-rs/src/ir/text/parse.rs:1512-1529. - A bare container expression dispatches back into
expr, closing the recursive cycle (sink):crates/dspy-rs/src/ir/text/parse.rs:1070-1084. - A deep child chain need not use nested JSON syntax (entrypoint):
crates/dspy-rs/src/ir/graph.rs:635-647. - Each Seq child calls
check_nodewith no depth limit (root_control):crates/dspy-rs/src/ir/validate.rs:562-580.
Suggested resolution
- Bound program depth in the text parser and serialized-program validator, or traverse graphs iteratively; return structured errors before stack exhaustion.
Acceptance criteria
- Deeply nested
seqinput returns a parse error without process termination. - Normal nested programs still parse and validate.
- A flat serialized node arena with a deep child chain returns a validation error without process termination.
Related issues
#102 concerns recursive class references during schema validation and rendering. This ticket concerns deep program containers and node-child chains; #67 addresses structured errors more broadly.
Validation performed
Static source review of upstream main at 72b247e2bddc7337f923461fb27b4127c7d104f3. No runtime exploit or live deployment test was performed.
Fix under review
PR #103: The PR bounds text-parser and serialized-program traversal depth.
Tracking
- Finding ID:
csf_eda938ffa8004e4a1db577ec - Fingerprint:
codex-security/v1:sha256:051853a458f13bb86dd3a4fd1b097ea1f8b70c340413f84e86f17124e6fa8356
AI disclosure
OpenAI Codex assisted with the static source review and organization of this issue. No code change is included.
Activity