跳到主内容
智客 ZICQ

技能库 智客分类:安全测试 cc-skill-security-review

Cc Skill Security Review

这一技能确保所有守则都遵循安全最佳做法并查明潜在的弱点。 在执行认证或授权,处理用户输入或文件上传,或创建新的API端点时使用.

2044 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

这一技能确保所有守则遵循安全最佳做法并查明潜在的弱点

何时用

- 执行认证或授权

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Security Review Skill、Detailed Guide、When to Use、Security Checklist、1. Secrets Management、2. Input Validation。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/detailed-guide.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

This skill ensures all code follows security best practices and identifies potential vulnerabilities. Use when implementing authentication or authorization, handling user input or file uploads, or creating new API endpoints.

Security Review SkillDetailed GuideWhen to UseSecurity Checklist1. Secrets Management2. Input Validation3. SQL Injection Prevention4. Authentication & Authorization5. XSS Prevention6. CSRF Protection7. Rate Limiting8. Sensitive Data Exposure

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
cc-skill-security-review
description
This skill ensures all code follows security best practices and identifies potential vulnerabilities. Use when implementing authentication or authorization, handling user input or file uploads, or creating new API endpoints.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 1
  • references/detailed-guide.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「cc-skill-security-review」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-ab51109d16c9e4c5-Cc-%E6%8A%80%E8%83%BD%E5%AE%89%E5%85%A8%E5%AE%A1%E6%9F%A5.html
请存为 .cursor/skills/cc-skill-security-review/SKILL.md 或 .claude/skills/cc-skill-security-review/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/sickn33/agentic-awesome-skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/sickn33/agentic-awesome-skills' --list

