Sensitive information in comments

Sensitive information in comments

Description

Comments can carry passwords, API keys, tokens, or internal addresses into repositories and distributed bundles.

Potential impact

A credential copied from a comment may still grant access after the comment is removed.

Remediation

Revoke and replace any exposed credential. Remove the value and internal connection details from the comment. Review repository history for other copies. Cleaning history cannot recall a copy someone already has.

Examples

Before

javascript
// password = "prod-db-password"

After

javascript
// password is loaded from the secret manager at runtime

The revised comment names the secret manager without revealing the password. It describes where the application should load the value.

References