Varlock adds typed schemas to environment files so agents see structure without secret values. It validates config, scans for leaks, and loads secrets from external vault plugins.
Overview
Varlock targets teams that manage environment variables in .env files and need stronger validation and secrecy boundaries, especially when AI coding tools read project configuration. A declarative .env.schema describes names, types, validation rules, and documentation while keeping sensitive values out of what agents consume.
The CLI validates schemas, pretty-prints resolved configuration, and can inject validated variables into other processes via varlock run. Integrations cover common JavaScript frameworks and CI platforms, with optional drop-in loading instead of dotenv in many setups.
Security features include proactive leak scanning with varlock scan and git hooks, runtime log redaction, and a credential proxy mode that lets untrusted agents work with placeholders while real secrets are injected only at verified network boundaries.
Plugins pull secret material from backends such as 1Password, Infisical, AWS, Azure, GCP, HashiCorp Vault, and others. The @env-spec DSL attaches schema metadata to .env files using JSDoc-style comments.
Install options include npm in Node projects, Homebrew, curl-based installers, and a Docker guide for containerized workflows.
Key features
- Typed .env.schema single source of truth
- AI-safe schema exposure without secrets
- varlock scan leak detection with git hooks
- Runtime log redaction and leak prevention
- Secret provider plugins for major vaults
- varlock run injects env into child processes
- Framework integrations for Vite, Next.js, Astro
- Credential proxy for agent placeholder isolation
Use cases
- Hardening .env files in AI-assisted development
- Validating environment config in CI
- Loading secrets from vaults into local dev
- Preventing accidental secret commits
- Running agents without exposing real API keys