How to Check Your Website for Env-Var Leaks and Exposed Files

Quick answer: Review your build bundles, public asset directories, and exposed web paths for secret tokens and sensitive files. Record all observed responses, matched key identifiers, and client script references. Choose appropriate key revocation steps or routing adjustments whenever unexpected files or private environment variables appear in client accessible outputs.

By Paula C · Kraftwire Software

· 6 min read

Inspect public script bundles and common configuration paths across your production hostname. Record the asset path, observed response status, and any credential patterns discovered during testing. Decide which secret rotation procedures apply whenever an environment token appears in public output.

How Should You Inspect Client Build Bundles and Scripts?

Inspect your built client JavaScript files by searching for sensitive string fragments and server environment variable identifiers across the production bundle assets. Record the asset name, the identified variable string, the character offset, and whether the value displayed represents a placeholder or an active runtime token. Decide whether the client bundle must be immediately pulled from your content delivery network based on whether live secret values appear in the script source.

Compare the exported keys in your client build artifacts against the agreed server secret registry established for your web application. Note the total key count, each matching variable name, whether access was expected on the frontend, and the corresponding code commit hash. Choose between rewriting client configuration files or moving sensitive downstream calls behind an isolated server route when unexpected values are exposed.

Test your client execution flow with an explicitly hypothetical token value like test_token_123 to observe whether runtime injection passes the secret down to the browser. Record the simulated input value, the observed browser console log, the resulting network request payload, and the final display state. Decide if secret rotation workflows must be triggered immediately across external service providers to prevent further use of the exposed credential.

How Should You Test Direct Sensitive Path Exposure?

Test common configuration paths including /.env, /.env.local, /.env.production, and /.git/HEAD by issuing direct HTTP GET requests to your web application domain. Record the requested path, the received response status, the content type header, and the observed response body length in bytes. Choose between updating edge firewall access rules or correcting your web server root configuration when any path yields file contents.

Inspect the response bodies returned by path queries to verify whether the server returned generic error HTML or raw key-value text contents. Note the first twenty characters of the body, the observed mime type, and whether strings resembling variable assignment syntax appear in the output. Decide whether public access to dotfiles is completely prohibited across your server configurations based on your published hosting baseline requirements.

Review server rule definitions, reverse proxy directives, or static hosting header settings that govern requests directed toward hidden or dot-prefixed paths. Record the configuration filename, the rule block line reference, the applied action directive, and the date of verification. Agree on an automated check within your deployment pipeline to verify path denial rules before releases reach live web infrastructure.

How Should You Review Framework Environment Prefix Settings?

Review your frontend framework build configuration to inspect which environment variable prefix conventions are bundled into client assets. Record the prefix rules identified, every defined variable matching those prefixes, and the target runtime environment assigned to each entry. Choose whether to rename exposed variables or decouple build configurations to keep server parameters out of public client bundles.

Compare local environment template files against the bundle generation rules to ensure database credentials and private keys lack frontend exposure prefixes. Note the variable name, the prefix assigned, whether the key connects to public or private resources, and the evaluating engineer. Decide whether to fail code integration runs whenever private secrets are assigned to framework-exposed prefixes in pull requests.

Test bundle compilation using an explicitly hypothetical sample key such as HYPOTHETICAL_KEY_99 assigned to both prefixed and unprefixed variables. Record the hypothetical key value, whether it appeared in the generated bundle file, and the observed compiler warning output. Decide if deployment scripts require refactoring to isolate build arguments from runtime client variable substitution.

How Should You Inspect Diagnostic Outputs and Telemetry Logs?

Inspect serverless execution logs, client-side error reporting captures, and monitoring streams for accidental variable dumps or environment traces. Record the logging service identifier, the inspected log event timestamp, the detected environment variable name, and the event origin. Choose whether runtime logs require immediate redaction and storage isolation based on your team data governance guidelines.

Review error handler logic to confirm whether unhandled errors serialize the process context or global environment state into browser responses. Note the handler file name, the observed payload structure, whether stack traces include runtime parameters, and the testing date. Decide whether logging utility configurations must be updated to filter process environment dumps during application runtime exceptions.

Test an intentional client failure using an explicitly hypothetical error payload like ERR_HYPOTHETICAL_DEBUG to inspect what metadata reaches telemetry logs. Record the simulated error string, the fields captured in the monitoring collector, and whether any surrounding environment data appeared. Decide if error tracking credentials and destination endpoints should be rotated if diagnostic reports were publicly accessible.

How Should You Prepare Secret Revocation and Remediation Workflows?

Prepare an exposure response runbook specifying the order of operations when private API keys or database tokens are observed in public web assets. Record the designated response roles, the emergency contact channels, the external provider revocation portals, and the runbook version date. Decide whether to execute immediate key revocation or schedule credential rotation based on the sensitivity classification of the exposed secret.

