# CloneGuard: 받은 저장소를 열기 전에 검사하기
# CloneGuard: checking a repository before you open it

- Site: https://select1.dev/2026-11-08 (English), https://select1.dev/ko/2026-11-08 (Korean)
- Entry: 029
- Published: 2026-11-08 (KST). Launch date: 2026-11-07
- Pick: CloneGuard <https://github.com/tharun208/cloneguard> (source: Show HN)
- Verified: ran
- What: CloneGuard 는 남에게 받은 저장소가 위험한지 실행하기 전에 확인하는 프로덕트다. 저장소의 파일을 읽기만 하고, 자격 증명을 노리는 코드와 자동으로 실행되는 설정을 찾는다.
- What (en): 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.
- Why: 오늘의 픽으로 선정한 이유는 남에게 받은 저장소를 믿기 전에 위험한 코드를 볼 수 있기 때문이다.
- Why (en): It is today’s pick because you see the risky code before you trust a stranger’s repository.
- Verdict: 작동한다. 시험한 수법 11개 가운데 7개에 경고를 출력했다.
- Verdict (en): It works. It warned on 7 of the 11 tricks I tested.
- Tags: security, scanner, supply-chain, go, cli

## Checked against the README

- [pass] 파일을 읽기만 하고 검사하는 프로젝트의 코드를 실행하거나 설치하지 않는다(It only reads files. It never runs, installs, or imports anything from the project it scans) — 소스에서 외부 명령을 실행하는 곳은 clone 명령의 git clone 하나(cmd/cloneguard/main.go 114행)뿐이다. scan 명령에는 없다
- [pass] 데모 폴더를 검사하면 심각 등급 경고 1개, 높음 2개, 중간 1개와 함께 DANGEROUS 를 출력한다(README 의 Example) — cloneguard scan --no-color demo 의 출력이 README 와 같았고, 종료 코드는 3 이었다
- [fail] 클라우드와 도구의 자격 증명에 접근하는 코드를 찾는다(Touches cloud or tool credentials) — path.join(os.homedir(), ".aws", "credentials") 로 경로를 만들어 읽는 JavaScript 파일과, os.path.join 으로 같은 경로를 만드는 Python 파일을 검사하자 둘 다 경고 없이 NO RED FLAGS FOUND 가 출력됐다

## Measured

- 정상 저장소의 검사 시간과 경고 수(이 사이트의 저장소, 4코어 가상 머신): 기본 2.0초(파일 192개, 중간 등급 경고 2개), --include-deps 157초(경고 193개, SUSPICIOUS) (cloneguard scan --json 으로 검사하고 경과 시간을 측정했다)

## Progress (days after launch; full history https://select1.dev/2026-11-08/progress)

- day 3 (checked 2026-11-10) [active] commits since launch 3, stars 30, releases 3, contributors 1, last commit 2026-11-08
  - Cloud credential paths built from separate strings, such as with `path.join`, are now flagged as suspicious. Entry 029 reported this gap (v0.1.2).
  - It detects code that steals credentials over raw sockets (v0.1.1).
- day 7 (checked 2026-11-14) [quiet] commits since launch 3, stars 33, releases 3, contributors 1, last commit 2026-11-08
- day 15 (checked 2026-11-22) [quiet] commits since launch 3, stars 33, releases 3, contributors 1, last commit 2026-11-08

## 한국어

## 무엇이 문제인가

가짜 채용 담당자가 과제나 데모 앱이라며 악성 저장소를 보내기도 한다. README 에 따르면 이런 저장소는 `npm install` 을 실행하거나 편집기로 폴더를 열기만 해도 SSH 키, 클라우드 자격 증명, 브라우저 비밀번호를 훔친다. 악성 코드는 설치할 때 실행되는 스크립트나 폴더를 열면 실행되는 편집기 작업에 들어 있다.

