ylove/git-bouncer
Sobre
Don't just git clone. A door check for repos you didn't write: ID check, sandboxed pat-down, then a verdict before anything touches your machine.
Segurança e privacidadeCrescimento medido de estrelas
- em 24 h
- +2
- em 7 dias
- Coletando histórico
- em 15 dias
- Coletando histórico
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
Originalgit-bouncer
Don't just git clone. Let the bouncer check it first.
Malicious repositories are now a routine way to attack developers: poisoned "starter kits", fake take-home tests from fake recruiters, and look-alike accounts like micr0s0ft. Open one in your editor, or run npm install on your everyday laptop, and it can take your SSH keys and GitHub tokens, then push malware into your repos.
git-bouncer is a door check for code you didn't write.
npm install -g git-bouncer
bouncer clone <url> # instead of: git clone <url>
git bouncer <url> # the same thing, as a git subcommand

What it does
- ID check, on your machine, before anything downloads. Who published this repo, and are they who they look like? Look-alike owners (
micr0s0ft,vercell), impersonated famous projects, accounts that changed hands, brand-new accounts, and repos named in public malware reporting. - Pat-down, in a throwaway container with none of your credentials: no capabilities, read-only filesystem, nothing from your machine mounted. The repo is cloned there and checked for the techniques real campaigns use. None of its code is run.
- Verdict. Clean: it asks before cloning to your machine, fetching only the exact commit it checked (a one-commit copy, with no history), verifies the files on disk, and installs npm dependencies from the verified lockfile with install scripts off (git-bouncer never runs install scripts for you). Not clean: it tells you what it found, in plain language, and deletes the sandbox.

What the pat-down looks for
- Runs when you open the folder: VS Code tasks set to
folderOpen, workspace settings that start programs, dev container commands that run on your host, AI-agent hooks and MCP servers. - Build systems it can't see into: Rust, Gradle, Maven, Python packaging, CMake, Ruby, PHP, Swift and about twenty more run a project's own code when an IDE opens the folder or when you install its dependencies. git-bouncer doesn't model what they run, so such a repo is never "let in": the result is build it in a sandbox. The same goes for every .NET repo.
- Runs when you install (npm, yarn, pnpm, bun): every install script npm would run (including
binding.gypbuilds and workspace scripts), plus.npmrc,.yarnrcand.pnpmfile.cjstricks that work even with--ignore-scripts. - Poisoned dependencies: known-malicious packages (OSV), checksum mismatches against the lockfile, invalid registry signatures, typosquats, packages from outside the registry.
- .NET repos: MSBuild hooks in the project (
<Exec>, inline C# tasks, restore hooks, analyzer DLLs),nuget.configfeeds and credential tricks, custom MSBuild SDKs, and the build files, PowerShell scripts and analyzers inside every NuGet package the project would restore, downloaded from nuget.org and read as data. MSBuild runs package build files ondotnet buildand as soon as Visual Studio, Rider or C# Dev Kit opens the project, which is how the fake .NET take-home campaign got in. It also reads .NET 10 file-based apps (a loneapp.cswith#:packagelines). git-bouncer never restores or builds .NET projects for you, and never calls a .NET build safe: a .NET repo with no red flags is "build it in a sandbox", not a pass. - Hidden code: payloads pushed off-screen with whitespace, decode-then-execute, fake font files that are JavaScript, blockchain command-and-control, invisible Unicode and Trojan Source.
- Git tricks: symlinks out of the repo,
.gitlook-alike paths, case collisions, odd submodules. The clone itself happens inside the sandbox, because malicious repos have attackedgit cloneitself.
Every check, with its severity and a plain-language explanation: docs/checks.md. The ID check: docs/id-check.md.
No Docker?
- Podman works with the same command: free, open source, no account. If you have neither, git-bouncer offers to install Podman (or Docker Desktop), one yes per step.
- Your own cloud:
--runtime gcp(Cloud Build) or--runtime aws(CodeBuild), with--dry-runto see exactly what it would run. These cost money and aren't live-tested by the maintainer; see docs/cloud.md for setup and what to check. Issues and PRs for other providers are welcome. - GitHub Codespaces: if
ghis signed in (with thecodespacescope:gh auth refresh -h github.com -s codespace), git-bouncer offers to run the check in a throwaway Codespace instead, or use--runtime codespace. It uses your account's Codespaces allowance and asks first; the Codespace is created from git-bouncer's own pinned config, never from the repo being checked, and deleted afterwards. See docs/codespaces.md.
More ways to use it
bouncer scan <url> |
Check only; never touches your disk. Exit code 0 let in, 1 turned away, 3 warning, 2 incomplete/error (a .NET repo, or one with a build system git-bouncer doesn't model, is never 0: see checks). Good for scripts. |
bouncer clone <url> --ref v1.2.3 |
Check a branch, tag or exact commit. |
bouncer scan <url> --json |
Machine-readable result (fields). Never asks, never installs. |
bouncer doctor |
Which sandbox runtimes and extras it can use here. |
bouncer shell-init |
Opt in to git clone <url> --bouncer (details). |
If you already use Snyk, git-bouncer offers to run it on copies of the dependency manifests. Your Snyk token stays on your machine and never enters the sandbox.
What it can't do
A clean result means no known red flags, not "safe". Static checks can be evaded, brand-new malware isn't in the databases yet, and nothing is run, so behavior that only shows up at runtime isn't seen. "Let in" covers cloning, opening the folder and installing npm dependencies; running or building the project still runs its code (make, npm run, a shell script, a Dockerfile), and plain-language instructions to an AI agent are not judged. git-bouncer shrinks the blast radius of your first contact with an unfamiliar repo. It doesn't replace your judgment. The full list is in THREAT_MODEL.md.
Built in public
Every change landed through a pull request, and every pull request was attacked by an adversarial reviewer before it merged. Their findings, the fixes and the arguments are all on GitHub, and every finding became a regression test. If you're learning how a security tool gets built, read the issues and then the pull requests in order. #14, #15 and #16 are good starting points.
- How it's put together: docs/DESIGN.md
- Contributing (new detections especially welcome): CONTRIBUTING.md
- Found a vulnerability in git-bouncer itself? Please report it privately: SECURITY.md
- Releases are staged from CI with npm provenance and only go public after the maintainer approves them with 2FA: RELEASING.md
Licensed under Apache-2.0.
Explore projetos relacionados
Carregando…