Skip to main content

SKY-D391 · Security in code

Exposed secret in a request URL

A reqwest request puts a raw SecretString in its URL.

Languages
Rust
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Servers, proxies and monitoring tools can log URL paths and query strings, including those sent over HTTPS.

What Skylos flags

src/lib.rs · RustReported on line 4
use secrecy::{ExposeSecret, SecretString};pub async fn read(client: &reqwest::Client, token: &SecretString) {    let raw = token.expose_secret();    let _ = client.get("https://api.example.org/status").query(&[("token", raw)]).send().await;}

What Skylos leaves alone

src/lib.rs · Rust
use secrecy::{ExposeSecret, SecretString};pub async fn read(client: &reqwest::Client, token: &SecretString) {    let raw = token.expose_secret();    let _ = client.get("https://api.example.org/status").bearer_auth(raw).send().await;}

Why Skylos leaves it alone

The server receives the token in the Authorization header.

How Skylos decides

  1. Tracks expose_secret() on secrecy::SecretString into simple format! placeholders in the path or query of a fixed-origin URL, or inline query parameter pairs on a reqwest builder. It checks the request when a blocking client sends it or an async request is polled.
  2. Fragments are local to the client. A secret in a fragment, an unopened request or a protected authorization header stays quiet.

How to fix it

Use HTTPS and move the credential to the authentication header supported by the service.

When it can be wrong

  • A service that requires a credential in the URL may need a short-lived credential and redaction of request logs.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Record the reviewed service requirement with // skylos: ignore[SKY-D391] on the reported line.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.