SKY-D391 · Security in code
Exposed secret in a request URL
HighCWE-598
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
Why it matters
Servers, proxies and monitoring tools can log URL paths and query strings, including those sent over HTTPS.
What Skylos flags
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
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
- 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.
- 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.