Skip to main content

SKY-D392 · Security in code

Decoded request text in a log message

MediumCWE-117

A log or tracing message displays a decoded request string. A line break in that value can split one event across several lines in a text log.

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

People and tools that read one event per line can mistake the extra lines for separate events.

What Skylos flags

src/lib.rs · RustReported on line 3
use axum::extract::Path;pub async fn lookup(Path(name): Path<String>) {    log::warn!("Unknown item {name}");}

What Skylos leaves alone

src/lib.rs · Rust
use axum::extract::Path;pub async fn lookup(Path(name): Path<String>) {    log::warn!("Unknown item {name:?}");}

Why Skylos leaves it alone

Rust's debug format escapes line breaks in this String.

How Skylos decides

  1. Skylos follows string values from recognized decoded HTTP extractors into log and tracing message templates. It checks captured names, named arguments and positional arguments that use the default display format.
  2. Structured fields and debug-formatted strings have different rendering rules. An HTTP URI's raw query string keeps its percent encoding. These cases stay quiet.

How to fix it

Escape line breaks before writing a text log. For a String, debug formatting escapes control characters. A structured logging backend can also encode each field as data.

When it can be wrong

  • A deployed log formatter may already encode the entire message as one JSON string. The scanner cannot see the backend's runtime configuration.

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

  • Use // skylos: ignore[SKY-D392] with the reason on a reviewed call.

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