Sensitive data in a exception message detected.

  • Rule ID: javascript_lang_exception
  • Languages: javascript
  • Source: exception.yml

Description

Leaking sensitive data to an exception is a common cause of data leaks and can lead to data breaches. This rule looks for instances of sensitive data sent to exceptions.

Remediations

❌ Avoid using sensitive data in exception messages:

throw new CustomError(`Error with ${user.email}`)

✅ If you need to identify a user, ensure to use their unique identifier instead of their personal identifiable information:

throw new CustomError(`Error with ${user.uuid}`)

Associated CWE

OWASP Top 10