Show HN: CloneGuard – Scan a repo for credential-stealing tricks before it runs ...
Show HN @show
Show HN: CloneGuard – Scan a repo for credential-stealing tricks before it runs github.com · 24 points · 6 comments · HN thread
TL;DR CloneGuard is a small, dependency-free Go command-line tool that statically scans a repository for common malware tricks (credential theft, suspicious network calls, download-and-run, auto-run hooks, obfuscation) before the user runs it. It only reads files and never executes project code, and it returns exit codes 0 to 3 for clean, caution, suspicious and dangerous verdicts. The author built it after a fake recruiter 'take-home' project tried to steal SSH and AWS keys.
- Read-only: it walks the folder and applies regex rules and per-file checks without running, installing or importing anything from the project.
- Targets the usual lures: install scripts in package.json, .vscode/tasks.json tasks that run on folder open, and setup.py.
- Flags secret access (SSH keys, cloud credentials, browser data, wallets), raw-IP and webhook/paste/tunnel destinations, eval or curl-pipe-to-shell patterns, and obfuscation.
- A file that both reads secrets and talks to a suspicious server is escalated to critical.
- Verdicts map to exit codes 0 (clean) to 3 (dangerous), so it can be used in scripts or git hooks; 'clone' runs git clone and then scans.
- The README states that a clean result is not proof of safety, since the tool is pattern-based and can produce false positives.
Discussion The thread is short, with the author's detailed comment at the top and a few replies. Commenters are mostly skeptical. One is surprised that auto-run tasks and install hooks are a real attack vector, and another compares the tool to autorun.inf. Several argue that a regex scanner is weak against determined malware, and suggest either using an AI model to review code or running untrusted code in isolated VMs. One moderator reply pushed back on a dismissive comment. The mood is wary, with some hostility toward the hiring practice of having candidates run unknown code.
- Regex scanning is too weak; attackers will evade it (many): Commenters argue that pattern matching is easy to get around, so the tool gives false comfort. They say that a determined attacker will change the wording of payloads to avoid the rules.
- Use isolated VMs or containers instead of scanning (some): Some suggest that running untrusted code in sandboxes solves the problem more fully than any static check. They see scanning as a secondary layer at best.
- Ask an AI model to review the repo first (some): One commenter recommends asking a recent AI agent to look for hidden payloads, phone-home behavior or C2 paths before cloning. They concede that this is not guaranteed to work either.
- Do not run code from untrusted sources at all (a few): A commenter argues that the simplest defense is never to execute code you don't trust, and criticizes hiring processes that make candidates run unknown projects instead of discussing their work.
- Surprise that install hooks and editor tasks auto-run (a few): One commenter is incredulous that opening a folder can trigger code execution, expressing disbelief at this attack surface.