Claude Code 가드레일 오픈소스 지도
Claude Code의 가드레일은 보통 hooks, tool-call policy, 감사/로그, IP/라이선스 검증, sandboxing 조합으로 구현된다.
핵심 해석
- 전용 가드레일 제품은 아직 많지 않다.
- 생태계의 중심은
CLAUDE.md+ hooks + MCP + CI/CD + pre-commit/pre-push 조합이다. - 그래서 오픈소스들도 완전한 단일 제품보다, 특정 문제를 좁게 푸는 정책 레이어로 쪼개져 있다.
전체 오픈소스 가드레일 생태계 맵
Claude Code / Codex / Gemini CLI 등 코딩 에이전트에 직접 붙이거나 가드레일로 같이 쓸 수 있는 오픈소스 목록.
1) Claude Code 전용 / 직접 연동 가드레일
| 프로젝트 | 용도 | 핵심 기능 | 평가 |
|---|---|---|---|
| dwarvesf/claude-guardrails | Claude Code 전용 가드레일 | PreToolUse hook 기반 위험 명령 차단, 데이터 유출 패턴, 권한 상승 패턴, git commit secret scan | ⭐ 16 · 가장 직접적. 먼저 볼 만함 |
| mattpocock/skills — git-guardrails-claude-code | Claude Code용 Git 안전장치 | git push, reset —hard, clean, branch -D, restore . 차단 | ⭐ 75k · 가볍게 도입하기 좋음 |
| alexknowshtml/claude-code-safety-hooks | Claude Code safety hooks | 위험 명령 guard + untrusted content defense | ⭐ 3 · Claude Code 훅 기반 실전형 |
| rulebricks/claude-code-guardrails | Claude Code tool call 실시간 가드레일 | Rulebricks API 연동 정책 기반 실행 차단 | ⭐ 67 · 별도 정책 엔진 형태 |
| JustHereToHelp/claude-bouncer | Claude Code command filtering | 위험 명령 block, 애매한 명령 ask, 정상 명령 allow | ⭐ — · 단순 명령 필터링용 |
| algorismo-au/lanekeep | 정책/거버넌스/승인 피로 완화 | 로컬 실행 정책 기반 경계 설정, Claude Code hooks 연동 | ⭐ 17 · permission fatigue 완화 |
| marcusgoll/atlas-guardrails | 컨텍스트/중복/드리프트 제어 | Context Packing, Anti-Duplication, Drift Detection | ⭐ — · npm 패키지, Claude Code/Cursor 겸용 |
| mugdhav/claude-skill-ip-guard | IP/라이선스 컴플라이언스 | OSS 라이선스(GPL 등) 체크, 상용 프로젝트용 | ⭐ — · Anthropic skills PR #686 |
| OpSentry | Claude Code PreToolUse 보안 훅 | credential leak 방지, deterministic security enforcement | ⭐ — · repo 링크 확인 필요 |
| disler/claude-code-hooks-mastery | Claude Code hook 예제/학습 | hook flow, exit code, JSON output 패턴 | ⭐ 3k+ · 가드레일 자체보다는 hook 구현 레퍼런스 |
Claude Code는 공식적으로 Hooks를 제공하며, PreToolUse / PostToolUse / Stop 등 이벤트에 사용자 정의 shell command, HTTP endpoint, prompt hook을 붙일 수 있음. 공식 문서에서도 hooks를 “LLM 지시에 기대지 않고 결정론적으로 동작을 강제하는 방법”으로 설명. → 공식 문서
2) Codex 전용 / Codex 내장 가드레일
| 항목 | 용도 | 핵심 기능 | 평가 |
|---|---|---|---|
| openai/codex | Codex CLI 본체 | 로컬 코딩 에이전트, Rust 기반 오픈소스 | ⭐ 83.7k · Codex 자체가 오픈소스 |
| Codex sandbox / approvals | Codex 내장 보안 경계 | workspace-write, network off, approval policy | 기본 가드레일로 가장 중요 |
| Codex Rules | 명령 승인/차단 규칙 | command prefix 기준 allow / prompt / forbidden 정책 | Claude Code hook의 Codex식 대응책 |
| Codex Auto-review | 승인 자동화 | sandbox boundary 승인 요청을 별도 reviewer agent가 검토 | 팀/엔터프라이즈 워크플로우에 유용 |
| Codex config.toml | 로컬/프로젝트별 정책 설정 | approval policy, sandbox, MCP 설정 | 프로젝트 단위 정책화 가능 |
Codex는 sandbox + approval policy + rules 조합이 핵심. Codex Rules는 명령 패턴별로
forbidden > prompt > allow우선순위를 적용해 차단/승인을 설정 가능.
3) Claude Code / Codex / Gemini CLI 공통 명령 차단 도구
| 프로젝트 | 용도 | 핵심 기능 | 평가 |
|---|---|---|---|
| Dicklesworthstone/destructive_command_guard | 범용 destructive command guard | AI agent가 실행하는 위험한 git/shell 명령 차단 (Rust, SIMD) | ⭐ 1k · 별도 CLI/훅으로 붙이기 좋음 |
| OpenClaw Harness | Claude 기반 에이전트 보호/운영 | Claude Code, OpenClaw 계열 보호용 command guard | Claude Code 직접 연동 후보 |
| wiserautomation/suprawall-plugins | OpenClaw/Hermes 보안 skill suite | skill installer, file integrity, security audit, advisory verification | Claude Code보다는 OpenClaw/Hermes 쪽 |
이 계층은 Codex/Claude Code 내부 기능에 의존하지 않고, shell wrapper, hook, pre-exec guard 형태로 붙이는 방식이 적합.
4) 프롬프트 인젝션 / PII / Tool Call / RAG 보안용 범용 오픈소스
| 프로젝트 | 용도 | 핵심 기능 | Claude Code/Codex 적용성 |
|---|---|---|---|
| NVIDIA NeMo Guardrails | LLM app guardrails | 대화 흐름, 출력 제어, 정책 기반 rails (Colang) | CLI 에이전트보다는 앱/게이트웨이에 적합 |
| LlamaFirewall (PurpleLlama) | AI Agent 보안 가드레일 | prompt injection, jailbreak, agent misalignment 방어 | 에이전트 런타임 앞단에 붙일 수 있음 |
| vpdeva/blackwall-llm-shield-js | JS/Python LLM 보안 툴킷 | prompt injection, sensitive data leak, unsafe tool call, hostile RAG content 방어 | FE/Node/Python 기반 프록시로 붙이기 좋음 |
| wiserautomation/SupraWall | AI agent zero-trust guardrails | prompt injection, PII scrubbing, policy enforcement, Dify/MCP/LangChain/CrewAI 연동 | MCP/에이전트 플랫폼 쪽에 적합 |
| guardrails-ai/guardrails | LLM output validation | schema validation, output validation, re-ask | 보안보다는 출력 품질/검증 중심 |
| protectai/rebuff | prompt injection detector | prompt injection 탐지 | 업데이트 상태 확인 필요 |
| NVIDIA/garak | LLM red teaming | jailbreak/prompt injection 취약점 테스트 | 운영 가드레일보다는 평가/테스트용 |
| Azure/PyRIT | AI red teaming | Microsoft 계열 AI red team framework | 사전 점검/회귀 테스트용 |
| promptfoo/promptfoo | LLM eval/red team | 프롬프트 인젝션/정책 우회 테스트 | CI에서 guardrail 회귀 테스트에 좋음 |
5) 코드 보안 / Secret / 취약점 탐지 (같이 붙이면 좋은 도구들)
| 프로젝트 | 용도 | Claude Code/Codex에서의 역할 |
|---|---|---|
| gitleaks/gitleaks | secret scan | commit 전/후 API key, token 탐지 |
| trufflesecurity/trufflehog | secret scan | repo/history/cloud secret 탐지 |
| Yelp/detect-secrets | secret baseline | secret drift 관리 |
| semgrep/semgrep | SAST / custom rule | AI가 만든 취약 코드 차단 |
| github/codeql | 정적 분석 | PR 단계 보안 검증 |
| google/osv-scanner | dependency vuln scan | 취약 dependency 차단 |
| pre-commit/pre-commit | 로컬 hook orchestration | Claude/Codex가 commit 전에 검증 강제 |
| GitHubSecurityLab/seclab-taskflow-agent | AI 기반 보안 분석 | auth bypass, IDOR, token leak 등 찾는 오픈소스 프레임워크 |
6) 인접 레이어 (스킬 컬렉션, 훅 대시보드, 설정 템플릿)
| 프로젝트 | 용도 | 핵심 기능 | 평가 |
|---|---|---|---|
| alirezarezvani/claude-skills | Claude Code skills 컬렉션 | 300+ skills, 11개 플랫폼 지원 | ⭐ 14.7k |
| trailofbits/claude-code-config | 보안 설정 템플릿 | 보안 분석/테스트용 Claude Code 설정 템플릿 | ⭐ — |
| trailofbits/claude-code-devcontainer | DevContainer 샌드박스 | Claude Code DevContainer 기반 격리 실행 환경 | ⭐ 812 |
| felipeelias/hook-lab | Claude Code hook 대시보드 | hook 이벤트를 실시간 가시화하는 Elixir/Phoenix 대시보드 | ⭐ 6 · MIT |
실전 도입 가이드
상황별 추천
| 상황 | 추천 도구 |
|---|---|
| untrusted repo + 민감 자격증명 | claude-guardrails |
| tool call을 강하게 통제 | claude-code-guardrails |
| 조직 내 운영 정책/승인 피로 관리 | lanekeep |
| 컨텍스트 중복/드리프트 억제 | atlas-guardrails |
| 법무/상용 배포 전 IP 검증 | claude-skill-ip-guard |
| Git 위험 명령만 차단 | mattpocock git-guardrails-claude-code |
우선순위 추천
실제로 도입한다면 순서는 이렇게 보는 게 좋습니다.
- Claude Code: dwarvesf/claude-guardrails 부터 확인
- Git 위험 명령 차단: mattpocock git-guardrails-claude-code
- Codex: 내장 sandbox + approvals + rules 먼저 적용
- 공통 방어막: destructive_command_guard
- Secret/취약점 방지: gitleaks + Semgrep + pre-commit
- 프롬프트 인젝션/RAG/tool-call 방어: LlamaFirewall 또는 Blackwall LLM Shield
추천 조합
Claude Code용
- Claude Code Hooks 공식 기능
- dwarvesf/claude-guardrails
- mattpocock/skills — git-guardrails-claude-code
- gitleaks 또는 trufflehog
- Semgrep
- pre-commit
Codex용
- Codex sandbox = workspace-write
- Codex approval policy = on-request
- Codex Rules로 위험 명령 forbidden/prompt 처리
- destructive_command_guard 를 shell wrapper 또는 hook처럼 추가
- gitleaks / trufflehog / Semgrep / pre-commit
공통 게이트웨이/엔터프라이즈형
- LiteLLM Gateway 또는 자체 AI Gateway
- LlamaFirewall 또는 NeMo Guardrails
- Blackwall LLM Shield / SupraWall 계열
- Langfuse trace
- promptfoo / Garak / PyRIT 로 red team regression test
핵심 원칙: 프롬프트로 “하지 마”라고 말하는 게 아니라, hook/rule/sandbox/pre-commit에서 물리적으로 막는 구조로 가야 함. Claude Code는 hooks 생태계가 앞서 있고, Codex는 sandbox/rules 쪽이 더 공식적이고 안정적인 방향.