Metadata

ID: javascript-node-security/jwt-sensitive-data

Language: JavaScript

Severity: Warning

Category: Security

CWE: 312

Description

Never include sensitive information in a JWT. Instead, only use non-personal information to identify the end-user.

Non-Compliant Code Examples

jwt.sign(
    {user: { email: 'foo@bar.com'}}
)

jwt.sign(
    {user: { lastname: 'babar'}}
)

Compliant Code Examples

jwt.sign(
    {user: { id: 42}}
)