Review the access scope and privileges associated with each credential category found in public web paths to determine potential exposure blast radius. Note the credential name, the service provider, the granted access scopes, and whether read, write, or administrative rights were assigned. Choose whether to invalidate active application sessions and client tokens alongside backend credentials in accordance with your internal security response plan.

Document the key rotation steps, validation scans, and bundle verification checks required prior to closing an exposure incident ticket. Record the ticket identifier, the rotated key fingerprint, the verification scan timestamp, and the approving team lead signature. Agree on post-incident verification criteria before returning updated client assets and modified web server configurations to production service.

How Should You Document Automated Pipeline Exposure Controls?

Test pre-commit hooks and repository scanning scripts against commit diffs to intercept inadvertent environment variable commits before merge. Record the scanning tool command executed, the execution duration, the tested commit reference, and the detection outcome. Decide whether pull requests with unmasked secrets should trigger automatic merge blocks across repository branches.

Review scheduled workflow definitions that inspect deployed staging and production endpoints for exposed configuration files and bundles. Note the schedule frequency, the target URLs, the alert destination webhook, and the verification status of the notification channel. Choose whether automated external scanning should run on every staging deployment to verify public path closure.

Compare recent pull request additions against baseline variable lists to identify newly introduced environment dependencies before release. Record the pull request number, the added variable names, their intended runtime destination, and the code reviewer approval status. Decide if code repository history must be scrubbed using rewriting tools when historical commits contain active configuration secrets.

Frequently asked questions

How Should You Inspect Frontend Bundle Token Names?

Inspect your network transfer log and search your static JavaScript bundles for variable names intended strictly for private server processes. Record the bundle filename, the line position, the variable label, and whether the corresponding value is present in raw text. Decide whether to invalidate the token immediately or confirm deployment boundaries first against your incident policy.

How Should You Test Direct Sensitive File Paths?

Test direct HTTP requests against hypothetical paths such as `/.env`, `/.env.local`, and `/.git/config` on your public hostname. Note the exact HTTP status outcome, returned payload length, and whether file contents are returned as plain text. Choose between web server rewrite rules, edge blocking, or removing the file from the public directory tree.

How Should You Review Framework Client Prefix Configurations?

Review your build configuration to check if framework client prefixes inadvertently expose intended private configuration keys. Record each defined environment key prefix, the corresponding exposure status, and the repository file where it is assigned. Decide whether code review approval should be blocked until all referenced client prefixes match public exposure guidelines.

How Should You Prepare Credential Exposure Verification Registers?

Prepare a standardized verification worksheet listing every credential type, intended runtime environment, and authorized exposure level. Note the credential identifier, owner name, service provider, and whether public client visibility is permitted or prohibited. Choose whether rotation must take place across production credentials or if staging test credentials suffice.

How Should You Compare Public Assets Against Secret Registries?

Compare the text extracted from public asset files against your active secret inventory to spot matching credentials. Record the matched service key type, timestamp of discovery, bundle asset URL, and the authorized team member notified. Decide if an immediate credential revocation and token rotation sequence is required by your team.

How Should You Document Pre-Deployment Exposure Verification Runs?

Document the verification steps that release automation must execute prior to publishing assets to public hosting buckets. Note the pipeline stage name, execution timestamp, tested file patterns, and resulting pass or fail status. Decide whether to accept the pipeline run or halt deployment until build logs and artifacts remain sanitized.

Related guides

  • How to Check AI Agent Website Visibility and AEO Signals · Review your site robots.txt directives, root markdown resources, and server response headers across every public domain. Record all crawler user agent rules, file retrieval HTTP status codes, and payload formatting. Decide whether to permit search crawlers or training bots based on your explicit organisational visibility requirements.
  • How to Check if a Website Is Secure: A 10-Minute Audit · To check if a website is secure, run five free passive checks: confirm HTTP redirects to a valid HTTPS certificate with TLS 1.2+, verify security headers like CSP and HSTS, scan for exposed .env and .git files, check SPF, DKIM, and DMARC records, and look for a public status page. The whole audit takes about ten minutes.
  • Running a Comprehensive Website Domain Health Check in 30 Seconds · Choose a target hostname and confirm verification boundaries across your public assets. Review root DNS entries, transport certificates, routing headers, and mail authenticity records. Record each observed state against agreed internal standards. Decide on remediation steps whenever an observed value diverges from your team baseline.
  • AI Code Security Tools in 2026 | Comparing Check Coverage · Compare security tools by the inputs they inspect, the checks they run, and the evidence they report. URL scans, source analysis, dependency checks, secret detection, and code review have different coverage. Combine relevant checks with tests of your application’s intended permissions.

All security guides · Free security tools · Platform scanners · Security checklist