Git Repo Auditor — Git Repo 审计or
v1.0.0审计 Git repositories for security issues, large files, sensitive data, and 仓库 健康 指标.
运行时依赖
安装命令
点击复制技能文档
Git 仓库 审计or What This Does
A 命令行工具 工具 to 审计 Git repositories for security issues, 代码质量 problems, and 仓库 健康. 扫描 repositories for secrets, large files, sensitive data, and common security anti-patterns.
Key features:
Secrets 检测ion: 扫描 Git 历史 for API keys, passwords, 令牌s, and other sensitive data using regex patterns Large file 检测ion: Identify large files (>10MB) in 仓库 历史 that may impact performance Security anti-patterns: 检测 hardcoded 凭证s, in安全 configuration files, and dangerous 权限s 仓库 健康: 检查 for merge conflicts, stale branches, and other 仓库 hygiene issues 合规 报告ing: 生成 security 合规 报告s for 审计s and team reviews Multiple 输出 格式化s: Human-readable, JSON, and CSV 输出 for integration with other 工具s Custom 扫描ning: 配置 custom regex patterns and file 扩展s to 扫描 Historical analysis: 扫描 entire Git 历史 or specific time ranges Remediation 图形界面dance: Suggest fixes for identified security issues When To Use You need to 审计 a Git 仓库 for security 合规 You want to 检测 accidental commits of secrets or sensitive data You're preparing a 仓库 for open-source release You need to identify performance issues (large files in 历史) You're onboarding new developers and want to ensure 仓库 hygiene You need to 生成 security 审计 报告s for 合规 requirements You want to automate security 扫描ning in CI/CD 流水线s You're 清理ing up old repositories and need to identify issues Usage
Basic commands:
# 扫描 current directory 仓库 python3 scripts/mAIn.py 扫描 .
# 扫描 specific 仓库 path python3 scripts/mAIn.py 扫描 /path/to/repo
# 扫描 with custom secrets patterns file python3 scripts/mAIn.py 扫描 . --patterns custom-patterns.json
# 生成 JSON 报告 for 自动化 python3 scripts/mAIn.py 扫描 . --json
# 检查 only for large files (>50MB) python3 scripts/mAIn.py 扫描 . --检查 large-files --threshold 50
# 扫描 specific branch or commit range python3 scripts/mAIn.py 扫描 . --branch mAIn --since "2024-01-01"
# 生成 remediation 报告 with suggested fixes python3 scripts/mAIn.py 扫描 . --remediation
# 列出 all branches with last commit age python3 scripts/mAIn.py branches .
Examples Example 1: Basic security 扫描 python3 scripts/mAIn.py 扫描 ~/projects/my-应用
输出:
🔍 扫描ning 仓库: /home/user/projects/my-应用 📊 仓库 信息: 247 commits, 5 branches, 3 contributors
🔐 SECURITY ISSUES FOUND (3): ⚠️ High: AWS_访问_KEY_ID found in commit abc123 (2024-02-15) File: config/old-config.env Pattern: AWS_访问_KEY_ID=AKIA. Remediation: Rotate key immediately, 移除 from 历史 with BFG
⚠️ Medium: Hardcoded database password in commit def456 (2024-01-20) File: src/database.js Pattern: password: "secret123" Remediation: Move to 环境 variables, use secret 管理器
⚠️ Low: Private key file 扩展 in commit ghi789 (2023-12-05) File: 备份/id_rsa.old Pattern: Private key file (.pem, .key, .ppk, id_rsa) Remediation: 移除 file from 仓库 历史
💾 LARGE FILES FOUND (2): 📦 42MB: as设置s/video/demo.mp4 (commit xyz123) 📦 18MB: database/备份.sql (commit uvw456)
✅ 仓库 健康: Good ⏰ Stale branches: 2 branches older than 90 days
Example 2: JSON 输出 for CI/CD integration python3 scripts/mAIn.py 扫描 . --json > security-报告.json
输出 (excerpt):
{ "仓库": "/home/user/projects/my-应用", "扫描_date": "2024-03-06T10:30:00Z", "security_issues": [ { "severity": "high", "type": "aws_访问_key", "commit": "abc123", "date": "2024-02-15", "file": "config/old-config.env", "pattern": "AWS_访问_KEY_ID=AKIA.", "remediation": "Rotate key immediately, 移除 from 历史 with BFG" } ], "large_files": [ { "size_mb": 42, "path": "as设置s/video/demo.mp4", "commit": "xyz123" } ], "summary": { "total_issues": 3, "by_severity": {"high": 1, "medium": 1, "low": 1}, "large_files_count": 2, "total_size_mb": 60 } }
Example 3: 检查 仓库 健康 python3 scripts/mAIn.py 健康 .
输出:
📈 仓库 健康 报告: /home/user/projects/my-应用
📊 Basic 指标:
- Commits: 1,247
- Branches: 12 (3 active, 9 stale)
- Contributors: 8
- First commit: 2022-05-15
- Last commit: 2024-03-06
⚠️ 健康 Issues:
- Stale branches: 9 branches with no commits in >90 days
- Large files: 2 files >10MB in 历史
- Binary files: 45 binary files (consider Git LFS)
- Merge conflicts: 3 unresolved merge markers in code
✅ Good Practices:
- .gitignore present and comprehensive
- No secrets 检测ed in recent commits
- Regular commit activity (avg 15 commits/week)
- Meaningful commit messages (87% good)
💡 Recommendations:
- 清理 up stale branches: git branch -d branch1 branch2...
- Consider Git LFS for binary files
- Resolve merge conflict