Sun 2026.11.08
CloneGuard: checking a repository before you open it
Today's pick: CloneGuard
CloneGuard is a product that checks whether a repository someone sent you is dangerous before you run it. It only reads the files, and it looks for code that targets credentials and for settings that run code on their own.
It is today’s pick because you see the risky code before you trust a stranger’s repository.
- Found on
- Show HN
- Built with
- Go
The problem
In one kind of attack, a fake recruiter sends a malicious repository as a take-home assignment or demo app. According to the README, such a repository can steal SSH keys, cloud credentials and browser passwords as soon as you run npm install or open the folder in your editor. The malicious code sits in an install script or in an editor task that runs when the folder opens.
Microsoft’s VS Code asks whether you trust the authors when you first open a folder. According to the VS Code docs, an untrusted folder opens in Restricted Mode. Restricted Mode disables or limits AI agents, the terminal, tasks, debugging and extensions. But once you choose to trust the authors, VS Code lifts the limits. VS Code shows nothing that helps you decide whether to trust the folder.
How it solves it
CloneGuard was posted on Hacker News as a Show HN on November 7, 2026. The maker, Tharun Rajendran, says a fake recruiter sent over a demo app that tried to steal SSH and AWS keys. Rajendran built CloneGuard after that.
CloneGuard is a command-line tool written in Go. It reads the repository’s files and checks them against regular expression rules. It looks for paths to credential files, and for code that sends data to an IP address, a webhook or a paste site. It also looks for editor tasks that run when the folder opens and for install scripts in package.json. If one file has both a credential path and a suspicious address, it gives the finding the highest severity. It reports one of four verdicts: NO RED FLAGS FOUND, CAUTION, SUSPICIOUS or DANGEROUS. Each verdict has its own exit code, from 0 to 3.
What is different
The first difference is the evidence for the trust decision. VS Code only asks whether you trust the folder. CloneGuard reads the files before anything runs. It shows the risky code with the file name, line number and an explanation. You can look at that code and then decide whether to trust the folder. The tradeoff is that it can miss a path or address that the code splits into pieces. CloneGuard does not run the code. It only checks the text of each line against regular expressions. The README also says that a determined attacker can evade it, because it is pattern-based.
The second difference is what gets checked. VS Code’s Restricted Mode limits only features inside VS Code. It cannot stop an npm install that you run in a terminal outside VS Code. CloneGuard also reads install scripts in package.json, Python’s setup.py and the settings files in .vscode. The tradeoff is that scanning dependency packages takes a long time and raises many warnings on normal packages. By default it skips node_modules. Add --include-deps to include them.
How it was built
- The repository has 3 commits, all made on November 3, 2026. No commit has a Co-authored-by trailer.
- It has 19 regular expression rules. Apart from the rules, it has 6 per-file checks. They read package.json scripts,
.vscodetask settings and setup.py. - The repository’s demo folder holds code that imitates credential theft and an editor task that runs when the folder opens.
Running it
I built CloneGuard with Go 1.24.7. Then I scanned the repository’s demo folder, 12 test folders I made and this site’s repository. 11 of the 12 test folders each hold one trick used by malicious repositories. The other holds only a normal huskyA tool that sets up Git hooks in an npm project. It usually installs the hooks through the prepare script in package.json, which runs during npm install. prepare script. The code in them is harmless even if run, and it uses example domains and example IP addresses.
- Build and tests.
go buildtook 6.6 seconds, andgo test ./...passed in 2.4 seconds. The binary is 3.9 MB. - Demo.
cloneguard scan demoprinted DANGEROUS with 1 critical, 2 high and 1 medium finding, as in the README. The exit code was 3. - Common tricks. It warned on an install script, a setup.py install step and an install command that pipes a download into a shell. It also warned on code that sends all environment variables and on a setting that lets editor tasks run automatically. It caught an SSH key path built with
path.join. Code that runs base64-encoded text withevalalso got a warning, at medium severity. - Misses. A JavaScript file that reads AWS credentials through
path.join(os.homedir(), '.aws', 'credentials')got no warning. A Python file that builds the same path withos.path.joingot no warning either. The SSH rule needs only the string.sshto match. The AWS rule matches only when the path is written as one string with the separator, like.aws/credentials. CloneGuard also missed an SSH path in which even.sshwas split into pieces, and it missed an IP address built by joining numbers. 7 of the 11 trick folders got a warning. The husky prepare script got none. - A normal repository. Scanning this site’s repository (192 files) took 2.0 seconds. It raised medium-severity warnings on two normal URLs in the repository’s data files. One is an ngrokA service that gives a server running on your own computer a public address that anyone on the internet can reach. address, and the other is an IP address. With
--include-deps, which adds node_modules, the scan took 157 seconds. The warnings rose to 193, and the new ones came from normal packages that this site depends on. CloneGuard rated the repository SUSPICIOUS.
$ cloneguard scan --no-color s10-homedir-path
cloneguard: scanned 1 files in s10-homedir-path
NO RED FLAGS FOUND That does not prove it is safe.
What to do:
It only means none of the common tricks were spotted. If a stranger asked you
to run this, still use a throwaway virtual machine.
0 files skipped (docs, binaries, lockfiles, node_modules, .git, very large files).
Not checked
- A real malicious repository. Clone a published malicious repository into an isolated virtual machine and scan it.
- The clone command. Run
cloneguard cloneto clone and scan in one step.
Verdict
It works. It warned on 7 of the 11 tricks I tested. But the version I ran, commit 7b98cc6, missed an AWS credentials path built with path.join. It is worth trying if you want to check a take-home or demo repository before you open it.
What to take away
- If you write rules that find file paths with regular expressions, also test them on code that splits a path into pieces. A path built with
path.join(os.homedir(), '.aws', 'credentials')never appears in the code as the single string.aws/credentials. With the samepath.join, CloneGuard caught the SSH path but not the AWS path. - Do not treat a scan with no warnings as proof of safety. When CloneGuard finds nothing, it says that a clean scan does not prove the project is safe. It also tells you to run a stranger’s repository in a throwaway virtual machine.
Getting started
go build -o cloneguard ./cmd/cloneguardcloneguard scan ./some-folder
- You need
- Go 1.24 or later. No external libraries or accounts are needed.
- Cost
- Free under the MIT license.
By default it skips node_modules. Add --include-deps to scan it.
Steps select 1 ran.
Progress
- Day 3Active
- Day 7Quiet
- Day 15Quiet
- Day 30Upcoming
- Day 90Upcoming
- Day 180Upcoming
- Day 365Upcoming
Latest check Day 15, Sun 2026.11.22
- Commits since launch
- 0 → 3
- Stars
- 23 → 33
- Latest release
- v0.1.2
- Last commit
- 2026.11.08
No commits in this period.