I Cloned a Repo and It Ran Code Before I Read a Single Line
03:03 in the morning, and a file appeared on my machine that I never asked for. I had typed exactly one command: npm install . The repo was my own sandbox, built five minutes earlier, and its package.json carried a single preinstall script that wrote a marker file with a timestamp. One second later marker-npm.txt sat in the folder, stamped 2026-11-11T21:03:01.183Z . I had not read a line of the…
The reporter conducted an experiment to determine how many ways a cloned repository could run code on a machine before the user even read a single line of code. They built a sandbox repository with five execution surfaces, each of which wrote a timestamped text file if it executed, leaving no other trace. The five surfaces were:
1. The npm preinstall script, which ran automatically and created a marker-npm.txt file.
2. The Python setup.py script, which executed during the package build and created a marker-pip.txt file.
3. The Makefile default target, which ran when the user typed "make" and created a marker-make.txt file.
4. A Git post-checkout hook, which would have created a marker-hook.txt file, but the hook was missing.
5. A README.md file containing instructions for the user to create a marker file called pwned.txt.
The sandbox environment used Node.js v24.22.1, npm 10.9.4, Python 3.12.3, pip 24.0, GNU Make 4.3, git 2.43.0. The experiment revealed that out of the five surfaces, two (npm preinstall and Python setup.py) fired on install alone, one (Makefile default target) fired when the user typed the command, and two (Git hook and README) never fired at all.
These results emphasize the importance of understanding the execution surfaces within a cloned repository. While none of the surfaces performed destructive actions in this experiment, the potential for supply-chain attacks remains a concern, especially with install scripts that run with the same privileges as the user. The experiment highlights the need for caution when interacting with repositories and the importance of reading code before execution, especially when using automated tools like AI agents.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.