Severity: Critical (control-flow bypass; undermines @if/@else security model)
Discovered by
Codex code review (2026-06-03)
Location
src/perseus/renderer.py:761 β parallel_queries pre-execution
Problem
parallel_queries pre-executes top-level @query directives in a thread pool BEFORE the renderer evaluates @if/@else/@endif and tier gates. A query that lives inside a false conditional still runs.
@if production
@query "aws s3 ls s3://prod-data-bucket"
@endif
In dev, the user expects the @query to be skipped. With parallel_queries: true, the query runs anyway in the pre-execution pass.
Impact
- Sensitive queries guarded by
@if (env gates, dry-run gates, debug gates) execute regardless
- Breaks the documented
@if/@else security contract
- Silent β no error, no warning, no audit signal
Fix
Either:
- Make
parallel_queries control-flow aware (parse @if/@else tree first; skip queries in inactive branches)
- Recommended: disable
parallel_queries by default until the scheduling is control-flow aware
Acceptance criteria
- Test:
@if false + @query "echo SHOULD_NOT_RUN >/tmp/marker" + @endif with parallel_queries: true β assert marker NOT created
- Test:
@if true + @query "echo OK" + @endif β assert query runs
Refs
- Codex review Β§2 finding ordering bug; Β§9 Critical
Severity: Critical (control-flow bypass; undermines @if/@else security model)
Discovered by
Codex code review (2026-06-03)
Location
src/perseus/renderer.py:761βparallel_queriespre-executionProblem
parallel_queriespre-executes top-level@querydirectives in a thread pool BEFORE the renderer evaluates@if/@else/@endifand tier gates. A query that lives inside a false conditional still runs.In dev, the user expects the
@queryto be skipped. Withparallel_queries: true, the query runs anyway in the pre-execution pass.Impact
@if(env gates, dry-run gates, debug gates) execute regardless@if/@elsesecurity contractFix
Either:
parallel_queriescontrol-flow aware (parse@if/@elsetree first; skip queries in inactive branches)parallel_queriesby default until the scheduling is control-flow awareAcceptance criteria
@if false+@query "echo SHOULD_NOT_RUN >/tmp/marker"+@endifwithparallel_queries: trueβ assert marker NOT created@if true+@query "echo OK"+@endifβ assert query runsRefs