Insufficient Protected Credentials High

The credentials being used do not have sufficient protection measures in place to prevent potential security breaches. Ensure that passwords and other sensitive information are stored in encrypted form.

Detector ID
scala/insufficiently-protected-credentials@v1.0
Category
Common Weakness Enumeration (CWE) external icon
Tags
-

Noncompliant example

1def nonCompliant(token: String) = {
2  val algo = JwtAlgorithm.HS256
3  // Noncompliant: hardcoded JWT secret is used.
4  JwtArgonaut.decodeJson(token, secretKey, algo)
5}

Compliant example

1class InsufficientlyProtectedCredentialsCompliant {
2    def compliant(token: String) = {
3    val algo = JwtAlgorithm.HS256
4    // Compliant: `getSecretFromEnv` method used to get JWT secret.
5    JwtArgonaut.decodeJson(token, getSecretFromEnv(), algo)
6  }
7}