Repository navigation
Description
Summary
Any failed chain-RPC call surfaces the full rpc_url — including the path/query where Infura/Alchemy-style API keys live — in operator-facing error output. This is pre-existing and codebase-wide, surfaced during the PR #953 review (silent-failure-hunter).
Mechanism (verified)
reqwest0.13.4ErrorDisplaywrites" for url ({url})"(reqwest/src/error.rs:268), andurl::Url'sDisplayemits scheme + authority + path + query. reqwest providesError::without_url()precisely to strip it.alloy'sTransportErrorKindis#[error("{0}")]-transparent, forwarding the innerreqwest::Error.- CLI commands wrap these via
anyhow.with_context(...)/.context(...), andmain()returnsanyhow::Result<()>, so the entire source chain is printed on failure — exposing the raw URL.
Affected (non-exhaustive)
crates/cli/src/commands/setup.rs—get_chain_id,get_balance,get_gas_price, balance reads (the "rpc_url is not reachable" path and others)crates/cli/src/commands/bond.rs—build_plancontract reads (minCapacityMbps,bondRequired,activeBond, …) wrapped with.with_context(ctx)crates/cli/src/commands/register.rs— nonce reads +registerNode- Likely the
decdn-nodedaemon's chain-interaction paths as well
Fires on the common failure modes: DNS failure, connection refused, TLS error, timeout against the RPC endpoint.
Established policy this violates
config validate already hides rpc_url as <redacted> ({} chars) (crates/cli/src/commands/config.rs:131) "because the secret commonly lives in the path or query." Transport-error paths bypass that policy.
Proposed fix
A shared sanitizer applied at every chain-RPC error site (a single helper, applied uniformly), e.g.:
- Downcast the error source to
reqwest::Errorand call.without_url()before it propagates; or - Map the transport error to a message that drops the URL-bearing source chain (
.map_err(|_| anyhow!("RPC call failed against the configured endpoint; check blockchain.rpc_url"))), preserving the transport error class via a sanitized formatter that strips thefor url (...)tail.
Apply consistently across cli (bond/register/setup) and node so no chain-RPC site echoes the raw URL.
Scope note
PR #953 (decdn setup) aligned its two malformed-URL parse error sites to the <redacted> (N chars) policy, but deliberately did not patch the transport-error leak piecemeal — it predates that PR and spans the whole chain-interacting surface. This issue tracks the comprehensive fix.
References
- reqwest
Error::without_url,error.rs:268 crates/cli/src/commands/config.rs:108-133(the<redacted> (N chars)policy to match)crates/cli/src/main.rs(anyhow Debug print walks the full source chain)
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
github-actions commentedon Jun 18, 2026
🎯 Triage report
A confirmed security bug: failed chain-RPC calls emit the full
rpc_url— including Infura/Alchemy API keys embedded in the path/query — throughreqwest::Error'sDisplayimpl, which propagates transparently through alloy'sTransportErrorKindand then up the full anyhow source chain printed bymain(). This directly violates the existing<redacted> (N chars)policy already enforced inconfig validate, making it a regression-in-policy rather than a new design choice. Affected call sites spancli(bond/register/setup) and likely thenodedaemon's chain-interaction paths.📊 Assessment
security,bug,high,cli,rust🔗 Similar issues
user:pass@in theconfig validatesuccess-path summary. This issue covers the transport-error path forrpc_url; adjacent but distinct.💡 Notes and suggestions
Recommended implementation approach
The cleanest fix is a single shared helper in
crates/common/src/(e.g.,sanitize_rpc_error) applied uniformly at every chain-RPC call site:Option B is easier to audit and avoids downcasting through alloy's error chain.
Files to touch (non-exhaustive)
crates/cli/src/commands/bond.rs— all.with_context(...)wrapping alloy provider calls inbuild_plancrates/cli/src/commands/register.rs— nonce reads +registerNodecrates/cli/src/commands/setup.rs—get_chain_id,get_balance,get_gas_pricecrates/node/src/...— any chain-interaction paths that propagate to tracing or operator-visible outputDon't forget
decdn-node: If the daemon logs chain errors viatracing, those log lines also need the sanitizer —tracing's%errand?errformats both walk the source chain.Testing: Add an integration test that triggers a connection-refused error against a dummy endpoint and asserts the output does not contain the configured RPC URL string.
Checklist
sanitize_rpc_error(or equivalent) helper tocrates/common/src/cli(bond, register, setup)nodecrate for chain-interaction paths; apply same sanitizer%err/?errAdd this agentic workflows to your repo
To install this agentic workflow, run
fix(security): redact rpc_url from chain-RPC transport errors (#954) (#…
fix(client-pull): surface, sanitize, and test the bootstrap fallback
feat(client-pull): retry + peer-cache fallback for registry bootstrap (…