Microsoft 의 VS Code 는 폴더를 처음 열 때 작성자를 신뢰하는지 묻는다. VS Code 문서에 따르면 신뢰하지 않은 폴더는 제한 모드로 열린다. 제한 모드에서는 AI 에이전트, 터미널, 작업, 디버깅, 확장 기능이 비활성화되거나 일부만 작동한다. 다만 사용자가 작성자를 신뢰한다고 선택하면 이 제한은 풀린다. VS Code 는 신뢰해도 되는지 판단할 근거를 보여 주지 않는다.

## 어떻게 해결했나

CloneGuard 는 2026년 11월 7일 Hacker News 에 Show HN 글로 올라왔다. 제작자 Tharun Rajendran 은 가짜 채용 담당자에게서 데모 앱을 받았다고 밝혔다. 그 앱이 SSH 키와 AWS 키를 훔치려 한 뒤에 CloneGuard 를 만들었다고 한다.

CloneGuard 는 Go 로 만든 CLI 다. 저장소의 파일을 읽어 정규식 규칙과 대조한다. 자격 증명 파일의 경로와, IP 주소나 웹훅, Pastebin 같은 곳으로 데이터를 보내는 코드를 찾는다. 폴더를 열면 실행되는 편집기 작업과 package.json 의 설치 스크립트도 찾는다. 한 파일에 자격 증명 경로와 의심스러운 주소가 함께 있으면 경고를 가장 높은 등급으로 올린다. 검사 결과는 NO RED FLAGS FOUND, CAUTION, SUSPICIOUS, DANGEROUS 네 단계로 출력하고, 단계에 따라 종료 코드 0~3 을 반환한다.

## 무엇이 다른가

첫째, 신뢰를 판단할 근거가 다르다. VS Code 는 사용자에게 신뢰 여부만 묻는다. CloneGuard 는 사용자가 저장소의 코드를 실행하기 전에 파일을 읽고, 위험한 코드를 파일 이름, 라인 번호, 설명과 함께 보여 준다. 사용자는 그 코드를 보고 신뢰 여부를 결정할 수 있다. 트레이드오프는 여러 조각으로 나눠 적은 경로나 주소를 놓칠 수 있다는 점이다. CloneGuard 는 코드를 실행하지 않고, 적힌 글자를 줄마다 정규식과 대조하기 때문이다. README 도 패턴으로 찾는 도구라서 작정한 공격자는 피해 갈 수 있다고 밝힌다.

둘째, 검사하는 범위가 다르다. VS Code 의 제한 모드는 VS Code 안의 기능만 막는다. VS Code 밖의 터미널에서 실행한 `npm install` 은 막지 못한다. CloneGuard 는 package.json 의 설치 스크립트, Python 의 setup.py, `.vscode` 의 설정 파일까지 읽는다. 트레이드오프는 의존성 패키지를 검사하면 시간이 오래 걸리고 정상 패키지에서도 경고가 많이 나온다는 점이다. 기본 설정에서는 node_modules 를 건너뛴다. 포함하려면 `--include-deps` 를 붙인다.

## 어떻게 만들었나

- 저장소의 커밋 3개는 모두 2026년 11월 3일에 작성됐다. Co-authored-by 트레일러가 있는 커밋은 없다.
- 정규식 규칙은 19개다. 정규식 규칙과 별도로 특정 파일의 설정을 읽는 검사가 6개 있다. 이 검사는 package.json 의 scripts 와 `.vscode` 의 작업 설정, setup.py 를 읽는다.
- 저장소의 데모 폴더에는 폴더를 열면 실행되는 편집기 작업과 자격 증명 탈취를 흉내 낸 코드가 들어 있다.

## 실행해 보니

Go 1.24.7 로 CloneGuard 를 빌드하고, 저장소의 데모 폴더와 직접 만든 시험용 폴더 12개, 이 사이트의 저장소를 검사했다. 시험용 폴더 12개 가운데 11개에는 악성 저장소의 수법을 하나씩 흉내 낸 코드를 넣었다. 나머지 1개에는 정상 설정인 husky 의 prepare 스크립트만 넣었다. 넣은 코드는 실행해도 해가 없게 만들었고, 주소에는 예시용 도메인과 IP 를 사용했다.

