360 Secure SkillHub
360 安全技能中心

Env Doctor

对 .env 环境变量文件做安全与规范审计:用正则识别 AWS、GitHub、Stripe、Slack、Google 密钥、JWT 与私钥块等泄露风险,检测重复变量、空值、占位符和语法错误,可与 .env.example 对比缺失或多余变量,支持 JSON 输出与分级退出码。仅依赖 Python 标准库。

johnnywang2001
johnnywang2001
热度 82.22
最近更新 2026-05-11 17:30:07
分类:安全依赖:代码执行 / 读写文件应用场景:自动化脚本 / 工作流 / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add jrv-env-doctor
Metadata
name
jrv-env-doctor
description
Validate .env files for common issues — detect leaked secrets (AWS keys, GitHub tokens, Stripe keys, JWTs), find duplicate variables, flag empty values, compare against .env.example templates, and catch syntax errors. Use when asked to check .env files, audit environment variables, scan for leaked secrets, validate env configuration, or compare .env against .env.example. No external dependencies.

Env Doctor

Validate and audit .env files for secrets, duplicates, syntax issues, and missing variables.

Quick Start

python3 scripts/env_doctor.py .env
python3 scripts/env_doctor.py .env --example .env.example
python3 scripts/env_doctor.py .env --strict --json

Features

  • Secret scanning — detects AWS keys, GitHub tokens, Stripe keys, Slack tokens, Google API keys, JWTs, private key blocks, and more
  • Duplicate detection — flags variables defined more than once
  • Example comparison — compares .env against .env.example to find missing or extra vars
  • Syntax validation — catches malformed lines, unquoted values with spaces
  • Placeholder detection — warns about values like "changeme", "your-api-key-here"
  • Exit codes — 0 = healthy, 1 = issues, 2 = secret leaks (CI-friendly)
  • No dependencies — Python stdlib only

Options

Flag Description
--example PATH .env.example file for comparison
--json Output structured JSON
--strict Treat empty values as errors

Secret Patterns Detected

AWS Access/Secret Keys, GitHub Tokens (ghp_, gho_, ghs_, ghu_, github_pat_), Slack Tokens, Stripe Keys, Google API Keys, Private Key Blocks, JWTs, Twilio Tokens, SendGrid Keys, Heroku API Keys, and generic high-entropy secrets.