open-source-checker

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Open Source Checker

开源检查工具

Expert in detecting private information, secrets, and sensitive data in codebases before open sourcing a repository.
专门在代码仓库开源前检测其中的隐私信息、机密和敏感数据的工具。

When to Use This Skill

何时使用该工具

Use when you're:
  • Preparing to open source a repository
  • Reviewing code for exposed secrets
  • Auditing codebase for sensitive data
  • Performing security audits before public release
  • Setting up pre-commit hooks for secret detection
适用于以下场景:
  • 准备开源代码仓库时
  • 检查代码中是否存在暴露的机密信息
  • 审计代码库中的敏感数据
  • 公开发布前执行安全审计
  • 设置用于机密检测的提交前钩子(pre-commit hooks)

What to Check

检查内容

Critical Items

关键检查项

  • API keys (OpenAI, Stripe, AWS, GitHub tokens)
  • Database credentials and connection strings
  • Private keys and certificates (
    .pem
    ,
    .key
    )
  • Personal information (emails, phone numbers)
  • Environment files (
    .env
    should be gitignored)
  • API密钥(OpenAI、Stripe、AWS、GitHub令牌)
  • 数据库凭证和连接字符串
  • 私钥和证书(
    .pem
    .key
    文件)
  • 个人信息(邮箱、电话号码)
  • 环境配置文件(
    .env
    应添加到.gitignore中)

Git History (CRITICAL)

Git历史记录(重中之重)

  • Secrets remain in git history even after deletion
  • Must scan all branches, tags, and deleted files
  • Use
    gitleaks
    ,
    truffleHog
    , or
    git-secrets
  • 机密信息即使被删除仍会保留在Git历史记录中
  • 必须扫描所有分支、标签和已删除文件
  • 使用
    gitleaks
    truffleHog
    git-secrets

Quick Workflow

快速工作流程

  1. File scan: Check for secret files, patterns
  2. Code analysis: Search for hardcoded secrets
  3. Git history: Scan entire history with tools
  4. Setup hooks: Prevent future commits with secrets
  5. Clean history: Use
    git-filter-repo
    if needed
  1. 文件扫描:检查是否存在包含机密的文件和模式
  2. 代码分析:搜索硬编码的机密信息
  3. Git历史扫描:使用工具扫描完整的历史记录
  4. 设置钩子:防止未来提交包含机密信息的代码
  5. 清理历史:必要时使用
    git-filter-repo
    工具

Tools

推荐工具

  • gitleaks
    : Best for git history scanning
  • truffleHog
    : Alternative history scanner
  • git-secrets
    : AWS-focused with pre-commit hooks
  • detect-secrets
    : Baseline-based detection
  • gitleaks
    :最适合Git历史记录扫描的工具
  • truffleHog
    :另一种历史记录扫描工具
  • git-secrets
    :专注于AWS环境,支持提交前钩子
  • detect-secrets
    :基于基线的检测工具

References

参考资料

  • Full guide: Patterns, scanning workflow, git hooks, cleanup
  • 完整指南:检测模式、扫描流程、Git钩子、历史清理