1. 빌드와 테스트. `go build` 는 6.6초, `go test ./...` 는 2.4초 만에 끝났다. 실행 파일은 3.9 MB 다.
2. 데모. `cloneguard scan demo` 는 README 의 예시처럼 심각 등급 경고 1개, 높음 2개, 중간 1개와 DANGEROUS 판정을 출력했다. 종료 코드는 3 이었다.
3. 흔한 수법. CloneGuard 는 다음 수법 6개에 모두 경고를 출력했다. 설치할 때 실행되는 스크립트, 내려받은 스크립트를 셸로 실행하는 설치 명령, setup.py 의 설치 코드, 환경 변수 전체를 보내는 코드, 편집기 작업을 자동으로 실행하게 하는 설정, `path.join` 으로 만든 SSH 키 경로다. base64 로 숨긴 코드를 `eval` 로 실행하는 코드에도 경고를 출력했다. 등급은 중간이었다.
4. 놓친 것. `path.join(os.homedir(), '.aws', 'credentials')` 로 AWS 자격 증명을 읽는 JavaScript 파일은 경고가 없었다. `os.path.join` 으로 같은 경로를 만든 Python 파일도 같았다. SSH 규칙은 `.ssh` 라는 문자열만 있어도 찾지만, AWS 자격 증명 규칙은 `.aws/credentials` 처럼 경로가 구분자까지 한 문자열로 적혀 있을 때만 찾는다. `.ssh` 까지 나눠서 이어 만든 SSH 경로와 숫자를 이어 만든 IP 주소도 찾지 못했다. 수법을 넣은 폴더 11개 가운데 7개에 경고가 나왔다. 정상 설정인 husky 의 prepare 스크립트에는 경고가 없었다.
5. 정상 저장소. 이 사이트의 저장소(파일 192개) 검사는 2.0초 만에 끝났다. 저장소의 데이터 파일에 있는 정상 URL 두 개(ngrok 주소와 IP 주소)에 중간 등급 경고가 출력됐다. `--include-deps` 로 node_modules 까지 검사하자 157초가 걸렸다. 경고는 193개로 늘었다. 늘어난 경고는 이 사이트가 의존하는 정상 패키지의 코드에서 나왔다. 판정은 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).
```

## 확인하지 못한 것

- 실제 악성 저장소. 공개된 악성 저장소 사례를 격리된 가상 머신에 클론해 검사해 보자.
- clone 명령. `cloneguard clone` 으로 클론과 검사를 한 번에 실행해 보자.

## 판정

작동한다. 시험한 수법 11개 가운데 7개에 경고를 출력했다. 다만 오늘 빌드한 커밋 7b98cc6 의 CloneGuard 는 `path.join` 으로 만든 AWS 자격 증명 경로를 찾지 못했다. 남에게 받은 과제나 데모 저장소를 열기 전에 확인하려는 경우에 써 볼 만하다.

## 얻어갈 것

- 정규식으로 파일 경로를 찾는 규칙을 만들면, 경로를 여러 조각으로 나눠 적은 코드로도 시험해 보자. `path.join(os.homedir(), '.aws', 'credentials')` 로 만든 경로는 코드에 `.aws/credentials` 라는 한 문자열로 나타나지 않는다. CloneGuard 는 같은 `path.join` 으로 만든 경로라도 SSH 경로는 찾았지만 AWS 경로는 찾지 못했다.
- 검사 결과에 경고가 없어도 안전하다는 뜻으로 읽지 말자. CloneGuard 도 경고가 없으면 이 결과가 안전을 보장하지 않는다는 안내를 출력한다. 낯선 저장소는 일회용 가상 머신에서 실행하라는 권고도 함께 출력한다.

### 용어

- husky: npm 프로젝트에 Git 훅을 설정하는 도구다. 보통 npm install 때 실행되는 package.json 의 prepare 스크립트로 훅을 등록한다.
- ngrok: 로컬 컴퓨터에서 실행 중인 서버를 인터넷에서 접속할 수 있는 공개 주소로 연결해 주는 서비스다.

## English

## 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, `.vscode` task 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 husky prepare script. The code in them is harmless even if run, and it uses example domains and example IP addresses.

1. Build and tests. `go build` took 6.6 seconds, and `go test ./...` passed in 2.4 seconds. The binary is 3.9 MB.
2. Demo. `cloneguard scan demo` printed DANGEROUS with 1 critical, 2 high and 1 medium finding, as in the README. The exit code was 3.
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 with `eval` also got a warning, at medium severity.
4. 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 with `os.path.join` got no warning either. The SSH rule needs only the string `.ssh` to 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 `.ssh` was 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.
5. 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 ngrok 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 clone` to 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 same `path.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.

### Terms

- husky: A 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.
- ngrok: A service that gives a server running on your own computer a public address that anyone on the internet can reach.

## Launches the same day

- Prediction markets vs the midterms <https://app.artifactbin.dev/@vivek/AQTt2H-did-prediction-markets-predict-the-midterms> (Show HN, 34): 예측 시장 분석. 이번 중간선거의 결과를 예측 시장이 얼마나 맞혔는지 분석한다.
- CloneGuard <https://github.com/tharun208/cloneguard> (Show HN, 31): 저장소 검사 도구. 실행하기 전에 자격 증명을 노리는 코드와 자동 실행 설정을 찾는다.
- ldraw-mecha <https://github.com/anteloc/ldraw-mecha/tree/v0.5.0> (Show HN, 30): LEGO 기계 장치 애니메이션. 에이전트가 설계 파일에서 장치의 움직임을 추론해 애니메이션으로 만든다.
- Backwords <https://backwords.greg.technology/> (Show HN, 12): 거꾸로 말하기 연습 앱. AI 가 단어를 거꾸로 발음하는 법을 가르친다.
- AegisKernel <https://adikshatriyag-crypto.github.io/aegis-kernel/> (Show HN, 12): AI 에이전트용 POSIX 런타임. 모든 호출을 검사하면서도 0.016 ms 미만으로 동작한다고 소개한다.
- ocarina-recomp <https://github.com/sostenesfreitas/ocarina-recomp> (GitHub, 696): Ocarina of Time 재컴파일 프로젝트. 사용자가 가진 게임 파일로 에뮬레이터 없이 Windows 에서 실행한다고 소개한다.
- sandbox-mcp <https://github.com/shanselman/sandbox-mcp> (GitHub, 237): Windows 테스트 환경 MCP 서버. 앱을 시험할 일회용 Windows 머신을 자동으로 만든다.
- ChatGPT Images 2.6 <https://www.producthunt.com/products/openai> (Product Hunt, 201): OpenAI 의 이미지 기능 업데이트. 이미지를 생성, 편집하고 애니메이션으로 만든다.
- Exa Monitors v2 <https://www.producthunt.com/products/exa-ai> (Product Hunt, 175): 예약 웹 검색 서비스. 지정한 시간에 검색하고 그 결과로 에이전트를 호출한다고 소개한다.
- LiveReview <https://www.producthunt.com/products/livereview> (Product Hunt, 174): 코드 리뷰 도구. 위험이 낮은 변경은 자동으로 승인한다고 소개한다.

## Getting started

- Steps: go build -o cloneguard ./cmd/cloneguard ; cloneguard scan ./some-folder
- Needs: Go 1.24 이상. 외부 라이브러리와 계정은 필요 없다.
- Cost: MIT, 무료.
- Note: 기본 설정에서는 node_modules 를 검사하지 않는다. 검사하려면 --include-deps 를 붙인다.
