Skip to main content

dotvet 🛡️

Zero-config environment variable security scanner & quality gate.

Validate presence, ban dangerous placeholders, and enforce secret entropy before deploying to production.

npm version PyPI version License: MIT Zero Dependencies


⚡ The Problem: dotenv-safe Is Not Safe

Most tools (dotenv-safe, envalid, zod) only verify that a variable exists:

# Passes dotenv-safe with flying colors:
JWT_SECRET=changeme
API_KEY=your-secret-here

In production, a weak secret is worse than a missing secret. Undersized JWT secrets (< 32 characters) allow attackers to forge tokens with HS256 brute-force dictionaries in seconds.

dotvet does what other linters don't:

  1. 🔍 Zero config: Auto-scans your codebase (process.env.X, os.environ.get('X'), os.getenv('X'), import.meta.env.X, etc.) to find every environment variable you actually reference.
  2. 🚫 Placeholder eradication: Detects and bans dummy defaults like "changeme", "your-secret-here", "dummy", "admin", or "123456".
  3. 🔐 JWT-aware strictness: Any secret matching JWT or JWT_SECRET must be at least 32 characters (256-bit) or dotvet halts the build.
  4. 🎲 Entropy calculation: Audits sensitive keys using Shannon entropy to catch repetitive and trivial strings.
  5. 📜 Schema generation: Generates .env.schema.json and .env.example in a single command.
  6. 🌐 Dual-ecosystem & zero dependencies: Works natively across Node.js (npx dotvet) and Python (pip install dotvet) with zero third-party dependencies.

🚀 Quickstart

In Node.js / TypeScript Projects

Run immediately without installing:

npx dotvet

Or install as a dev dependency:

npm install --save-dev dotvet
# or
pnpm add -D dotvet
# or
yarn add -D dotvet

In Python Projects

pip install dotvet
dotvet

💻 CLI Commands

1. dotvet / dotvet check (Default)

Audits .env against variables referenced in your code:

npx dotvet
# or
dotvet check --env .env.production

Example Output:

dotvet v0.1.0 — Auditing environment variables in /projects/my-app
Environment file: .env (found) | Found 4 vars in code

 WARN  .env (GITIGNORE_MISSING)
  .env is present but not explicitly listed in .gitignore. Risk of committing secrets to Git!
  Fix: Add ".env" to your .gitignore file.

 FAIL  JWT_SECRET (JWT_UNDERSIZED)
  JWT secret JWT_SECRET length is only 18 chars (minimum 32 characters required for HMAC-SHA256). Weak JWT secrets can be forged in seconds!
  Referenced at:
    • src/auth.ts:12 → const token = jwt.sign(payload, process.env.JWT_SECRET);
  Fix: Generate a 32+ char secret: "openssl rand -base64 32"

 FAIL  DATABASE_URL (PLACEHOLDER_SECRET)
  Variable DATABASE_URL is set to placeholder "changeme". This is dangerous for production!
  Referenced at:
    • src/db.ts:4 → const pool = new Pool({ connectionString: process.env.DATABASE_URL });
  Fix: Replace the placeholder with a secure, generated value.

PASSED CHECKS (2):
  ✔ PORT
  ✔ REDIS_URL

 FAILURE  Found 2 errors and 1 warning.

2. dotvet scan

Inspects your entire codebase and maps out where every environment variable is used:

npx dotvet scan

Output:

dotvet scan — Discovered 3 environment variables:

  DATABASE_URL (2 usages)
    ↳ src/db.ts:4
    ↳ src/migrate.ts:10
  JWT_SECRET (1 usage)
    ↳ src/auth.ts:12
  PORT (1 usage)
    ↳ src/server.ts:8

3. dotvet generate

Automatically generates a .env.example file and .env.schema.json contract based on variables discovered across your codebase:

npx dotvet generate

🛡️ Security Rules

Rule Severity Description
MISSING_ENV_VAR FAIL Variable referenced in code is absent from .env and environment.
EMPTY_ENV_VAR FAIL Variable is defined in .env but has an empty string value.
PLACEHOLDER_SECRET FAIL Value matches known placeholder strings ("changeme", "your-secret-here", "dummy").
JWT_UNDERSIZED FAIL JWT secret is under 32 characters (violates minimum 256-bit requirement for HS256).
LOW_ENTROPY_SECRET WARN / FAIL Sensitive key has Shannon entropy < 2.5 bits/char (repeating or sequential keys).
GITIGNORE_MISSING WARN .env exists in directory but is not tracked in .gitignore.

⚙️ Options & Flags

Flag Default Description
--env <path> .env Path to environment file to audit
--strict false Treat warnings as hard errors (non-zero exit)
--ci false Emits GitHub Actions annotations (::error file=...)
--json false Emits machine-readable JSON output
-h, --help Show usage help
-v, --version Display version

🤖 CI / CD Integration (GitHub Actions)

Add dotvet as a gate in your pull request workflow:

name: Security & Env Quality Gate

on: [push, pull_request]

jobs:
  env-audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      
      # Runs zero-config audit; fails PR if secrets are weak, missing, or placeholders
      - name: Run dotvet
        run: npx dotvet --ci --strict
        env:
          # Provide your mock test secrets
          JWT_SECRET: "ci_valid_32_character_long_secret_key_12345"
          DATABASE_URL: "postgresql://ci:ci@localhost:5432/test"
          PORT: "3000"

📦 Publishing Tonight

Publish to npm

npm publish --access public

Publish to PyPI

python3 -m pip install --upgrade build twine
python3 -m build
python3 -m twine upload dist/*

🔒 Why Zero Dependencies?

Recent attacks on the open-source supply chain (such as the ChainDrop worm) demonstrated how deeply nested dependencies can introduce backdoors into developer tooling.

dotvet is designed from the ground up with 0 runtime dependencies in both Node.js and Python. It runs exclusively using native language standard libraries, guaranteeing:

  • Sub-200ms cold startup in CI.
  • Zero transitive supply chain attack surface.
  • Immunity to package manager lifecycle hook breaking changes (e.g. npm v12).

📄 License

MIT © 2026 dotvet contributors

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dotvet-0.1.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dotvet-0.1.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file dotvet-0.1.0.tar.gz.

File metadata

  • Download URL: dotvet-0.1.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for dotvet-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9b217a34c470f78988c365576ef70a2b4cdbf29451c8819c5366aef4535bbff4
MD5 a84efdaa77d57b9cc024e7baa12065b2
BLAKE2b-256 9a44525442555f9361ba6d062232ffd7e98bc4a5bfd9537740161009faa2c499

See more details on using hashes here.

File details

Details for the file dotvet-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dotvet-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for dotvet-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 beabd1dd000c6b3ec8e71e3229165d2f7ac5232d176503b8d97d93dc6228bc18
MD5 c1976e8e4fac1b76f8c65a62e1c2bf87
BLAKE2b-256 b23d2d679c9319562e9b6a6a484970a3d7f15879d40f34bce669fbda234ecad5

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page