Exposure
.env file exposure
Make sure .env and other secret files cannot be downloaded from the public site.
Why it matters
A downloadable .env file can hand over database passwords, API keys, and signing secrets in one request.
This is one of the fastest ways for an automated scanner to take over a service. It is worth checking even if you think it is hidden.
How to fix it
-
Request /.env and confirm it returns 404
-
Keep secrets in the hosting environment, not in files under the web root
-
Rotate any secret that was ever reachable
Prompt for an AI assistant
Copy the text below and paste it into an AI assistant.
You are the person improving this website. Check the item below and fix it if it applies to the site. Item: .env file exposure Summary: Make sure .env and other secret files cannot be downloaded from the public site. Steps: 1. Request /.env and confirm it returns 404 2. Keep secrets in the hosting environment, not in files under the web root 3. Rotate any secret that was ever reachable References: - Secrets Management (OWASP) (https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) Constraints: - Keep the existing design and tone of voice. - Show the file or section you changed and the suggested final wording. - Do not decide ambiguous points alone; give options and a recommendation. - Do not change anything outside the listed item.
Checked by
-
vuln
Public exposure checks
Related checks
-
.git exposure
Block access to /.git/ so the repository history is not downloadable.
-
Secrets in client JavaScript
Keep API keys and tokens out of the JavaScript that browsers download.
References
-
Secrets Management (OWASP)
OWASP cheat sheet(Reference)
Check your site now
Enter a URL and find what is missing before launch, for free.
Run audit