← 返回 Skills 市场
suhteevah

envguard

作者 suhteevah · GitHub ↗ · v1.0.1 · MIT-0
darwinlinuxwin32 ⚠ suspicious
81
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install envguard
功能描述
Pre-commit secret detection — block leaked credentials, API keys, and .env files before they hit git
使用说明 (SKILL.md)

\r \r

EnvGuard — Pre-Commit Secret Detection\r

\r EnvGuard scans your code for leaked secrets, credentials, API keys, and .env file contents before they reach git. It uses regex-based pattern matching against 50+ secret formats from 20+ services, lefthook for git hook integration, and produces SARIF-compatible reports for compliance workflows.\r \r

Commands\r

\r

Free Tier (No license required)\r

\r

envguard scan [file|directory]\r

One-shot secret scan of files or directories.\r \r How to execute:\r

bash "\x3CSKILL_DIR>/scripts/envguard.sh" scan [target]\r
```\r
\r
**What it does:**\r
1. Accepts a file path or directory (defaults to current directory)\r
2. Finds all text files (excluding .git/, node_modules/, dist/, build/, vendor/, __pycache__)\r
3. Runs 50+ secret detection patterns against each file\r
4. Respects .envguardignore exclusions (gitignore syntax)\r
5. Outputs findings with: file, line number, pattern matched, severity, redacted match\r
6. Exit code 0 if clean, exit code 1 if critical/high findings detected\r
\r
**Example usage scenarios:**\r
- "Scan this repo for leaked secrets" -> runs `envguard scan .`\r
- "Check this file for API keys" -> runs `envguard scan src/config.ts`\r
- "Are there any secrets in my source code?" -> runs `envguard scan src/`\r
\r
### Pro Tier ($19/user/month -- requires ENVGUARD_LICENSE_KEY)\r
\r
#### `envguard hooks install`\r
Install git pre-commit hooks that scan staged files for secrets before every commit.\r
\r
**How to execute:**\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/envguard.sh" hooks install\r
```\r
\r
**What it does:**\r
1. Validates Pro+ license\r
2. Copies lefthook config to project root\r
3. Installs lefthook pre-commit hook\r
4. On every commit: scans all staged files for secrets, blocks commit if secrets found, shows remediation advice\r
\r
#### `envguard hooks uninstall`\r
Remove EnvGuard git hooks.\r
\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/envguard.sh" hooks uninstall\r
```\r
\r
#### `envguard allowlist [add|remove|list] [pattern]`\r
Manage false positive patterns. Allowlisted patterns are skipped during scanning.\r
\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/envguard.sh" allowlist add "EXAMPLE_API_KEY_FOR_TESTS"\r
bash "\x3CSKILL_DIR>/scripts/envguard.sh" allowlist remove "EXAMPLE_API_KEY_FOR_TESTS"\r
bash "\x3CSKILL_DIR>/scripts/envguard.sh" allowlist list\r
```\r
\r
**What it does:**\r
1. Validates Pro+ license\r
2. Reads/writes allowlist in ~/.openclaw/openclaw.json (envguard.config.allowlist)\r
3. Allowlisted patterns are treated as known-safe and skipped during scans\r
\r
#### `envguard diff`\r
Scan only staged changes (git diff --cached) for secrets.\r
\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/envguard.sh" diff\r
```\r
\r
**What it does:**\r
1. Validates Pro+ license\r
2. Gets staged changes via `git diff --cached`\r
3. Scans only added/modified lines for secrets\r
4. Ideal for pre-commit checks on large repos\r
\r
### Team Tier ($39/user/month -- requires ENVGUARD_LICENSE_KEY with team tier)\r
\r
#### `envguard history [directory]`\r
Full git history scan -- finds secrets in all previous commits.\r
\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/envguard.sh" history [directory]\r
```\r
\r
**What it does:**\r
1. Validates Team+ license\r
2. Walks entire git log using `git log -p`\r
3. Scans every diff for secrets across all commits\r
4. Reports: commit hash, author, date, file, line, pattern matched\r
5. Critical for onboarding repos that may have had secrets committed in the past\r
\r
#### `envguard report [directory]`\r
Generate a SARIF-compatible or markdown compliance report.\r
\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/envguard.sh" report [directory]\r
```\r
\r
**What it does:**\r
1. Validates Team+ license\r
2. Runs full scan of the directory\r
3. Generates a formatted markdown report with severity breakdown\r
4. Includes remediation steps for each finding category\r
5. Output suitable for compliance audits and security reviews\r
\r
#### `envguard policy [directory]`\r
Custom secret patterns and enforcement rules.\r
\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/envguard.sh" policy [directory]\r
```\r
\r
**What it does:**\r
1. Validates Team+ license\r
2. Loads custom patterns from ~/.openclaw/openclaw.json (envguard.config.customPatterns)\r
3. Enforces organization-specific secret rules (e.g., internal token formats)\r
4. Combines custom patterns with built-in patterns for comprehensive scanning\r
\r
## Detected Secret Types\r
\r
EnvGuard detects 50+ secret patterns across 20+ services:\r
\r
| Category | Examples | Severity |\r
|----------|----------|----------|\r
| AWS Credentials | AKIA* keys, aws_secret_access_key | Critical |\r
| Stripe Keys | sk_live_*, sk_test_*, rk_live_*, whsec_* | Critical |\r
| GitHub Tokens | ghp_*, gho_*, ghu_*, ghs_*, ghr_* | Critical |\r
| GitLab Tokens | glpat-* | Critical |\r
| Private Keys | RSA, OPENSSH, DSA, EC, PGP private keys | Critical |\r
| Slack Tokens | xoxb-*, xoxp-*, xoxo-*, xapp-* | High |\r
| Google API Keys | AIza* | High |\r
| JWT Tokens | eyJ* (long base64 tokens) | High |\r
| Database URIs | postgres://, mysql://, mongodb://, redis:// | High |\r
| Twilio Keys | SK* account SIDs | High |\r
| SendGrid Keys | SG.* | High |\r
| Firebase/Supabase | API keys and service tokens | High |\r
| npm Tokens | npm_* | High |\r
| Heroku API Keys | Heroku token patterns | Medium |\r
| DigitalOcean | dop_v1_*, doo_v1_* | Medium |\r
| Azure Keys | Azure subscription/account keys | Medium |\r
| Cloudflare | API tokens and keys | Medium |\r
| Docker Hub | Docker auth tokens | Medium |\r
| Mailgun/Postmark | API keys | Medium |\r
| Generic Secrets | api_key=, password=, secret=, token= | Low |\r
| .env Leaks | KEY=value patterns in source files | Low |\r
\r
## Configuration\r
\r
Users can configure EnvGuard in `~/.openclaw/openclaw.json`:\r
\r
```json\r
{\r
  "skills": {\r
    "entries": {\r
      "envguard": {\r
        "enabled": true,\r
        "apiKey": "YOUR_LICENSE_KEY_HERE",\r
        "config": {\r
          "severityThreshold": "high",\r
          "allowlist": [],\r
          "customPatterns": [],\r
          "excludePatterns": ["**/node_modules/**", "**/dist/**", "**/.git/**"],\r
          "reportFormat": "markdown"\r
        }\r
      }\r
    }\r
  }\r
}\r
```\r
\r
## Important Notes\r
\r
- **Free tier** works immediately with no configuration\r
- **All scanning happens locally** -- no code or secrets are sent to external servers\r
- **License validation is offline** -- no phone-home or network calls\r
- Supports .envguardignore files (gitignore syntax) to exclude paths\r
- Matches are always **redacted** in output (first/last 4 chars only)\r
- Git hooks use **lefthook** which must be installed (see install metadata above)\r
- Exit codes: 0 = clean, 1 = findings detected (for CI/CD integration)\r
\r
## Error Handling\r
\r
- If lefthook is not installed and user tries `hooks install`, prompt to install it\r
- If license key is invalid or expired, show clear message with link to https://envguard.pages.dev/renew\r
- If a file is binary, skip it automatically with no warning\r
- If .envguardignore is malformed, warn and continue with default excludes\r
- If no files found in target, report clean scan with info message\r
\r
## When to Use EnvGuard\r
\r
The user might say things like:\r
- "Scan for leaked secrets"\r
- "Check if any API keys are in my code"\r
- "Set up secret scanning on my commits"\r
- "Are there any credentials in this repo?"\r
- "Generate a security report for compliance"\r
- "Scan git history for leaked passwords"\r
- "Block secrets from being committed"\r
- "Check my staged files for secrets"\r
- "Add a false positive to the allowlist"\r
安全使用建议
This package appears to do what it says: local regex-based scanning and optional pre-commit hook installation. Before installing: (1) confirm you want lefthook added to your repo (envguard hooks install will modify/append lefthook.yml and install a pre-commit hook that can block commits), (2) know that allowlist and license values are stored/managed in ~/.openclaw/openclaw.json (the skill will read/write that file), (3) Pro/Team commands require ENVGUARD_LICENSE_KEY (and the code can optionally use CLAWHUB_JWT_SECRET to verify license signatures if you set it), and (4) if you want to audit behavior, review the included scripts (scripts/*.sh) since scanning is implemented in plain shell and runs locally with no external network calls. If you do not want local config changes or repo hook modifications, avoid running the hooks install command.
功能分析
Type: OpenClaw Skill Name: envguard Version: 1.0.1 The EnvGuard skill provides legitimate secret detection capabilities but contains a critical command injection vulnerability in `scripts/envguard.sh`. The `allowlist add` and `allowlist remove` commands use unsanitized shell variables (`$pattern`) directly within `python3 -c` and `node -e` execution strings. This allows for arbitrary code execution (RCE) if an attacker can influence the pattern argument, for example, through prompt injection against the AI agent. While the tool's logic for scanning and git hook integration appears benign and aligned with its stated purpose, this high-risk implementation flaw poses a significant security risk to the host environment.
能力标签
cryptorequires-walletrequires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The skill is a local secret scanner / git hook integrator. Required binaries (git, bash, python3, jq) and the brew install of lefthook are appropriate for installing and running pre-commit hooks and performing local file scans. The declared primary credential (ENVGUARD_LICENSE_KEY) matches the SKILL.md which gates Pro/Team features.
Instruction Scope
Runtime instructions and scripts only operate locally: scanning files, reading .envguardignore, managing allowlist entries in ~/.openclaw/openclaw.json, installing a lefthook config into the repo, and scanning staged files via sourced scripts. These behaviors match the described purpose, but the skill will write/append to repo lefthook.yml and read/write your ~/.openclaw/openclaw.json for allowlist/license settings—users should expect those filesystem changes.
Install Mechanism
Install uses a well-known package manager entry (brew formula: lefthook). The skill bundle includes all scripts/patterns locally (no arbitrary remote downloads or extract-from-unknown-URLs), so installation risk is limited to installing lefthook and placing the skill files (normal for a ClawHub skill).
Credentials
ENVGUARD_LICENSE_KEY is the only declared required credential and is justified by the license-gated features. The code optionally references CLAWHUB_JWT_SECRET for offline JWT verification (used only if present) but that env var is not declared in requires.env; it is optional and only used to verify license tokens locally. The skill reads/writes ~/.openclaw/openclaw.json (declared in SKILL.md), which is proportionate but means CI/automation keys stored there could be read by the skill.
Persistence & Privilege
always:false and normal autonomous invocation settings are used. The skill writes its own config (allowlist) into ~/.openclaw/openclaw.json and can append/configure lefthook in a repository (expected behavior for a git hook tool). It does not request elevated or cross-skill privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install envguard
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /envguard 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Fix: declare all deps, JWT verification, configPaths
v1.0.0
Initial release of EnvGuard — advanced local pre-commit secret detection for git repositories. - Scans for 50+ secret patterns (API keys, credentials, .env data) in files and git history. - Free tier: On-demand file/folder scans; outputs findings with severity and redaction. - Pro/Team tiers: Installs git pre-commit hooks, scans staged changes, manages allowlist, generates compliance reports, and supports custom secret policies. - SARIF and markdown report generation for security review. - All scanning is local, offline, and respects .envguardignore exclusions. - Lefthook integration for git hooks; supports macOS, Linux, and Windows.
元数据
Slug envguard
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

envguard 是什么?

Pre-commit secret detection — block leaked credentials, API keys, and .env files before they hit git. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 81 次。

如何安装 envguard?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install envguard」即可一键安装,无需额外配置。

envguard 是免费的吗?

是的,envguard 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

envguard 支持哪些平台?

envguard 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(darwin, linux, win32)。

谁开发了 envguard?

由 suhteevah(@suhteevah)开发并维护,当前版本 v1.0.1。

💬 留言讨论