Sensitive data in a JWT detected.

  • Rule ID: ruby_lang_jwt
  • Languages: ruby
  • Source: jwt.yml


JWTs are not a secure place to store sensitive data. This rule looks for any sensitive data types saved to a JWT.


❌ Avoid storing sensitive data in JWT:

payload = { data: 'data', email: }
token = JWT.encode payload, hmac_secret, 'HS256'

✅ If you need to store user's information, use their unique database identifier instead of personal identifiable information:

payload = { data: 'data', user_id: user.uuid }
token = JWT.encode payload, hmac_secret, 'HS256'

Associated CWE

OWASP Top 10