Skip to content

injection: unescaped $raw template splice in Cardigann search URL #519

Description

@forkwright

Finding

build_search_url() (line ~300) renders '$raw' search-input values with the unescaped ctx.render() and splices the result verbatim into the query via url.set_query(), which does not encode '&','=',';','+', so an ordinary search term (e.g. 'Fast & Furious') expanded inside a $raw template injects extra query parameters into the outbound indexer request.

Evidence

crates/zetesis/src/client/cardigann/mod.rs:300. Surfaced by the 2026-07-03 deep-audit workflow (adversarially verified + Opus-judged).

Why this matters

An ordinary search term expanded through a $raw template can inject extra query parameters into the outbound indexer request, letting search input manipulate request semantics sent to a third-party indexer.

Desired correction

Percent-encode template expansions in $raw values before splicing — use render_url()/encode_value semantics (the same guard the search-path template already has), or reject template expansions inside $raw; treat expansion output as data, never query structure.

Done when: the defect's failure mode no longer reproduces and a regression test covers it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions