How to fix: config.js / settings.js referenced (verify contents)
A reference to a config.js or settings.js file was found in the page source. This filename is sometimes used to store API keys, backend endpoints, or environment-specific values, but is just as often a harmless frontend bundle (feature flags, CMS theme settings, public API base URLs). This finding only matches the filename, it does not inspect the file's actual contents.
Why it matters
If this file does contain API keys, service endpoints, or environment names in plain text, an attacker who requests it can extract credentials without authentication. A filename match alone does not confirm this: fetch the file directly and review its contents before treating it as a confirmed leak.
Developers sometimes place environment configuration in public JavaScript files for convenience, particularly in single-page applications. Any file served under a public web root is readable by any visitor regardless of whether it is linked from the main page. This check flags the reference for manual review.
How to fix it
- 1Move secrets out of any file served from the public web root.
- 2For frontend-only config (non-secret), use build-time environment variable injection (e.g., NEXT_PUBLIC_* in Next.js, Vite's import.meta.env).
- 3Never put API keys, database URLs, or OAuth secrets in client-side JavaScript.
- 4If a public config file is necessary, audit it to ensure it contains only non-sensitive values.
Code examples
Next.js (env vars instead of config.js)
// .env.local: never committed to source control
NEXT_PUBLIC_API_URL=https://api.example.com
// NOT secret: exposed to browser
// Secret values: never prefix with NEXT_PUBLIC_
DATABASE_URL=postgres://...
SECRET_KEY=...Vite (import.meta.env)
// .env
VITE_API_URL=https://api.example.com
// Accessed in code:
const apiUrl = import.meta.env.VITE_API_URL;
// Variables without VITE_ prefix are server-only and not bundledNginx (block config.js from public access)
location ~* /config\.js$ {
deny all;
return 404;
}References
Detected automatically by VulnRadar. The check id is config-js-leaked, stable across every scan so you can filter or diff on it.
More info disclosure checks
- MediumRails Session Cookie Missing HttpOnly Flag
- InfoServer header truncated
- InfoPHP session cookie naming exposes runtime
- Infoenv.js / environment.js referenced (verify contents)
- InfoSitemap.xml publicly accessible
- InfoOpenAPI schema version exposed in URL
- LowCORS exposes internal CDN hostname
- InforeCAPTCHA site key exposure
Questions
- How severe is config.js / settings.js referenced (verify contents)?
- VulnRadar rates this info severity in the info disclosure 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 config-js-leaked, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does config.js / settings.js referenced (verify contents) map to?
- It maps to CWE-538. 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.