security-review
하는 일
이 도구는 공격자가 악용할 수 있는 흔한 실수를 찾아 코드가 안전한지 확인하도록 돕습니다. 비밀번호를 저장하는 방식부터 사용자가 보낸 정보를 처리하는 방식까지 모두 점검합니다.
사용하는 경우
- ✓사이트에 로그인과 비밀번호 기능을 추가할 때.
- ✓프로그램이 사용자가 입력한 정보를 받을 때.
- ✓결제를 받거나 민감한 데이터를 다루는 공간을 만들 때.
스킬 링크
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/security-review/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“비밀번호가 노출되지 않고 사용자 데이터가 안전하게 처리되는지 코드를 검토해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
도구는 코드에서 안전하지 않은 관행을 분석합니다. 예를 들어 코드에 직접 적힌 비밀번호나 데이터 검증 부족을 찾습니다. 그리고 환경 변수를 사용해 비밀번호를 관리하고, 들어오는 모든 정보를 검증하는 등 올바른 방법을 제안합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Security Review Skill
This skill ensures all code follows security best practices and identifies potential vulnerabilities.
When to Activate
- Implementing authentication or authorization
- Handling user input or file uploads
- Creating new API endpoints
- Working with secrets or credentials
- Implementing payment features
- Storing or transmitting sensitive data
- Integrating third-party APIs
Security Checklist
1. Secrets Management
FAIL: NEVER Do This
const apiKey = "sk-proj-xxxxx" // Hardcoded secret
const dbPassword = "password123" // In source code
PASS: ALWAYS Do This
const apiKey = process.env.OPENAI_API_KEY
const dbUrl = process.env.DATABASE_URL
// Verify secrets exist
if (!apiKey) {
throw new Error('OPENAI_API_KEY not configured')
}
Verification Steps
- No hardcoded API keys, tokens, or passwords
- All secrets in environment variables
-
.env.localin .gitignore - No secrets in git history
- Production secrets in hosting platform (Vercel, Railway)
2. Input Validation
Always Validate User Input
import { z } from 'zod'
// Define validation schema
const CreateUserSchema = z.object({
email: z.string().email(),
name: z.string().min(1).max(100),
age: z.number().int().min(0).max(150)
})
// Validate before processing
export async function createUser(input: unknown) {
try {
const validated = CreateUserSchema.parse(input)
return await db.users.create(validated)
} catch (error) {
if (error instanceof z.ZodError) {
return { success: false, errors: error.issues }
}
throw error
}
}
File Upload Validation
function validateFileUpload(file: File) {
// Size check (5MB max)
const maxSize = 5 * 1024 * 1024
if (file.size > maxSize) {
throw new Error('File too large (max 5MB)')
}
// Type check
const allowedTypes = ['image/jpeg', 'image/png', 'image/gif']
if (!allowedTypes.includes(file.type)) {
throw new Error('Invalid file type')
}
// Extension check
const allowedExtensions = ['.jpg', '.jpeg', '.png', '.gif']
const extension = file.name.toLowerCase().match(/\.[^.]+$/)?.[0]
if (!extension || !allowedExtensions.includes(extension)) {
throw new Error('Invalid file extension')
}
return true
}
Verification Steps
- All user inputs validated with schemas
- File uploads restricted (size, type, extension)
- No direct use of user input in queries
- Whitelist validation (not blacklist)
- Error messages don't leak sensitive info
3. SQL Injection Prevention
FAIL: NEVER Concatenate SQL
// DANGEROUS - SQL Injection vulnerability
const query = `SELECT * FROM users WHERE email = '${userEmail}'`
await db.query(query)
PASS: ALWAYS Use Parameterized Queries
// Safe - parameterized query
const { data } = await supabase
.from('users')
.select('*')
.eq('email', userEmail)
// Or with raw SQL -- the value goes in the params array, never in the
// string. Use your driver's placeholder syntax (Postgres numbers its
// placeholders, MySQL uses "?").
await db.query(
'SELECT * FROM users WHERE email = ?',
[userEmail]
)
<!-- Do not write a literal dollar-sign-N placeholder anywhere in this file.
Invoking this skill with arguments substitutes it away, and the example
above then renders as concatenated SQL -- the exact anti-pattern this
section warns against. Use "?" and name the Postgres form in prose. -->
Verification Steps
- All database queries use parameterized queries
- No string concatenation in SQL
- ORM/query builder used correctly
- Supabase queries properly sanitized
4. Authentication & Authorization
JWT Token Handling
// FAIL: WRONG: localStorage (vulnerable to XSS)
localStorage.setItem('token', token)
// PASS: CORRECT: httpOnly cookies
res.setHeader('Set-Cookie',
`token=${token}; HttpOnly; Secure; SameSite=Strict; Max-Age=3600`)
Authorization Checks
export async function deleteUser(userId: string, requesterId: string) {
// ALWAYS verify authorization first
const requester = await db.users.findUnique({
where: { id: requesterId }
})
if (requester.role !== 'admin') {
return NextResponse.json(
{ error: 'Unauthorized' },
{ status: 403 }
)
}
// Proceed with deletion
…
자주 묻는 질문
‘시크릿(secrets)’이란 무엇인가요?
비밀번호, API 키, 액세스 토큰처럼 기밀로 유지해야 하는 정보입니다. 코드에 직접 쓰거나 공개적으로 노출해서는 안 됩니다.
입력 검증이란 무엇인가요?
사용자가 프로그램에 보낸 정보가 올바르고 안전한지 사용하기 전에 확인하는 과정입니다. 악성 데이터가 문제를 일으키는 것을 막습니다.
SQL 인젝션이란 무엇인가요?
프로그램이 데이터베이스로 보내는 텍스트 입력란에 공격자가 악성 명령을 넣는 공격입니다. 공격자가 데이터를 보거나 수정할 수 있게 될 수 있습니다. 이 도구는 이를 막는 방법을 알려 줍니다.
상세 정보
작성자의 원본 설명
Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features. Provides comprehensive security checklist and patterns.
repo: affaan-m/ECC
인기도
- GitHub 스타
- 280k
- 순위
- #244
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
accessibility
280k에이전트가 모든 사람이 쓸 수 있는 인터페이스를 만들도록 돕습니다. 시각 장애나 운동 장애가 있는 사람도 쓸 수 있게 합니다.
agent-architecture-audit
280k에이전트가 모든 것이 올바르게 작동하는지 점검하도록 돕습니다. AI 시스템의 문제를 찾아 고쳐서 기대대로 작동하게 합니다.
agent-eval
280k에이전트가 서로 다른 AI 코딩 도구를 비교하도록 돕습니다. 특정 작업에서 어느 도구가 더 빠르고, 저렴하고, 믿을 만한지 측정합니다.
agent-harness-construction
280k에이전트가 작업을 더 잘 이해하도록 돕습니다. 에이전트가 쓰는 도구와 지시문을 최적화해 성공 가능성을 높입니다.