How to fix: Debug Information Embedded in Page JavaScript
Debug information such as internal server paths, configuration values, or environment details was found in page-embedded JavaScript (window.__NEXT_DATA__, __NUXT__, etc.).
Why it matters
Internal paths, configuration keys, database names, internal service URLs, and deployment details accelerate reconnaissance for an attacker mapping your infrastructure.
Server-side rendering frameworks (Next.js, Nuxt) serialize server-side props into the page HTML for hydration. If server-side code accidentally includes internal configuration in these props, it reaches every browser.
How to fix it
- 1Audit what data is included in getServerSideProps / getStaticProps return values.
- 2Never pass process.env, database config, or internal service details to the frontend.
- 3Use a strict serialization allowlist: only pass the exact fields the UI needs.
- 4Check window.__NEXT_DATA__ or __NUXT__ in browser dev tools to see what's exposed.
Code examples
Safe server-side props
// Bad: leaks server config
export async function getServerSideProps() {
return { props: { config: process.env, dbUrl: DB_URL } };
}
// Good: only UI data
export async function getServerSideProps(ctx) {
const user = await getUser(ctx.req);
return { props: { userName: user.name, plan: user.plan } };
}References
Detected automatically by VulnRadar. The check id is debug-info-in-page-js, stable across every scan so you can filter or diff on it.
More client-side checks
- HighCSP Allows 'unsafe-inline' Scripts
- MediumCSP Allows 'unsafe-eval'
- HighpostMessage Without Origin Validation
- HighSensitive Data Stored in localStorage
- HighDOM XSS via location.hash Assignment
- Highdocument.write() in Page Scripts
- Higheval() in Client-Side JavaScript
- MediumExternal Script Without Subresource Integrity
Questions
- How severe is Debug Information Embedded in Page JavaScript?
- VulnRadar rates this low severity in the client-side 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 debug-info-in-page-js, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Debug Information Embedded in Page JavaScript map to?
- It maps to CWE-489. 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.