Skip to main content
InfoInfo disclosureOWASP A05:2021CWE-538

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

  1. 1Move secrets out of any file served from the public web root.
  2. 2For frontend-only config (non-secret), use build-time environment variable injection (e.g., NEXT_PUBLIC_* in Next.js, Vite's import.meta.env).
  3. 3Never put API keys, database URLs, or OAuth secrets in client-side JavaScript.
  4. 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)

JavaScript
// .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)

JavaScript
// .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 bundled

Nginx (block config.js from public access)

nginx
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.

See every info disclosure check

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.

Propose a checkHow a check is built

Scan your own site for config.js / settings.js referenced (verify contents)

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

config.js / settings.js referenced (verify contents) | VulnRadar