260424 — Hermes/OpenClaw git secret safeguards
결론
- Hermes pre-commit secret hook 설치 완료.
- OpenClaw pre-commit secret hook 설치 완료.
.git/hooks직접 쓰기는 EPERM이라.githooks/pre-commit+git config core.hooksPath .githooks방식으로 설치했다. - Hermes git history: high-confidence secret hit
0. - OpenClaw git history: high-confidence secret hit 있음. 값은 출력하지 않았고 경로/패턴/커밋 수만 기록. 즉시 토큰 폐기/재발급 + history rewrite 검토 필요.
1) 설치된 hook
Hermes
- repo:
/Users/ron/.hermes/workspace - hook:
/Users/ron/.hermes/workspace/.git/hooks/pre-commit - self-test: PASS
- live staged scan: PASS
HERMES_HOOK=installed
secret pre-commit selftest ok
hermes hook live rc=0
OpenClaw
- repo:
/Users/ron/.openclaw - hook path:
/Users/ron/.openclaw/.githooks/pre-commit - git config:
core.hooksPath=.githooks - self-test: PASS
- live staged scan: PASS
OPENCLAW_HOOKSPATH=.githooks
OPENCLAW_HOOK=installed
secret pre-commit selftest ok
openclaw hook live rc=0
OpenClaw 최신 commit:
eee3f07 fix(oil): prefer Hermes indicator data in ron-pipeline MCP
2) hook 차단 패턴
커밋 직전 staged 파일에서 아래 high-confidence 패턴을 차단한다.
- Telegram bot token
sk-*,sk-proj-*ghp_*,gho_*,ghu_*,ghs_*,ghr_*,github_pat_*AKIA*AAGC*,AABC*Bearer <long-token>- private key block
- literal
token/secret/password/api_key/access_key = <long-value>
hook은 secret 값을 출력하지 않고, 패턴명 + 파일 + 라인 + redacted snippet만 출력한다.
3) history scan 결과
검사 스크립트:
- /tmp/git_history_secret_scan.py
검사 로그:
- /tmp/history_secret_scan_workspace_20260424_145755.txt
- /tmp/history_secret_scan_.openclaw_20260424_145808.txt
- /tmp/openclaw_head_secret_scan_*.txt
- /tmp/hermes_head_secret_scan_*.txt
Hermes history
commits_scanned 1
hit_records 0
unique_pattern_paths 0
HEAD hit paths 0
OpenClaw history
commits_scanned 24
hit_records 202
unique_pattern_paths 12
HEAD hit paths 10
OpenClaw unique pattern/path summary:
| pattern | path | affected commits |
|---|---|---|
| github_token | agents/codex/agent/auth-profiles.json |
2 |
| github_token | agents/cowork/agent/auth-profiles.json |
24 |
| github_token | agents/data-analyst/agent/auth-profiles.json |
24 |
| github_token | agents/drift-recovery/agent/auth-profiles.json |
22 |
| github_token | agents/evidence-sentinel/agent/auth-profiles.json |
22 |
| github_token | agents/guardian/agent/auth-profiles.json |
2 |
| github_token | agents/main/agent/auth-profiles.json |
22 |
| github_token | agents/ops-syncer/agent/auth-profiles.json |
22 |
| github_token | agents/ron/agent/auth-profiles.json |
24 |
| github_token | agents/test/agent/auth-profiles.json |
22 |
| telegram_bot_token | cron/jobs.json |
4 |
| telegram_bot_token | scripts/gmail_credit_monitor.py |
12 |
OpenClaw HEAD 현재 hit path:
| pattern | path |
|---|---|
| github_token | agents/cowork/agent/auth-profiles.json |
| github_token | agents/data-analyst/agent/auth-profiles.json |
| github_token | agents/drift-recovery/agent/auth-profiles.json |
| github_token | agents/evidence-sentinel/agent/auth-profiles.json |
| github_token | agents/main/agent/auth-profiles.json |
| github_token | agents/ops-syncer/agent/auth-profiles.json |
| github_token | agents/ron/agent/auth-profiles.json |
| github_token | agents/test/agent/auth-profiles.json |
| telegram_bot_token | cron/jobs.json |
| telegram_bot_token | scripts/gmail_credit_monitor.py |
4) 권고
OpenClaw는 hook만으로는 과거 노출을 지울 수 없다. 다음 순서 권고:
- 노출된 GitHub/Copilot PAT 및 Telegram bot token 즉시 폐기/재발급.
- 현재 HEAD에서 secret literal을
.env/secrets//런타임 로더로 분리. - BFG 또는
git filter-repo로 history rewrite. - 원격 저장소가 있다면 rewrite 후 force push는 해리 승인 후에만 수행.
- 이후 모든 commit은 설치된 pre-commit hook을 통과해야 함.
5) CLAUDE.md 보강
수정 파일:
- /Users/ron/.claude/CLAUDE.md
백업:
- /Users/ron/.claude/CLAUDE.md.bak-git-secret-20260424_145828
추가한 룰 요지:
git add/git commit 전 secret scan 필수.
Hermes/OpenClaw repo는 pre-commit secret hook으로 commit 직전 자동 차단.
과거 commit 노출 발견 시 토큰 폐기/재발급 + BFG/git-filter-repo 검토.
6) 자체평가
- 정확성: 4.6/5 — 양쪽 hook 설치, self-test, live staged scan, history scan 완료.
- 완성도: 4.4/5 — OpenClaw 과거 노출은 제거가 아니라 탐지/권고 단계. 토큰 폐기와 history rewrite는 별도 승인 필요.
- 검증: 4.7/5 — hook 실행, self-test,
git log -1, HEAD/history scan 확인. - 최소 변경: 4.5/5 — hook 설치와 CLAUDE.md 보강만 수행, OpenClaw history rewrite/secret 파일 수정은 하지 않음.
종합: 4.55/5
DONE