This skill should be used when performing security audits on Cratos - command injection analysis, REST API authorization review, WebSocket authentication, tool security, and generating actionable fix plans.
# exec 도구 보안 테스트
cargo test -p cratos-tools -- exec::tests --nocapture
# bash 도구 보안 테스트
cargo test -p cratos-tools -- bash::tests --nocapture
# 전체 보안 관련 테스트
cargo test -p cratos-tools --nocapture
cargo test -p cratos-core -- security --nocapture
# 의존성 취약점
cargo audit
1---2name: security-audit3description: This skill should be used when performing security audits on Cratos - command injection analysis, REST API authorization review, WebSocket authentication, tool security, and generating actionable fix plans.4---56# Security Audit Skill78Cratos 프로젝트의 보안 감사를 수행하는 스킬. 코드 분석 → 취약점 식별 → 심각도 분류 → 수정 플랜 생성까지 E2E로 처리한다.910## 감사 범위1112### 1. Command Injection (exec/bash 도구)13대상 파일:14- `crates/cratos-tools/src/builtins/exec.rs` — 직접 실행 도구15- `crates/cratos-tools/src/builtins/bash.rs` — PTY 기반 셸 도구 (5-layer security)16- `crates/cratos-core/src/security/injection.rs` — InjectionDetector 패턴1718체크리스트:19- [ ] 셸 메타문자 차단 (`;|&$\`()<>\n\r!#`)20- [ ] 위험 커맨드 블랙리스트 (rm, sudo, bash, python, curl 등 70+)21- [ ] 버전 인터프리터 우회 (`python3.11`, `perl5.34` 등 prefix match)22- [ ] 커맨드 래퍼 차단 (`env`, `xargs`, `nohup`, `osascript`)23- [ ] 위험 경로 차단 (`/etc`, `/root`, `/var/log` 등)24- [ ] args 안전성 (Command::new() 셸 미경유 확인)25- [ ] Docker 샌드박스 격리 (network=none, read-only, pids-limit)2627bash 도구 5-Layer:28- [ ] Layer 1: 입력 검증 (LD_PRELOAD, $(curl, heredoc, process substitution)29- [ ] Layer 2: 파이프라인 분석 (세그먼트별 커맨드 블록, glob/alias/function 차단)30- [ ] Layer 3: 환경 격리 (env 화이트리스트, workspace jail, 경로 차단)31- [ ] Layer 4: 리소스 제한 (rate limit, 출력 제한, 세션 제한)32- [ ] Layer 5: 출력 검증 (시크릿 마스킹, base64 데이터 마스킹)3334### 2. REST API 인가35대상 파일:36- `src/middleware/auth.rs` — RequireAuth 추출자37- `src/server.rs` — 라우터 구성, AuthConfig38- `src/api/*.rs` — 모든 REST 핸들러3940체크리스트:41- [ ] 모든 엔드포인트에 RequireAuth 적용 여부42- [ ] Scope 세분화 (ConfigRead/ConfigWrite/SchedulerWrite/Admin 등)43- [ ] 기본 인증 설정 (enabled 기본값, 프로덕션 강제)44- [ ] 민감 정보 노출 (/health/detailed, /metrics)4546### 3. WebSocket 인증47대상 파일:48- `src/websocket/chat.rs` — WS 채팅49- `src/websocket/events.rs` — 이벤트 스트림5051체크리스트:52- [ ] WS upgrade 시 토큰 검증53- [ ] `?token=` 쿼리 파라미터 추출 → AuthStore 검증54- [ ] 인증 실패 시 연결 거부5556### 4. 스케줄러 보안57대상 파일:58- `src/api/scheduler.rs` — 스케줄러 API59- `src/server.rs` — task_executor 클로저6061체크리스트:62- [ ] Shell Action이 exec 보안 필터 경유하는지63- [ ] API를 통한 악성 작업 등록 방어64- [ ] Scope 분리 (read/write)6566### 5. 입력 검증67대상 파일:68- `crates/cratos-core/src/security/injection.rs` — InjectionDetector69- `crates/cratos-core/src/security/mod.rs` — 보안 모듈7071체크리스트:72- [ ] SQL injection 패턴 (sqlx 파라미터 바인딩)73- [ ] SSRF (web_search 도구 URL 필터링)74- [ ] Path traversal (`../` 차단)7576## 감사 수행 절차7778### Phase 1: 정보 수집791. `cargo check --all-targets` — 빌드 확인802. `cargo test -p cratos-tools` — 보안 테스트 실행813. 관련 소스 파일 읽기 (위 대상 파일 목록)8283### Phase 2: 취약점 식별84각 취약점에 대해:85- **위치**: 파일:라인번호86- **심각도**: CRITICAL / HIGH / MEDIUM / LOW87- **영향**: 공격 시나리오88- **코드 증거**: 관련 코드 스니펫8990### Phase 3: 보고서 생성91심각도별 분류 테이블:9293```markdown94| 코드 | 심각도 | 위치 | 설명 | 상태 |95| ---- | -------- | ------------ | ------------------ | ------ |96| V2-1 | CRITICAL | server.rs:98 | 기본 인증 비활성화 | 미수정 |97```9899### Phase 4: 수정 플랜100우선순위별 수정 가이드:1011. **CRITICAL** — 즉시 수정 (PR 분리)1022. **HIGH** — 같은 스프린트 내 수정1033. **MEDIUM** — 다음 스프린트1044. **LOW** — 백로그105106## 이전 감사 결과 참조107108- `.serena/memories/cratos-security.md` — 보안 감사 결과109110### 알려진 양호 영역111- Command Injection: exec/bash 모두 안전 (9/10)112- 비밀 관리: OS 키체인 + zeroize (8/10)113- Docker 샌드박스: network=none, read-only, pids-limit (9/10)114115### 알려진 취약 영역 (v2 기준)116- REST API 인가 (6/10) — 5건 취약점117- WS 인증 없음 — CRITICAL118- /health/detailed 정보 노출 — HIGH119120## 보안 테스트 커맨드121122```bash123# exec 도구 보안 테스트124cargo test -p cratos-tools -- exec::tests --nocapture125126# bash 도구 보안 테스트127cargo test -p cratos-tools -- bash::tests --nocapture128129# 전체 보안 관련 테스트130cargo test -p cratos-tools --nocapture131cargo test -p cratos-core -- security --nocapture132133# 의존성 취약점134cargo audit135```
Run npx skillmds@latest add first-fluke/security-audit in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
This skill should be used when performing security audits on Cratos - command injection analysis, REST API authorization review, WebSocket authentication, tool security, and generating actionable fix plans. It is listed under Security on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
first-fluke (@first-fluke) published this skill. Their other Agent Skills are listed on their SkillMD profile.