MCP HubMCP Hub
스킬 목록으로 돌아가기

security-audit-codebase

pjt222
업데이트됨 2 days ago
5 조회
17
2
17
GitHub에서 보기
개발api

정보

이 스킬은 노출된 비밀, 취약한 종속성, 주입 취약점, 불안전한 설정을 탐지하기 위해 코드베이스의 자동화된 보안 감사를 수행합니다. 출시 또는 배포 전, 주기적인 검토 중, 그리고 규정 준수 감사를 준비할 때 사용하도록 설계되었습니다. 이 도구는 필요에 따라 인증이나 종속성과 같은 특정 영역에 대한 대상 분석을 지원합니다.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/security-audit-codebase

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Security Audit Codebase

Systematic security review → ID vulns + exposed secrets.

Use When

  • Pre-publish|deploy
  • Periodic review
  • Post-auth|API integ|input handling
  • Pre-OSS private repo
  • Prep compliance audit

In

  • Required: Codebase
  • Optional: Focus area (secrets|deps|injection|auth)
  • Optional: Compliance frame (OWASP|ISO 27001|SOC 2)
  • Optional: Prev findings for compare

Do

Step 1: Scan Exposed Secrets

# API keys and tokens
grep -rn "sk-\|ghp_\|gho_\|github_pat_\|hf_\|AKIA" --include="*.{md,js,ts,py,R,json,yml,yaml}" .

# Generic secret patterns
grep -rn "password\s*=\s*['\"]" --include="*.{js,ts,py,R,json}" .
grep -rn "api[_-]key\s*[=:]\s*['\"]" --include="*.{js,ts,py,R,json}" .
grep -rn "secret\s*[=:]\s*['\"]" --include="*.{js,ts,py,R,json}" .

# Connection strings
grep -rn "postgresql://\|mysql://\|mongodb://" .

# Private keys
grep -rn "BEGIN.*PRIVATE KEY" .

→ No real secrets — only placeholders (YOUR_TOKEN_HERE, [email protected]).

If err: real secret found → remove + rotate cred + clean git history (git filter-branch|git-filter-repo). Treat exposed = compromised.

Step 2: .gitignore Coverage

# Check that these are git-ignored
git check-ignore .env .Renviron credentials.json node_modules/

# Look for tracked sensitive files
git ls-files | grep -i "\.env\|\.renviron\|credentials\|secret"

→ Sensitive (.env, .Renviron, credentials.json) in .gitignore, git ls-files returns no tracked sensitive.

If err: tracked → git rm --cached <file>, add .gitignore, commit. File stays disk but no longer versioned.

Step 3: Audit Deps

Node.js:

npm audit
npx audit-ci --moderate

Python:

pip-audit
safety check

R:

# Check for known vulnerabilities in packages
# No built-in tool, but verify package sources
renv::status()

→ No high|critical vulns. Mod+low documented.

If err: critical → update via npm audit fix|pip install --upgrade. Breaking changes → document + remediation plan.

Step 4: Injection Vulns

SQL Injection:

# Look for string concatenation in queries
grep -rn "paste.*SELECT\|paste.*INSERT\|paste.*UPDATE\|paste.*DELETE" --include="*.R" .
grep -rn "query.*\+.*\|query.*\$\{" --include="*.{js,ts}" .

All queries → parameterized, not string concat.

Command Injection:

# Look for shell execution with user input
grep -rn "system\(.*paste\|exec(\|spawn(" --include="*.{R,js,ts,py}" .

XSS:

# Look for unescaped user content in HTML
grep -rn "innerHTML\|dangerouslySetInnerHTML\|v-html" --include="*.{js,ts,jsx,tsx,vue}" .

→ No SQL|command|XSS vectors. Queries parameterized, shell avoids user input, HTML escaped.

If err: vulns found → replace string concat → parameterized, sanitize|escape user input pre-shell, framework-safe rendering not innerHTML|dangerouslySetInnerHTML.

Step 5: Auth + AuthZ Review

Checklist:

  • Pwds hashed bcrypt|argon2 (not MD5|SHA1)
  • Session tokens random + long
  • Auth tokens have expiration
  • API endpoints check authz
  • CORS restrictive
  • CSRF protection for state-changing ops

→ All pass: pwds strong hash, tokens random+expire, endpoints enforce authz, CORS restrictive, CSRF active.

If err: prioritize by severity — weak hash + missing authz = critical; CORS+CSRF = high. Document w/ severity.

Step 6: Config Security

# Debug mode in production configs
grep -rn "debug\s*[=:]\s*[Tt]rue\|DEBUG\s*=\s*1" --include="*.{json,yml,yaml,toml,cfg}" .

# Permissive CORS
grep -rn "Access-Control-Allow-Origin.*\*\|cors.*origin.*\*" --include="*.{js,ts}" .

