Skip to content

[Bug]: An address whose query names a secret drops the reason after it from notices #1475

Closed

Description

@jgregoriorincon

Before you start

  • I searched the existing issues and did not find a duplicate.
  • This is a bug report, not a usage question (questions belong in Discussions).

What happened?

When an address whose query names a secret (token=, sig=, key=…) starts a message, the redaction drops the reason that follows it. A failure reads only as the address, with no word on what went wrong.

diagnostics::redact (crates/data/src/diagnostics.rs, around line 740) stops at such a query on purpose, since a secret's unescaped value may run on past whitespace: it writes [query and the rest omitted] and drops the rest of the text. Its own test shows the effect:

redact("https://host/data?sig=abc: HTTP 503") == "https://host/data[query and the rest omitted]"

Messages are often built as format!("{url}: {e}"), about 90 of them across 24 files (ui-egui, tiles, data, engine, map, plugins, assistant, geolibre). Each one loses its reason this way when its address carries a secret. They then go through Session::notify or Session::redacted, so the loss shows in the notices, and in the add-service dialog's error line since #1454.

Found in the review of #1454 (#1454 (comment)). #1454 fixed it only for the messages it adds (serviceui::address_in_message redacts the address alone before the message is built); the other sites predate it.

Steps to reproduce

  1. Add a layer From URL… with an address whose query names a secret and that fails, for example https://<host>/missing.geojson?token=abc answering 404.
  2. The notice reads https://<host>/missing.geojson[query and the rest omitted], without the reason.
  3. The same address with a query that names no secret (for example ?page=2) keeps the reason after [query omitted], as redact("https://host/data?page=2: HTTP 503") == "https://host/data[query omitted]: HTTP 503" shows.

Expected behavior

The address loses its query and the reason stays, for every message that names an address, without letting a secret's value through. Possible ways:

  • a shared helper that redacts the address on its own before it goes into a message (as address_in_message does in fix(ui): Add From Service says how a layer's download went once it lands #1454), used wherever a message starts with an address; or
  • in redact, ending a secret query at the address's end (whitespace, or : after it) when the value is URL-escaped, keeping the current cut only when the value may run on.

The second covers every message at once, but changes the redaction's security rule, so it needs its own tests for values that run on.

How are you running RustGIS?

Desktop app

Version

main at ed501fa

Operating system, browser and graphics

macOS 15 (Darwin 24.6)

Sample data

Any address with a secret-named query that fails.

Screenshots or logs

No response

Activity

  1. added
    bug
    on Nov 5, 2026
  2. self-assigned this
    on Nov 5, 2026
  3. deniial00 commented on Nov 5, 2026

    @deniial00
    Member

    I’m taking this on in a separate worktree. Confirmed that passing an address-prefixed failure directly through Session::notify loses the reason when the query names a secret (sig, token, or key); the non-secret query control retains it.

    I’ll audit the callers and keep the fix security-preserving by redacting addresses before composing messages, without weakening protection for unescaped secret values containing whitespace. Some callers already do this: local HTTP 404 checks through CLI layer.addUrl retained the reason for both GeoJSON and FlatGeobuf URLs with token=, so the affected call sites need to be distinguished from those already protected.

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

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions