Skip to content

Stable gas price error logging leaks the full URL, query string included #384

Open

Description

@SDL-A1

From the external review of #374. Verified here, and the mechanism is slightly
different from the report.

The review says the stable gas price source logs its full URL on error. It does,
but indirectly — which matters, because grepping for {url} in
stable_gas_price.rs finds nothing:

  1. crates/cli/src/https.rs:219 attaches the full URL as anyhow context:
    .with_context(|| format!("fetching {url}"))
  2. crates/cli/src/stable_gas_price.rs:318 logs the whole chain:
    error!(target: "rustock::mining", "Error getting min gas price from web provider: {e:#}")

{e:#} prints every context layer, so the URL — including its query string —
reaches the log. node.example.toml documents the source URL as taking query
parameters (?ids=bitcoin&vs_currencies=usd), and a paid price API typically
carries the key there.

This goes against our no-full-URL-logging rule, which exists precisely because
secrets live in query strings.

Scope

The production node does not mine, and [mining.stable_gas_price] defaults
to enabled = false, so nothing logs this today. It is a trap for whoever turns
it on.

What would settle it

Log scheme + host only, as public_ip.rs already does with host_of(url) — that
helper exists and solves exactly this. Either reuse it, or drop the URL from the
anyhow context and let the caller name the host.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions