Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

github-sensitive-data-cleanup

БесплатноЗапускает вложенные скриптыНе проверен

Scans and removes sensitive data (secrets, API keys, private domains/IPs, PII) from GitHub repository history, then verifies and force-pushes safely. Use for…

daymadeот daymade★ 1 556 звёзд на GitHub

Об этом скилле

GitHub Sensitive Data Cleanup

Overview

This skill guides you through safely removing sensitive data from a Git repository's history and pushing the cleaned history to GitHub. It encodes the hard-won lessons from real incidents: scan first, backup before rewriting, verify after rewriting, and never force-push to a public repo without checking its visibility and fork count.

The bundled scripts automate the mechanical parts:

  • scripts/scan_repo.py — scan the repo for secrets and private context.
  • scripts/rewrite_history.py — create a backup and rewrite history with git-filter-repo.
  • scripts/verify_cleanup.py — confirm the sensitive content is gone.
  • scripts/safe_push.py — verify repo visibility and push safely.

This skill is conservative by design. If any safety check fails, it stops and asks for human confirmation rather than continuing.

When to Use This Skill

Trigger this skill when the user:

  • Says "scan sensitive data", "扫描敏感信息", "看看仓库有没有泄露".
  • Wants to "clean git history", "sanitize history", "rewrite history", "remove secrets from history".
  • Has accidentally pushed a secret, private domain, internal IP, or PII to a public repository.
  • Is about to force-push to a public repository (even without sensitive data).
  • Mentions git filter-repo, BFG, git-filter-branch, or history rewrite.

Prerequisites

Install these tools once per machine:

# git-filter-repo (modern replacement for git-filter-branch)
brew install git-filter-repo

# gitleaks (secret scanner)
brew install gitleaks

# GitHub CLI
brew install gh

The scripts assume git-filter-repo and gitleaks are on PATH. The skill will check this before running destructive operations.

Safety Rules (Non-Negotiable)

  1. Scan before you decide. Never rewrite history based on a hunch.
  2. Create a backup before rewriting. Use git bundle or a fresh bare clone.
  3. Verify repo visibility with gh repo view before any push. Do not infer public/private from the URL or directory name.
  4. Never use --no-verify to bypass hooks. If the PII Guard hook fails, fix the underlying issue or add an allowlist; do not bypass.
  5. Use one explicit lease bound to the saved remote commit. A rejected lease stops the push; never fall back to --force or refresh the expected commit to bypass concurrent work.
  6. Verify after rewriting. A clean git log is not enough; re-run the scanner and do an AI semantic review.
  7. Public repos with forks need extra care. Forks and clones may retain old history. Verify the named exposure and ownership before choosing a route; contact owners only within the authorized recipient/message scope.

Workflow

Step 0: Confirm the repo path and current branch

cd /path/to/repo
git status --short
git remote -v

Use an exact repository root. Scan and verification accept ordinary, linked worktree and bare roots. Rewrite requires an independent clone: linked roots and ordinary or bare repositories with attached worktrees are refused. A bare mirror has no working-tree status to check; verify its Git identity instead.

Step 0.5: Bind each exposed surface

The acting agent records the known finding's exact public locations and the authorized remediation scope in private task evidence. Follow the finding, not an unbounded inventory of every repository. Keep these surfaces distinct:

Surface Deciding evidence and remediation owner
Current files and hosted publication text Read the named published files, PR title/body or other affected text. Ordinary corrections close only these current values; use github-ops for hosted edits.
Git objects and refs Bind file blobs, commit messages and the affected branch/tag history to immutable objects. This Skill owns an explicitly authorized rewrite and exact-ref readback. A clean tip does not prove clean ancestry or removal of an old object.
PR body edit history Inspect revisions of the named PR even when its current body is corrected. Use github-ops's PR body edit-history cleanup in its Pull Request Operations reference; it owns exact revision selection, private backup, deletion authorization and preservation readback.
Cached views, PR Git references, forks and clones Check the known locators and ownership separately. Git rewrite or branch deletion does not establish erasure here; third-party copies and GitHub-controlled references may require a separate route.

Distinguish an object retained in a private backup from one still publicly obtainable. When claiming anonymous access, test the exact locator without authentication and compare the returned content with the intended immutable object; an authenticated read, error page or redirect alone does not prove anonymous exposure or removal. Include releases, attachments or logs only when the finding points to them, and leave uninspected surfaces unverified.

For each named surface, report what w

Полный SKILL.md на GitHub

Установить github-sensitive-data-cleanup в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

evals/evals.jsonreferences/ai_semantic_review_prompt.mdreferences/incident-lessons.mdreferences/tooling_notes.mdscripts/rewrite_history.pyscripts/safe_push.pyscripts/scan_repo.pyscripts/verify_cleanup.py

FAQ

Что делает скилл github-sensitive-data-cleanup?

Scans and removes sensitive data (secrets, API keys, private domains/IPs, PII) from GitHub repository history, then verifies and force-pushes safely. Use for 清理敏感数据 / 历史重写 / 泄露, "scan sensitive data", "clean git history", "remove secrets from repo", or before any force push to a public repo. Not for local-only Git recovery (use git-safety-net) or ordinary repository setup (use auto-repo-setup).

Как установить скилл github-sensitive-data-cleanup?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл github-sensitive-data-cleanup запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить github-sensitive-data-cleanup с