Skip to content

Environment Scanning

The envpkt env scan command auto-discovers credentials from your shell by matching environment variable names and values against a registry of known patterns.

  1. Scan — iterate over all env vars in process.env
  2. Exclude — skip known non-credential vars (PATH, HOME, NODE_ENV, etc.)
  3. Match — test each var against three pattern tiers
  4. Score — assign a confidence level based on match quality
  5. Report — display results sorted by confidence (high first)

Known service-specific variable names matched with high confidence:

VariableService
OPENAI_API_KEYopenai
AWS_ACCESS_KEY_IDaws
STRIPE_SECRET_KEYstripe
GITHUB_TOKENgithub
DATABASE_URLdatabase
SUPABASE_ANON_KEYsupabase
DD_API_KEYdatadog

And ~38 more covering Anthropic, Azure, GCP, Slack, Twilio, SendGrid, Sentry, Vercel, Netlify, Cloudflare, Docker, npm, Hugging Face, Cohere, Replicate, Pinecone, Linear, MongoDB, Redis.

Recognized value prefixes matched with high confidence:

PrefixService
sk-ant-anthropic
sk-openai
sk_live_, sk_test_stripe
AKIAaws
ghp_, gho_, ghs_github
xoxb-, xoxp-slack
postgres://postgresql
redis://redis
mongodb://mongodb

Common credential suffixes matched with medium confidence:

_API_KEY, _SECRET_KEY, _SECRET, _TOKEN, _PASSWORD, _PASS, _AUTH_TOKEN, _ACCESS_TOKEN, _PRIVATE_KEY, _SIGNING_KEY, _WEBHOOK_SECRET, _DSN, _CONNECTION_STRING

The service name is derived by stripping the suffix and lowercasing (e.g., ACME_API_KEYacme).

LevelIconWhen
HighExact name match or recognized value prefix
MediumGeneric suffix pattern with derived service

Convert scan results to envpkt.toml:

Terminal window
# Preview what would be written
envpkt env scan --dry-run
# Write to envpkt.toml
envpkt env scan --write

After scaffolding, use envpkt env check for ongoing monitoring:

Terminal window
envpkt env check

This detects:

  • TOML keys missing from env — secrets defined but not set
  • Untracked env vars — credential-shaped vars not in TOML