Skip to main content

SKY-D388 · Security in code

Symmetric key embedded in source

A jsonwebtoken HMAC signing key comes from a source literal. The rule also checks AES-GCM initializers that receive a fixed, repeated-byte key.

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

Anyone who obtains a shared signing key may be able to issue tokens that the application trusts.

What Skylos flags

src/lib.rs · RustReported on line 3
use jsonwebtoken::EncodingKey;pub fn init() {    let _ = EncodingKey::from_secret(b"example-only-key");}

What Skylos leaves alone

src/lib.rs · Rust
use jsonwebtoken::EncodingKey;pub fn init(key: &[u8]) {    let _ = EncodingKey::from_secret(key);}

Why Skylos leaves it alone

The key is supplied by the caller.

How Skylos decides

  1. Skylos resolves EncodingKey and its HMAC constructors.
  2. For the base64 constructors the literal must decode to nonempty key material. The diagnostic omits the key.

How to fix it

Load key material from secret storage and rotate any key that has been deployed.

When it can be wrong

  • Configuration supplied by another module or a key management service is outside the literal check.

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 reason on the reported line with // skylos: ignore[SKY-D388].

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