Skip to content
Agentmart
Submit a tool

git-security-guard

Git 安全守卫。防止 API Key、Token、私钥、钱包地址、.env 文件等敏感信息被提交到 Git。在 git commit、git push、创建新 repo、PR review 时自动触发。当用户说"commit"、"push"、"安全检查"、"security…

Skill by myths-labs

IndexedMIT★ 36
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/myths-labs-git-security-guard

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Git 安全守卫。防止 API Key、Token、私钥、钱包地址、.env 文件等敏感信息被提交到 Git。在 git commit、git push、创建新 repo、PR review 时自动触发。当用户说"commit"、"push"、"安全检查"、"security check"、"有没有泄露"、"检查key"时触发。

Use cases: backend, security

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/git-security-guard

What's inside

Skill name
git-security-guard
Description
Git 安全守卫。防止 API Key、Token、私钥、钱包地址、.env 文件等敏感信息被提交到 Git。在 git commit、git push、创建新 repo、PR review 时自动触发。当用户说"commit"、"push"、"安全检查"、"security check"、"有没有泄露"、"检查key"时触发。
License
MIT
Instructions
126 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • name: missing

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Git Security Guard — 敏感信息泄露防护

## 触发时机
- **每次 git commit 前**(自动)
- **每次 git push 前**(自动)
- **新项目/新 repo 初始化时**
- **用户要求安全检查时**

## Pre-Commit 检查清单

### Step 1: 检查暂存文件名
```bash
git diff --cached --name-only | grep -iE '\.env|\.pem|\.p12|\.jks|\.key$|\.muse/|\.agent/|\.gemini/|memory/|convo/'
```
**任何匹配 → 立即阻止 commit,报告给用户。**

### Step 2: 检查暂存内容中的 Key 模式
```bash
git diff --cached | grep -iE 'sk-[a-zA-Z0-9]{20}|AIzaSy[a-zA-Z0-9_-]{33}|gsk_[a-zA-Z0-9]{20}|sk_live_|sk_test_[a-zA-Z0-9]{20}|pk_live_|pk_test_[a-zA-Z0-9]{20}|eyJhbGci[a-zA-Z0-9_-]{50}|-----BEGIN.*(PRIVATE|RSA)|AKIA[0-9A-Z]{16}|ghp_[a-zA-Z0-9]{36}|whsec_|xoxb-|xoxp-|service_role'
```
**任何匹配 → 立即阻止 commit,报告给用户。**

### Step 3: 排除误报
以下不算泄露:
- `.env.example` 中的占位符(`your-api-key`、`sk_test_your-...`)
- `process.env.XXX` 引用(代码读环境变量,不是硬编码)
- `node_modules/` 中的加密库代码
- 公开合约地址(USDC/USDT 等已知合约)
- 文档中的"不要这样做"示例

## 禁止提交的文件模式

| 文件模式 | 原因 |
|----------|------|
| `.env.local` / `.env.prod*` / `.env.vercel*` | 含真实 API Key |
| `.muse/` 目录 | 含内部战略/开发状态 |
| `.agent/` 目录 | 含内部 Skill/Prompt |
| `.gemini/` 目录 | 含 AI 对话记录 |
| `memory/` / `convo/` | 对话/记忆文件 |
| `*.pem` / `*.p12` / `*.jks` / `*.key` | 私钥/证书 |

## 禁止出现在代码中的 Key 模式

| 模式 | 服务 |
|------|------|
| `sk-[a-zA-Z0-9]{20,}` | OpenAI |
| `AIzaSy[a-zA-Z0-9_-]{33}` | Google/Gemini |
| `gsk_[a-zA-Z0-9]{20,}` | Groq |
| `sk_live_` / `sk_test_[实际值]` | Stripe Secret |
| `pk_live_` / `pk_test_[实际值]` | Stripe Publishable |
| `eyJhbGci[长JWT]` | JWT Token (Supabase/Vercel) |
| `AKIA[0-9A-Z]{16}` | AWS |
| `ghp_[a-zA-Z0-9]{36}` | GitHub PAT |
| `-----BEGIN (RSA )?PRIVATE KEY` | 私钥 |
| `0x[a-fA-F0-9]{64}` | 钱包私钥(注意:40位是地址,64位才是私钥) |
| `whsec_` | Stripe Webhook Secret |
| `xoxb-` / `xoxp-` | Slack Token |

## 新项目 .gitignore 模板

新 repo 第一个 commit 前必须包含:
```gitignore
# Env files (NEVER commit real keys)
.env
.env.local
.env.*.local
.env.prod*
.env.vercel*

# Internal files
.muse/
.agent/
.gemini/
memory/
convo/

# Private keys
*.pem
*.p12
*.jks
*.key

# IDE
.idea/
.vscode/

# OS
.DS_Store
```

## 泄露应急处理

如果发现敏感信息已经被 commit(即使还没 push):

### 1. 从全部历史中清除
```bash
git stash --include-untracked
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --force --index-filter \
  'git rm --cached --ignore-unmatch [泄露的文件]' --prune-empty HEAD
```

### 2. 清除本地残留
```bash
git for-each-ref --format='%(refname)' refs/original/ | xargs -n1 git update-ref -d
git reflog expire --expire=now --all
git gc --prune=now --aggressive
```

### 3. Force push(如果已推远程)
```bash
git push origin main --force
```

### 4. 轮换所有泄露的 Key
- 去对应平台重新生成 Key
- 更新 Vercel/服务器环境变量
- 更新本地 .env.local

## Deep Scan(完整历史扫描)

From myths-labs/muse, MIT.

More from myths-labs/muse

Signals

Stars
36
Forks
4
Open issues
0
Last commit (this folder)
Mar 21, 2026 (7 months ago)
Last release
Oct 24, 2026 (4 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from myths-labs

Cite this page

git-security-guard skill. Agent Mart. https://agentmart.dev/skills/myths-labs-git-security-guard (last updated 2026-10-24)