Three public files that leak your app secrets: .env, .git and source maps (2-minute check)
Three files decide whether a stranger can read your secrets without touching your code: .env , the .git folder, and JavaScript source maps. AI app builders and quick deploys leave them public more often than people expect. You can test all three from a browser in two minutes, with no login. 1. A readable .env Open https://yourapp.com/.env and https://yourapp.com/.env.local . You should get a 404…
Three files reveal whether an unauthorized individual can access your application secrets without altering the code: .env, the .git folder, and source maps. Developers and quick deployment services often unintentionally make these files accessible.
You can test all three files from a web browser within two minutes, requiring no login credentials. To begin, access yourapp.com/.env and yourapp.com/.env.local. A successful response, showing lines with KEY=value, indicates that all values are exposed. Rotate each key and ensure the deploy process never serves these files again.
Next, open yourapp.com/.git/HEAD. If a response like ref: refs/heads/main is returned, the repository metadata is public. Attackers can reconstruct the source and history, including previous commits that may contain deleted secrets. To mitigate this, block the path on your hosting service and rotate any information that has been exposed in the past.
Lastly, examine the main JavaScript file for //# sourceMappingURL=. Retrieve this .map file. If downloaded, your original source code, comments, and file names become publicly available. While source maps alone do not constitute a breach, they expedite the process of identifying keys and hidden routes. To enhance security, deactivate source maps in production or restrict their access.
After identifying any exposed files, rotate all keys that could have been within the exposed files or history. Remember, rotation precedes cleanup. Exclude the file from the deployed output, not just the repository. After deploying, retest the same URL from a new browser session to ensure the exposure has been resolved.
When purchasing an application, conduct these three requests before making a bid. A 200 response on any of them raises concerns for the seller. Request the exact timeframe of the exposure and the steps taken to rotate the compromised credentials. Include a rotation clause in the contract to prevent similar incidents in the future.
While these checks assess what a stranger can retrieve, they do not reveal server-side code, user login behavior, or private infrastructure. A clean result lowers the overall risk but does not guarantee the application's security. ProofForge offers this assessment, along with additional checks, including keys in bundles, headers, and CORS configurations, all without the need for login. To address exposed .git folders, refer to the guide available at ProofForge's website.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to