DevTools Logo

.env Secret Safety Linter

.env Secret Safety Linter

Find syntax problems, leaked credentials, and placeholder secrets entirely in your browser.

.env content

One KEY=VALUE assignment per line. Comments and export prefixes are supported; multiline values are not.

Examples

Catch an OpenAI project key

Input
OPENAI=sk-proj-1234567890abcdef
Output
error api-token: "API token pattern detected" (line 1)

The sk-(proj-)? pattern matches both sk- and sk-proj- tokens and raises an error-severity api-token finding.

Syntax versus key errors

Input
SECRET="unterminated
export APP_NAME=demo
SPACED KEY=x
Output
line 1 unterminated-quote (multiline not supported)
line 2 entry APP_NAME=demo, no findings
line 3 invalid-key error

Quotes must close on the same line, export prefixes are stripped before parsing, and spaces in names fail KEY_PATTERN as invalid-key.

About this tool

Env Secret Leak Linter parses dotenv-style text with parseEnv into { entries, findings }, where each entry records { line, key, value, raw }. It skips blanks and # comments, strips an export prefix, and requires a KEY=VALUE shape: missing delimiters yield a syntax error, names outside /^[A-Za-z_][A-Za-z0-9_]*$/ yield invalid-key (so SPACED KEY=value is invalid-key, not syntax), and a second = immediately after the delimiter yields extra-equals. Quoted values must close on the same line — unterminated quotes report unterminated-quote ("multiline values are not supported"), trailing junk after a closing quote reports trailing-value, and empty values report info-level empty-value. There is no duplicate-key detection: repeated keys are both kept as entries.

lintEnv (aliased as analyzeEnv) replays parse findings, then inspects each value for leaked credentials: AWS AKIA keys, GitHub ghp/gho/ghu/ghs/ghr tokens, OpenAI sk- and sk-proj- tokens, PEM private-key blocks, and JWT-shaped triples each raise errors (aws-key, github-token, api-token, private-key, jwt), while placeholder text like changeme or ${SECRET} raises info-level placeholder and long (≥20 chars) high-entropy (≥4.2 bits via shannonEntropy) values raise high-entropy warnings. Findings sort by line, then severity error → warn → info.

Results also include a redacted template from generateEnvTemplate, which maps every parsed entry to KEY= with values stripped — safe to commit or paste into setup docs. Unquoted values have trailing # comments trimmed; quoted values keep their literal contents, so TOKEN="abc=123" parses to abc=123 with the raw line preserved for auditing.

How to use this tool

  1. Paste the env file

    Paste dotenv content (export prefixes welcome). Read entries for the parsed keys and findings for line-numbered syntax and leak reports.

  2. Triage findings by severity

    Fix error findings first (credential patterns, invalid keys, unterminated quotes); treat high-entropy warns as review prompts and placeholder infos as deploy-time reminders.

  3. Export a safe template

    Copy the generated template (KEY= per entry, values stripped) into the repo instead of the real file, and scan it again to confirm it is clean.

Use cases

Pre-commit secret scan

Lint .env files for AWS, GitHub, OpenAI, JWT, and private-key material before it reaches source control.

Onboarding-safe templates

Generate a values-stripped KEY= template from a working env file so teammates get the schema without the secrets.

Debugging dotenv parse failures

Pinpoint unterminated quotes, extra delimiters, and invalid names by line instead of guessing why an app missed a variable.

Common mistakes

Mistake:Splitting a value across lines inside quotes.

Fix:Multiline quoted values are rejected with unterminated-quote. Keep each assignment on one line or load long secrets from a file reference instead.

Mistake:Assuming duplicate keys are flagged or merged.

Fix:Both entries are kept with no duplicate finding. Remove the stale line yourself — most runtimes honor only one of them.

Mistake:Reading a key-with-spaces error as a missing =.

Fix:SPACED KEY=x contains =, so it reports invalid-key, not syntax. Rename to SPACED_KEY to satisfy the KEY_PATTERN.

Frequently asked questions

What does this tool do?

It parses dotenv text with parseEnv into line-numbered entries plus syntax findings, then lintEnv scans values for AWS, GitHub, OpenAI (sk- and sk-proj-), private-key, and JWT patterns with placeholder and high-entropy heuristics, and generateEnvTemplate emits a values-stripped KEY= template.

Why did my multiline value, export line, or spaced key behave that way?

Quoted values must close on the same line (unterminated quotes report multiline-not-supported), export prefixes are stripped so export FOO=bar parses cleanly, and SPACED KEY=x reports invalid-key rather than a missing-= syntax error. Duplicate keys are both kept — there is no dedup finding.

Is my env file uploaded or stored?

No. Parsing, pattern matching, entropy math, and template generation are 100% client-side — secrets never leave your browser. Commit the generated template, not the real file.

How do I triage the findings?

Fix error findings first (credential patterns like sk-proj- api-token, invalid keys, unterminated quotes), review high-entropy warns (≥20 chars, ≥4.2 bits) for provenance, and treat placeholder infos as replace-at-deploy reminders. Findings sort by line, then error → warn → info.

References & standards

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML

Apache Config Generator

Build an Apache 2.4 VirtualHost — ServerName, DocumentRoot, Directory, aliases, and optional SSL