# HTTP instead of HTTPS
grep -rn "http://" --include="*.{js,ts,py,R}" . | grep -v "localhost\|127.0.0.1\|http://"

→ Debug off prod, no wildcard CORS prod, all external HTTPS.

If err: debug prod → disable. Wildcard CORS → explicit allowed domains. http://https:// where supported.

Step 7: Document Findings

# Security Audit Report

**Date**: YYYY-MM-DD
**Auditor**: [Name]
**Scope**: [Repository/Project]
**Status**: [PASS/FAIL/CONDITIONAL]

## Findings Summary

| Category | Status | Details |
|----------|--------|---------|
| Exposed secrets | PASS | No secrets found |
| .gitignore | PASS | Sensitive files excluded |
| Dependencies | WARN | 2 moderate vulnerabilities |
| Injection | PASS | Parameterized queries used |
| Auth/AuthZ | N/A | No authentication in scope |
| Configuration | PASS | Debug mode disabled |

## Detailed Findings

### Finding 1: [Title]
- **Severity**: Low / Medium / High / Critical
- **Location**: `path/to/file:line`
- **Description**: What was found
- **Recommendation**: How to fix
- **Status**: Open / Resolved

## Recommendations
1. Update dependencies to fix moderate vulnerabilities
2. [Additional recommendations]

SECURITY_AUDIT_REPORT.md in project root w/ findings categorized by severity, location, desc, recommendation.

If err: too many findings → group by category + prioritize critical|high. Generate regardless to baseline.

Check

  • No hardcoded secrets
  • .gitignore covers sensitive
  • No high|critical dep vulns
  • No injection vulns
  • Auth properly impl (if applicable)
  • Audit report complete + findings addressed

Traps

  • Only check current files: Secrets in git history still exposed. git log -p --all -S 'secret_pattern'.
  • Ignore dev deps: Dev deps still introduce supply chain risk.
  • False sense from .gitignore: Only prevents future tracking. Already-committed → git rm --cached.
  • Overlook configs: docker-compose.yml, CI configs, deploy scripts often have secrets.
  • No rotate compromised: Finding+removing not enough. Cred must be revoked + regenerated.

  • configure-git-repository — proper .gitignore setup
  • write-claude-md — document security reqs
  • setup-gxp-r-project — security in regulated envs

GitHub 저장소

pjt222/agent-almanac
경로: i18n/caveman-ultra/skills/security-audit-codebase
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

연관 스킬

qmd

개발

qmd는 BM25, 벡터 임베딩, 재순위화를 결합한 하이브리드 검색을 통해 로컬 파일을 색인화하고 검색할 수 있는 로컬 검색 및 색인화 CLI 도구입니다. 명령줄 사용과 Claude 통합을 위한 MCP(Model Context Protocol) 모드를 모두 지원합니다. 이 도구는 임베딩에 Ollama를 사용하고 색인을 로컬에 저장하여 터미널에서 직접 문서나 코드베이스를 검색하는 데 이상적입니다.

스킬 보기

subagent-driven-development

개발

이 스킬은 각 독립적인 작업마다 새로운 하위 에이전트를 배치하고 작업 사이에 코드 리뷰를 진행하여 구현 계획을 실행합니다. 이 리뷰 프로세스를 통해 품질 게이트를 유지하면서 빠른 반복 작업을 가능하게 합니다. 동일한 세션 내에서 대부분 독립적인 작업을 진행할 때 내장된 품질 검증과 함께 지속적인 진행을 보장하기 위해 사용하세요.

스킬 보기

mcporter

개발

mcporter 스킬은 개발자가 Claude에서 직접 Model Context Protocol(MCP) 서버를 관리하고 호출할 수 있도록 합니다. 이 스킬은 사용 가능한 서버를 나열하고, 인수를 사용해 해당 서버의 도구를 호출하며, 인증 및 데몬 생명주기를 처리하는 명령어를 제공합니다. 개발 워크플로우에서 MCP 서버 기능을 통합하고 테스트할 때 이 스킬을 사용하세요.

스킬 보기

adk-deployment-specialist

개발

이 스킬은 A2A 프로토콜을 사용하여 Vertex AI ADK 에이전트를 배포하고 오케스트레이션하며, AgentCard 검색, 작업 제출, 코드 실행 샌드박스 및 메모리 뱅크와 같은 지원 도구를 관리합니다. Python, Java 또는 Go 언어로 순차, 병렬 또는 루프 오케스트레이션 패턴을 갖춘 다중 에이전트 시스템 구축을 가능하게 합니다. Google Cloud에서 ADK 에이전트 배포 또는 에이전트 워크플로우 오케스트레이션을 요청받았을 때 사용하세요.

스킬 보기