npx skills add 'https://github.com/sickn33/agentic-awesome-skills' --skill 'cc-skill-security-review'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: cc-skill-security-review description: "This skill ensures all code follows security best practices and identifies potential vulnerabilities. Use when implementing authentication or authorization, handling user input or file uploads, or creating new API endpoints." risk: critical source: community date_added: "2026-02-27" --- # Security Review Skill This skill ensures all code follows security best practices and identifies potential vulnerabilities. ## Detailed Guide Read [the detailed guide](references/detailed-guide.md) before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely. ## When to Use - 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 #### ❌ NEVER Do This ```typescript const leakedToken = "[redacted API key]" // Hardcoded secret const dbCredential = "[redacted password]" // In source code ``` #### ✅ ALWAYS Do This ```typescript 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.local` in .gitignore - [ ] No secrets in git history - [ ] Production secrets in hosting platform (Vercel, Railway) ### 2. Input Validation #### Always Validate User Input ```typescript 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.errors } } throw error } } ``` #### File Upload Validation ```typescript 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 #### ❌ NEVER Concatenate SQL ```typescript // DANGEROUS - SQL Injection vulnerability const query = `SELECT * FROM users WHERE email = '${userEmail}'` await db.query(query) ``` #### ✅ ALWAYS Use Parameterized Queries ```typescript // Safe - parameterized query const { data } = await supabase .from('users') .select('*') .eq('email', userEmail) // Or with raw SQL await db.query( 'SELECT * FROM users WHERE email = $1', [userEmail] ) ``` #### 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 ```typescript // ❌ WRONG: localStorage (vulnerable to XSS) localStorage.setItem('token', token) // ✅ CORRECT: httpOnly cookies res.setHeader('Set-Cookie', `token=${token}; HttpOnly; Secure; SameSite=Strict; Max-Age=3600`) ``` #### Authorization Checks ```typescript 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 await db.users.delete({ where: { id: userId } }) } ``` #### Row Level Security (Supabase) ```sql -- Enable RLS on all tables ALTER TABLE users ENABLE ROW LEVEL SECURITY; -- Users can only view their own data CREATE POLICY "Users view own data" ON users FOR SELECT USING (auth.uid() = id); -- Users can only update their own data CREATE POLICY "Users update own data" ON users FOR UPDATE USING (auth.uid() = id); ``` #### Verification Steps - [ ] Tokens stored in httpOnly cookies (not localStorage) - [ ] Authorization checks before sensitive operations - [ ] Row Level Security enabled in Supabase - [ ] Role-based access control implemented - [ ] Session management secure ### 5. XSS Prevention #### Sanitize HTML ```typescript import DOMPurify from 'isomorphic-dompurify' // ALWAYS sanitize user-provided HTML function renderUserContent(html: string) { const clean = DOMPurify.sanitize(html, { ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'p'], ALLOWED_ATTR: [] }) return
} ``` #### Content Security Policy ```typescript // next.config.js const securityHeaders = [ { key: 'Content-Security-Policy', value: ` default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'; connect-src 'self' https://api.example.com; `.replace(/\s{2,}/g, ' ').trim() } ] ``` #### Verification Steps - [ ] User-provided HTML sanitized - [ ] CSP headers configured - [ ] No unvalidated dynamic content rendering - [ ] React's built-in XSS protection used ### 6. CSRF Protection #### CSRF Tokens ```typescript import { csrf } from '@/lib/csrf' export async function POST(request: Request) { const token = request.headers.get('X-CSRF-Token') if (!csrf.verify(token)) { return NextResponse.json( { error: 'Invalid CSRF token' }, { status: 403 } ) } // Process request } ``` #### SameSite Cookies ```typescript res.setHeader('Set-Cookie', `session=${sessionId}; HttpOnly; Secure; SameSite=Strict`) ``` #### Verification Steps - [ ] CSRF tokens on state-changing operations - [ ] SameSite=Strict on all cookies - [ ] Double-submit cookie pattern implemented ### 7. Rate Limiting #### API Rate Limiting ```typescript import rateLimit from 'express-rate-limit' const limiter = rateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes max: 100, // 100 requests per window message: 'Too many requests' }) // Apply to routes app.use('/api/', limiter) ``` #### Expensive Operations ```typescript // Aggressive rate limiting for searches const searchLimiter = rateLimit({ windowMs: 60 * 1000, // 1 minute max: 10, // 10 requests per minute message: 'Too many search requests' }) app.use('/api/search', searchLimiter) ``` #### Verification Steps - [ ] Rate limiting on all API endpoints - [ ] Stricter limits on expensive operations - [ ] IP-based rate limiting - [ ] User-based rate limiting (authenticated) ### 8. Sensitive Data Exposure #### Logging ```typescript // ❌ WRONG: Logging sensitive data console.log('User login:', { email, password }) console.log('Payment:', { cardNumber, cvv }) // ✅ CORRECT: Redact sensitive data console.log('User login:', { email, userId }) console.log('Payment:', { last4: card.last4, userId }) ``` #### Error Messages ```typescript // ❌ WRONG: Exposing internal details catch (error) { return NextResponse.json( { error: error.message, stack: error.stack }, { status: 500 } ) } // ✅ CORRECT: Generic error messages catch (error) { console.error('Internal error:', error) return NextResponse.json( { error: 'An error occurred. Please try again.' }, { status: 500 } ) } ``` #### Verification Steps - [ ] No passwords, tokens, or secrets in logs - [ ] Error messages generic for users - [ ] Detailed errors only in server logs - [ ] No stack traces exposed to users ### 9. Blockchain Security (Solana) #### Wallet Verification ```typescript import { verify } from '@solana/web3.js' async function verifyWalletOwnership( publicKey: string, signature: string, message: string ) { try { const isValid = verify( Buffer.from(message), Buffer.from(signature, 'base64'), Buffer.from(publicKey, 'base64') ) return isValid } catch (error) { return false } } ``` #### Transaction Verification ```typescript async function verifyTransaction(transaction: Transaction) { // Verify recipient if (transaction.to !== expectedRecipient) { throw new Error('Invalid recipient') } // Verify amount if (transaction.amount > maxAmount) { throw new Error('Amount exceeds limit') } // Verify user has sufficient balance const balance = await getBalance(transaction.from) if (balance < transaction.amount) { throw new Error('Insufficient balance') } return true } ``` #### Verification Steps - [ ] Wallet signatures verified - [ ] Transaction details validated - [ ] Balance checks before transactions - [ ] No blind transaction signing ### 10. Dependency Security #### Regular Updates ```bash # Check for vulnerabilities npm audit # Fix automatically fixable issues npm audit fix # Update dependencies npm update # Check for outdated packages npm outdated ``` #### Lock Files ```bash # ALWAYS commit lock files git add package-lock.json # Use in CI/CD for reproducible builds npm ci # Instead of npm install ``` #### Verification Steps - [ ] Dependencies up to date - [ ] No known vulnerabilities (npm audit clean) - [ ] Lock files committed - [ ] Dependabot enabled on GitHub - [ ] Regular security updates ## Security Testing ### Automated Security Tests ```typescript // Test authentication test('requires authentication', async () => { const response = await fetch('/api/protected') expect(response.status).toBe(401) }) // Test authorization test('requires admin role', async () => { const response = await fetch('/api/admin', { headers: { Authorization: `Bearer ${userToken}` } }) expect(response.status).toBe(403) }) // Test input validation test('rejects invalid input', async () => { const response = await fetch('/api/users', { method: 'POST', body: JSON.stringify({ email: 'not-an-email' }) }) expect(response.status).toBe(400) }) // Test rate limiting test('enforces rate limits', async () => { const requests = Array(101).fill(null).map(() => fetch('/api/endpoint') ) const responses = await Promise.all(requests) const tooManyRequests = responses.filter(r => r.status === 429) expect(tooManyRequests.length).toBeGreaterThan(0) }) ``` ## Limitations - Use this skill only when the task clearly matches the scope described above. - Do not treat the output as a substitute for environment-specific validation, testing, or expert review. - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

相关技能

安全测试

Skill Vetter

人工智能特工的安全第一技能审查。 在安装来自 ClawdHub, GitHub 或其他来源的任何技能之前使用 。 检查红旗,许可范围,可疑图案.

安全测试

Moltguard

MoltGuard——由OpenGuardrails担任OpenClaw保安. 安装 MoltGuard 以保护你和你的人类免受迅速注射、数据过滤和恶意命令的影响。 资料来源:https://github.com/openguardrails/openguardrails/tre…

安全测试

Security Auditor

用于审查安全漏洞代码,实施认证流,审计OWASP Top 10,配置CORS/CSP头,处理秘密,输入验证,SQL注射预防,XSS保护,或任何与安全相关的代码审查.

安全测试

Skill Vetter

安装任何AI代理技能前的安全审查协议. 红旗侦取入证盗取,疏通密码,放出. 风险分类:低/中/高/高。 编制结构化审查报告。 不先运行此功能, 绝不安装不信任的技能 .