Secrets in JavaScript Bundles Check: What StackShield Scans

Scans the page, its scripts and source maps for published credentials, and looks for a leftover Vite hot file.

application security Medium fix 30-60 minutes

What This Check Detects

Scans the page, its scripts and source maps for published credentials, and looks for a leftover Vite hot file.

Full Documentation

What this check looks for

StackShield downloads what a browser downloads: your home page, the scripts it loads from your own domain and any source maps published beside them. It searches them for credentials with a recognisable shape, such as Stripe live secret keys, AWS access keys, GitHub tokens, private keys, a Laravel APP_KEY and database URLs that include a password. It also checks for a hot file left in the public directory.

Matched values are stored redacted.

Why it matters

Vite compiles every environment variable that starts with VITE_ into the JavaScript bundle. That is the intended way to pass public values to the front end, and it means a secret given that prefix is published to every visitor. The same goes for a key rendered into a page for a script to pick up. Nothing breaks when this happens, so it tends to go unnoticed.

What the findings mean

A credential finding means the value is public and should be treated as compromised: rotate it first, then remove it from the front end. A hot file means Laravel is loading scripts from a Vite dev server address instead of your built assets. Public source maps are reported as a warning: they expose your original front-end source rather than a secret.

Only values that are meant to be public should carry the VITE_ prefix. Set build.sourcemap to false or 'hidden' for production, and delete public/hot from the server.

Related Security Checks

Free security check

Is your Laravel app exposed right now?

34% of Laravel apps we scan have at least one critical issue, and most teams do not find out until something breaks. The free scan checks your live app in 60 seconds. Then StackShield re-runs every check after each deploy, so a fix you ship today does not quietly regress next week.

18% have debug mode on
72% missing security headers
12% have exposed .env
Scan My App Free No signup for the scan. Continuous monitoring on a 14-day trial, no card.