SKY-D388 · Security in code
Symmetric key embedded in source
HighCWE-321
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
Why it matters
Anyone who obtains a shared signing key may be able to issue tokens that the application trusts.
What Skylos flags
use jsonwebtoken::EncodingKey;pub fn init() { let _ = EncodingKey::from_secret(b"example-only-key");}What Skylos leaves alone
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
- Skylos resolves EncodingKey and its HMAC constructors.
- 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].