How to fix: Sensitive source code comment in response
An HTML comment in the response contains potentially sensitive information such as file paths, credentials, or developer notes.
Why it matters
HTML comments are visible to anyone who views source, revealing internal paths, developer notes about security weaknesses, API endpoints, or occasionally credentials that were left during development.
Production HTML responses should not contain developer comments.
How to fix it
- 1Remove all HTML comments from production templates
- 2Use build-time comment stripping in your bundler
- 3Audit HTML output for <!-- comments --> before deploying
Code examples
Remove sensitive comments before deploying
// Remove or replace sensitive comments before production:
// BAD:
// TODO: remove hardcoded API key: sk_live_abc123
// FIXME: SQL injection vulnerability on line 42
// NOTE: admin password is 'hunter2'
// Use a linter rule (e.g. eslint no-warning-comments) to catch TODOs in CIReferences
Detected automatically by VulnRadar. The check id is source-code-comment, stable across every scan so you can filter or diff on it.
More content checks
- MediumPotential Open Redirect Parameters
- HighDirectory Listing Appears Enabled
- MediumSensitive File References Detected
- HighPotentially Outdated JavaScript Libraries
- Inforobots.txt Present - Review Manually
- InfoCMS / Technology Fingerprinting
- MediumPotentially Dangerous Inline JavaScript
- LowServer version disclosed in response header
Questions
- How severe is Sensitive source code comment in response?
- VulnRadar rates this medium severity in the content 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 source-code-comment, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Sensitive source code comment in response 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.