Skip to main content
HighAI codeOWASP A05:2021CWE-615

How to fix: Password or Credential Commented Out in Source

A commented-out password, secret, or credential was found in the response body. Developers frequently comment out credentials temporarily and forget to remove them before committing.

Why it matters

Commented credentials are permanently stored in git history and exposed in any source distribution. Even if removed later, the credential may be in git history or cached versions of the file.

AI code generators sometimes produce example code with commented-out credentials for documentation purposes. These find their way into production builds through bundlers that don't strip comments by default in development mode.

How to fix it

  1. 1Remove all commented-out credentials immediately and rotate them.
  2. 2Use .env files (gitignored) for credentials in development.
  3. 3Configure your bundler to strip all comments in production builds.
  4. 4Run git-secrets or truffleHog as a pre-commit hook to prevent credentials from entering git history.

Code examples

Pre-commit credential scan

bash
# Install git-secrets
brew install git-secrets
git secrets --install
git secrets --register-aws

# Or use trufflehog
trufflehog git file://. --since-commit HEAD --only-verified

References

Detected automatically by VulnRadar. The check id is vibe-password-in-comment, stable across every scan so you can filter or diff on it.

See every ai code check

Questions

How severe is Password or Credential Commented Out in Source?
VulnRadar rates this high severity in the ai code category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id vibe-password-in-comment, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Password or Credential Commented Out in Source map to?
It maps to CWE-615. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for password or credential commented out in source

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Password or Credential Commented Out in Source | VulnRadar