Why Are Your Secrets or API Keys Exposed?
Exposed secrets are one of the most dangerous production mistakes - scrapers and bots scan GitHub and common URLs for leaked credentials within minutes of exposure. If your API keys, database passwords, or .env file are publicly accessible, assume they have already been read. Here is what to check and how to fix it.
Why this happens
.env file is publicly accessible at /.env
When a project is deployed from the project root instead of the build output folder, the .env file becomes publicly accessible at yourdomain.com/.env. Anyone can visit that URL and read your database passwords, API keys, and OAuth secrets in plain text. This is extremely common on misconfigured VPS and shared hosting deployments.
How to Secure Your .env File →.git directory is accessible - full source code downloadable
If yourdomain.com/.git/config returns a 200 response, your entire git history is downloadable. This includes every file ever committed - even secrets you deleted in a later commit. Attackers can reconstruct your full source code and extract credentials that were committed at any point in time.
How to Block .git Directory Access →API keys hardcoded in frontend JavaScript
Any key in your frontend JavaScript - including bundled React, Vue, or Svelte code - is visible to anyone who opens browser DevTools. Bots scan public GitHub repos and sites for patterns matching API keys (OpenAI, Stripe, AWS) within minutes of publication. Secret keys must stay on the server.
How to Remove Exposed API Keys →Not sure which of these apply to your domain?
Run a free scan - 26 checks in under 10 seconds.