Secrets in Front-End Assets

Medium

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

Estimated fix time: 30-60 minutes

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.

Automatically detect this issue

StackShield can automatically scan your Laravel application for this security issue and alert you when it's detected.

Start Free Trial
Was this guide helpful?