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.
1def nonCompliant(token: String) = {
2 val algo = JwtAlgorithm.HS256
3 // Noncompliant: hardcoded JWT secret is used.
4 JwtArgonaut.decodeJson(token, secretKey, algo)
5}
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}