Skip to content

Error log lines quote DuckDB error text verbatim, so a URL can fake log fields #259

Backlog

Description

@jrosskopf

Found during the #252 review (it also happens with the HTTP request log switched off).

[error] Error handling request: … HTTP HEAD error on '<url>' quotes DuckDB's error text, URL included, inside the flAPI log line. A request parameter that ends up in a URL can carry a space-separated request_id=FAKE (or trace_id=…). In text format, a log parser that splits on spaces then reads it as a field. Since #252, CR/LF are escaped in every message, so whole lines can no longer be forged; this residual is only about fields.

Fix idea: when a log message embeds error text that comes from DuckDB or from the request, quote it (e.g. error="…" with " and \ escaped), or percent-encode spaces in embedded URLs as FormatDuckDBHttpLogLine does. Add an integration test with a string parameter containing request_id=FAKE that reaches a failing read_csv('http://…/{{{params.x}}}').

Activity

  1. added
    bug
    on Nov 24, 2026
  2. jrosskopf commented on Nov 24, 2026

    @jrosskopf
    ContributorAuthor

    Related, found in the cross-PR review of #261: under restricted the template allowlist still permits SELECT write_log('...', log_type := 'HTTP'), so a template can write entries the #252 sink renders as duckdb http ... lines. The request_id is still taken from the request context, so attribution holds, but method/URL/status in such a line are the template's choice. Fix together with the error-text forging: refuse write_log in templates, or have the sink drop entries that do not come from DuckDB's HTTP client.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_018txuxF9jXyiKakpUoXrKBi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions