[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M780C3ZNX5TRPRPYH8S7176T":3,"skill-same:01M780C3ZNX5TRPRPYH8S7176T":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M780C3ZNX5TRPRPYH8S7176T","security-auditor",null,"Use when reviewing code for security vulnerabilities, implementing authentication flows, auditing OWASP Top 10, configuring CORS\u002FCSP headers, handling secrets, input validation, SQL injection prevention, XSS protection, or any security-related code review.","HKU-MMLab\u002FUniClawBench","HKU-MMLab","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F218629317?v=4","01M7808YETMPBKR5WJNJRFSCDJ","01M7808YFS0WMXB5QAF8YG01BA",40,"MIT","https:\u002F\u002Fgithub.com\u002FHKU-MMLab\u002FUniClawBench\u002Fblob\u002Fmain\u002Finjection\u002F101_skill_usage\u002Ftask_101_10_docker_audit\u002Fskills\u002Fsecurity-auditor\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: security-auditor\nversion: 1.0.0\ndescription: Use when reviewing code for security vulnerabilities, implementing authentication flows, auditing OWASP Top 10, configuring CORS\u002FCSP headers, handling secrets, input validation, SQL injection prevention, XSS protection, or any security-related code review.\ntriggers:\n  - security\n  - vulnerability\n  - OWASP\n  - XSS\n  - SQL injection\n  - CSRF\n  - CORS\n  - CSP\n  - authentication\n  - authorization\n  - encryption\n  - secrets\n  - JWT\n  - OAuth\n  - audit\n  - penetration\n  - sanitize\n  - validate input\nrole: specialist\nscope: review\noutput-format: structured\n---\n\n# Security Auditor\n\nComprehensive security audit and secure coding specialist. Adapted from buildwithclaude by Dave Poon (MIT).\n\n## Role Definition\n\nYou are a senior application security engineer specializing in secure coding practices, vulnerability detection, and OWASP compliance. You conduct thorough security reviews and provide actionable fixes.\n\n## Audit Process\n\n1. **Conduct comprehensive security audit** of code and architecture\n2. **Identify vulnerabilities** using OWASP Top 10 framework\n3. **Design secure authentication and authorization** flows\n4. **Implement input validation** and encryption mechanisms\n5. **Create security tests** and monitoring strategies\n\n## Core Principles\n\n- Apply defense in depth with multiple security layers\n- Follow principle of least privilege for all access controls\n- Never trust user input — validate everything rigorously\n- Design systems to fail securely without information leakage\n- Conduct regular dependency scanning and updates\n- Focus on practical fixes over theoretical security risks\n\n---\n\n## OWASP Top 10 Checklist\n\n### 1. Broken Access Control (A01:2021)\n\n```typescript\n\u002F\u002F ❌ BAD: No authorization check\napp.delete('\u002Fapi\u002Fposts\u002F:id', async (req, res) => {\n  await db.post.delete({ where: { id: req.params.id } })\n  res.json({ success: true })\n})\n\n\u002F\u002F ✅ GOOD: Verify ownership\napp.delete('\u002Fapi\u002Fposts\u002F:id', authenticate, async (req, res) => {\n  const post = await db.post.findUnique({ where: { id: req.params.id } })\n  if (!post) return res.status(404).json({ error: 'Not found' })\n  if (post.authorId !== req.user.id && req.user.role !== 'admin') {\n    return res.status(403).json({ error: 'Forbidden' })\n  }\n  await db.post.delete({ where: { id: req.params.id } })\n  res.json({ success: true })\n})\n```\n\n**Checks:**\n- [ ] Every endpoint verifies authentication\n- [ ] Every data access verifies authorization (ownership or role)\n- [ ] CORS configured with specific origins (not `*` in production)\n- [ ] Directory listing disabled\n- [ ] Rate limiting on sensitive endpoints\n- [ ] JWT tokens validated on every request\n\n### 2. Cryptographic Failures (A02:2021)\n\n```typescript\n\u002F\u002F ❌ BAD: Storing plaintext passwords\nawait db.user.create({ data: { password: req.body.password } })\n\n\u002F\u002F ✅ GOOD: Bcrypt with sufficient rounds\nimport bcrypt from 'bcryptjs'\nconst hashedPassword = await bcrypt.hash(req.body.password, 12)\nawait db.user.create({ data: { password: hashedPassword } })\n```\n\n**Checks:**\n- [ ] Passwords hashed with bcrypt (12+ rounds) or argon2\n- [ ] Sensitive data encrypted at rest (AES-256)\n- [ ] TLS\u002FHTTPS enforced for all connections\n- [ ] No secrets in source code or logs\n- [ ] API keys rotated regularly\n- [ ] Sensitive fields excluded from API responses\n\n### 3. Injection (A03:2021)\n\n```typescript\n\u002F\u002F ❌ BAD: SQL injection vulnerable\nconst query = `SELECT * FROM users WHERE email = '${email}'`\n\n\u002F\u002F ✅ GOOD: Parameterized queries\nconst user = await db.query('SELECT * FROM users WHERE email = $1', [email])\n\n\u002F\u002F ✅ GOOD: ORM with parameterized input\nconst user = await prisma.user.findUnique({ where: { email } })\n```\n\n```typescript\n\u002F\u002F ❌ BAD: Command injection\nconst result = exec(`ls ${userInput}`)\n\n\u002F\u002F ✅ GOOD: Use execFile with argument array\nimport { execFile } from 'child_process'\nexecFile('ls', [sanitizedPath], callback)\n```\n\n**Checks:**\n- [ ] All database queries use parameterized statements or ORM\n- [ ] No string concatenation in queries\n- [ ] OS command execution uses argument arrays, not shell strings\n- [ ] LDAP, XPath, and NoSQL injection prevented\n- [ ] User input never used in `eval()`, `Function()`, or template literals for code\n\n### 4. Cross-Site Scripting (XSS) (A07:2021)\n\n```typescript\n\u002F\u002F ❌ BAD: dangerouslySetInnerHTML with user input\n\u003Cdiv dangerouslySetInnerHTML={{ __html: userComment }} \u002F>\n\n\u002F\u002F ✅ GOOD: Sanitize HTML\nimport DOMPurify from 'isomorphic-dompurify'\n\u003Cdiv dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(userComment) }} \u002F>\n\n\u002F\u002F ✅ BEST: Render as text (React auto-escapes)\n\u003Cdiv>{userComment}\u003C\u002Fdiv>\n```\n\n**Checks:**\n- [ ] React auto-escaping relied upon (avoid `dangerouslySetInnerHTML`)\n- [ ] If HTML rendering needed, sanitize with DOMPurify\n- [ ] CSP headers configured (see below)\n- [ ] HttpOnly cookies for session tokens\n- [ ] URL parameters validated before rendering\n\n### 5. Security Misconfiguration (A05:2021)\n\n**Checks:**\n- [ ] Default credentials changed\n- [ ] Error messages don't leak stack traces in production\n- [ ] Unnecessary HTTP methods disabled\n- [ ] Security headers configured (see below)\n- [ ] Debug mode disabled in production\n- [ ] Dependencies up to date (`npm audit`)\n\n---\n\n## Security Headers\n\n```typescript\n\u002F\u002F next.config.js\nconst securityHeaders = [\n  { key: 'X-DNS-Prefetch-Control', value: 'on' },\n  { key: 'Strict-Transport-Security', value: 'max-age=63072000; includeSubDomains; preload' },\n  { key: 'X-Frame-Options', value: 'SAMEORIGIN' },\n  { key: 'X-Content-Type-Options', value: 'nosniff' },\n  { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },\n  { key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' },\n  {\n    key: 'Content-Security-Policy',\n    value: [\n      \"default-src 'self'\",\n      \"script-src 'self' 'unsafe-eval' 'unsafe-inline'\",  \u002F\u002F tighten in production\n      \"style-src 'self' 'unsafe-inline'\",\n      \"img-src 'self' data: https:\",\n      \"font-src 'self'\",\n      \"connect-src 'self' https:\u002F\u002Fapi.example.com\",\n      \"frame-ancestors 'none'\",\n      \"base-uri 'self'\",\n      \"form-action 'self'\",\n    ].join('; '),\n  },\n]\n\nmodule.exports = {\n  async headers() {\n    return [{ source: '\u002F(.*)', headers: securityHeaders }]\n  },\n}\n```\n\n---\n\n## Input Validation Patterns\n\n### Zod Validation for API\u002FActions\n\n```typescript\nimport { z } from 'zod'\n\nconst userSchema = z.object({\n  email: z.string().email().max(255),\n  password: z.string().min(8).max(128),\n  name: z.string().min(1).max(100).regex(\u002F^[a-zA-Z\\s'-]+$\u002F),\n  age: z.number().int().min(13).max(150).optional(),\n})\n\n\u002F\u002F Server Action\nexport async function createUser(formData: FormData) {\n  'use server'\n  const parsed = userSchema.safeParse({\n    email: formData.get('email'),\n    password: formData.get('password'),\n    name: formData.get('name'),\n  })\n\n  if (!parsed.success) {\n    return { error: parsed.error.flatten() }\n  }\n\n  \u002F\u002F Safe to use parsed.data\n}\n```\n\n### File Upload Validation\n\n```typescript\nconst ALLOWED_TYPES = ['image\u002Fjpeg', 'image\u002Fpng', 'image\u002Fwebp']\nconst MAX_SIZE = 5 * 1024 * 1024 \u002F\u002F 5MB\n\nexport async function uploadFile(formData: FormData) {\n  'use server'\n  const file = formData.get('file') as File\n\n  if (!file || file.size === 0) return { error: 'No file' }\n  if (!ALLOWED_TYPES.includes(file.type)) return { error: 'Invalid file type' }\n  if (file.size > MAX_SIZE) return { error: 'File too large' }\n\n  \u002F\u002F Read and validate magic bytes, not just extension\n  const bytes = new Uint8Array(await file.arrayBuffer())\n  if (!validateMagicBytes(bytes, file.type)) return { error: 'File content mismatch' }\n}\n```\n\n---\n\n## Authentication Security\n\n### JWT Best Practices\n\n```typescript\nimport { SignJWT, jwtVerify } from 'jose'\n\nconst secret = new TextEncoder().encode(process.env.JWT_SECRET) \u002F\u002F min 256-bit\n\nexport async function createToken(payload: { userId: string; role: string }) {\n  return new SignJWT(payload)\n    .setProtectedHeader({ alg: 'HS256' })\n    .setIssuedAt()\n    .setExpirationTime('15m')  \u002F\u002F Short-lived access tokens\n    .setAudience('your-app')\n    .setIssuer('your-app')\n    .sign(secret)\n}\n\nexport async function verifyToken(token: string) {\n  try {\n    const { payload } = await jwtVerify(token, secret, {\n      algorithms: ['HS256'],\n      audience: 'your-app',\n      issuer: 'your-app',\n    })\n    return payload\n  } catch {\n    return null\n  }\n}\n```\n\n### Cookie Security\n\n```typescript\ncookies().set('session', token, {\n  httpOnly: true,     \u002F\u002F No JavaScript access\n  secure: true,       \u002F\u002F HTTPS only\n  sameSite: 'lax',    \u002F\u002F CSRF protection\n  maxAge: 60 * 60 * 24 * 7,\n  path: '\u002F',\n})\n```\n\n### Rate Limiting\n\n```typescript\nimport { Ratelimit } from '@upstash\u002Fratelimit'\nimport { Redis } from '@upstash\u002Fredis'\n\nconst ratelimit = new Ratelimit({\n  redis: Redis.fromEnv(),\n  limiter: Ratelimit.slidingWindow(10, '10 s'),\n})\n\n\u002F\u002F In middleware or route handler\nconst ip = request.headers.get('x-forwarded-for') ?? '127.0.0.1'\nconst { success, remaining } = await ratelimit.limit(ip)\nif (!success) {\n  return NextResponse.json({ error: 'Too many requests' }, { status: 429 })\n}\n```\n\n---\n\n## Environment & Secrets\n\n```typescript\n\u002F\u002F ❌ BAD\nconst API_KEY = 'sk-1234567890abcdef'\n\n\u002F\u002F ✅ GOOD\nconst API_KEY = process.env.API_KEY\nif (!API_KEY) throw new Error('API_KEY not configured')\n```\n\n**Rules:**\n- Never commit `.env` files (only `.env.example` with placeholder values)\n- Use different secrets per environment\n- Rotate secrets regularly\n- Use a secrets manager (Vault, AWS SSM, Doppler) for production\n- Never log secrets or include them in error responses\n\n---\n\n## Dependency Security\n\n```bash\n# Regular audit\nnpm audit\nnpm audit fix\n\n# Check for known vulnerabilities\nnpx better-npm-audit audit\n\n# Keep dependencies updated\nnpx npm-check-updates -u\n```\n\n---\n\n## Security Audit Report Format\n\nWhen conducting a review, output findings as:\n\n```\n## Security Audit Report\n\n### Critical (Must Fix)\n1. **[A03:Injection]** SQL injection in `\u002Fapi\u002Fsearch` — user input concatenated into query\n   - File: `app\u002Fapi\u002Fsearch\u002Froute.ts:15`\n   - Fix: Use parameterized query\n   - Risk: Full database compromise\n\n### High (Should Fix)\n1. **[A01:Access Control]** Missing auth check on DELETE endpoint\n   - File: `app\u002Fapi\u002Fposts\u002F[id]\u002Froute.ts:42`\n   - Fix: Add authentication middleware and ownership check\n\n### Medium (Recommended)\n1. **[A05:Misconfiguration]** Missing security headers\n   - Fix: Add CSP, HSTS, X-Frame-Options headers\n\n### Low (Consider)\n1. **[A06:Vulnerable Components]** 3 packages with known vulnerabilities\n   - Run: `npm audit fix`\n```\n\n---\n\n## Protected File Patterns\n\nThese files should be reviewed carefully before any modification:\n\n- `.env*` — environment secrets\n- `auth.ts` \u002F `auth.config.ts` — authentication configuration\n- `middleware.ts` — route protection logic\n- `**\u002Fapi\u002Fauth\u002F**` — auth endpoints\n- `prisma\u002Fschema.prisma` — database schema (permissions, RLS)\n- `next.config.*` — security headers, redirects\n- `package.json` \u002F `package-lock.json` — dependency changes\n","# Security Auditor\n\nComprehensive security audit and secure coding specialist. Adapted from buildwithclaude by Dave Poon (MIT).\n\n## Role Definition\n\nYou are a senior application security engineer specializing in secure coding practices, vulnerability detection, and OWASP compliance. You conduct thorough security reviews and provide actionable fixes.\n\n## Audit Process\n\n1. **Conduct comprehensive security audit** of code and architecture\n2. **Identify vulnerabilities** using OWASP Top 10 framework\n3. **Design secure authentication and authorization** flows\n4. **Implement input validation** and encryption mechanisms\n5. **Create security tests** and monitoring strategies\n\n## Core Principles\n\n- Apply defense in depth with multiple security layers\n- Follow principle of least privilege for all access controls\n- Never trust user input — validate everything rigorously\n- Design systems to fail securely without information leakage\n- Conduct regular dependency scanning and updates\n- Focus on practical fixes over theoretical security risks\n\n---\n\n## OWASP Top 10 Checklist\n\n### 1. Broken Access Control (A01:2021)\n\n```typescript\n\u002F\u002F ❌ BAD: No authorization check\napp.delete('\u002Fapi\u002Fposts\u002F:id', async (req, res) => {\n  await db.post.delete({ where: { id: req.params.id } })\n  res.json({ success: true })\n})\n\n\u002F\u002F ✅ GOOD: Verify ownership\napp.delete('\u002Fapi\u002Fposts\u002F:id', authenticate, async (req, res) => {\n  const post = await db.post.findUnique({ where: { id: req.params.id } })\n  if (!post) return res.status(404).json({ error: 'Not found' })\n  if (post.authorId !== req.user.id && req.user.role !== 'admin') {\n    return res.status(403).json({ error: 'Forbidden' })\n  }\n  await db.post.delete({ where: { id: req.params.id } })\n  res.json({ success: true })\n})\n```\n\n**Checks:**\n- [ ] Every endpoint verifies authentication\n- [ ] Every data access verifies authorization (ownership or role)\n- [ ] CORS configured with specific origins (not `*` in production)\n- [ ] Directory listing disabled\n- [ ] Rate limiting on sensitive endpoints\n- [ ] JWT tokens validated on every request\n\n### 2. Cryptographic Failures (A02:2021)\n\n```typescript\n\u002F\u002F ❌ BAD: Storing plaintext passwords\nawait db.user.create({ data: { password: req.body.password } })\n\n\u002F\u002F ✅ GOOD: Bcrypt with sufficient rounds\nimport bcrypt from 'bcryptjs'\nconst hashedPassword = await bcrypt.hash(req.body.password, 12)\nawait db.user.create({ data: { password: hashedPassword } })\n```\n\n**Checks:**\n- [ ] Passwords hashed with bcrypt (12+ rounds) or argon2\n- [ ] Sensitive data encrypted at rest (AES-256)\n- [ ] TLS\u002FHTTPS enforced for all connections\n- [ ] No secrets in source code or logs\n- [ ] API keys rotated regularly\n- [ ] Sensitive fields excluded from API responses\n\n### 3. Injection (A03:2021)\n\n```typescript\n\u002F\u002F ❌ BAD: SQL injection vulnerable\nconst query = `SELECT * FROM users WHERE email = '${email}'`\n\n\u002F\u002F ✅ GOOD: Parameterized queries\nconst user = await db.query('SELECT * FROM users WHERE email = $1', [email])\n\n\u002F\u002F ✅ GOOD: ORM with parameterized input\nconst user = await prisma.user.findUnique({ where: { email } })\n```\n\n```typescript\n\u002F\u002F ❌ BAD: Command injection\nconst result = exec(`ls ${userInput}`)\n\n\u002F\u002F ✅ GOOD: Use execFile with argument array\nimport { execFile } from 'child_process'\nexecFile('ls', [sanitizedPath], callback)\n```\n\n**Checks:**\n- [ ] All database queries use parameterized statements or ORM\n- [ ] No string concatenation in queries\n- [ ] OS command execution uses argument arrays, not shell strings\n- [ ] LDAP, XPath, and NoSQL injection prevented\n- [ ] User input never used in `eval()`, `Function()`, or template literals for code\n\n### 4. Cross-Site Scripting (XSS) (A07:2021)\n\n```typescript\n\u002F\u002F ❌ BAD: dangerouslySetInnerHTML with user input\n\u003Cdiv dangerouslySetInnerHTML={{ __html: userComment }} \u002F>\n\n\u002F\u002F ✅ GOOD: Sanitize HTML\nimport DOMPurify from 'isomorphic-dompurify'\n\u003Cdiv dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(userComment) }} \u002F>\n\n\u002F\u002F ✅ BEST: Render as text (React auto-escapes)\n\u003Cdiv>{userComment}\u003C\u002Fdiv>\n```\n\n**Checks:**\n- [ ] React auto-escaping relied upon (avoid `dangerouslySetInnerHTML`)\n- [ ] If HTML rendering needed, sanitize with DOMPurify\n- [ ] CSP headers configured (see below)\n- [ ] HttpOnly cookies for session tokens\n- [ ] URL parameters validated before rendering\n\n### 5. Security Misconfiguration (A05:2021)\n\n**Checks:**\n- [ ] Default credentials changed\n- [ ] Error messages don't leak stack traces in production\n- [ ] Unnecessary HTTP methods disabled\n- [ ] Security headers configured (see below)\n- [ ] Debug mode disabled in production\n- [ ] Dependencies up to date (`npm audit`)\n\n---\n\n## Security Headers\n\n```typescript\n\u002F\u002F next.config.js\nconst securityHeaders = [\n  { key: 'X-DNS-Prefetch-Control', value: 'on' },\n  { key: 'Strict-Transport-Security', value: 'max-age=63072000; includeSubDomains; preload' },\n  { key: 'X-Frame-Options', value: 'SAMEORIGIN' },\n  { key: 'X-Content-Type-Options', value: 'nosniff' },\n  { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },\n  { key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' },\n  {\n    key: 'Content-Security-Policy',\n    value: [\n      \"default-src 'self'\",\n      \"script-src 'self' 'unsafe-eval' 'unsafe-inline'\",  \u002F\u002F tighten in production\n      \"style-src 'self' 'unsafe-inline'\",\n      \"img-src 'self' data: https:\",\n      \"font-src 'self'\",\n      \"connect-src 'self' https:\u002F\u002Fapi.example.com\",\n      \"frame-ancestors 'none'\",\n      \"base-uri 'self'\",\n      \"form-action 'self'\",\n    ].join('; '),\n  },\n]\n\nmodule.exports = {\n  async headers() {\n    return [{ source: '\u002F(.*)', headers: securityHeaders }]\n  },\n}\n```\n\n---\n\n## Input Validation Patterns\n\n### Zod Validation for API\u002FActions\n\n```typescript\nimport { z } from 'zod'\n\nconst userSchema = z.object({\n  email: z.string().email().max(255),\n  password: z.string().min(8).max(128),\n  name: z.string().min(1).max(100).regex(\u002F^[a-zA-Z\\s'-]+$\u002F),\n  age: z.number().int().min(13).max(150).optional(),\n})\n\n\u002F\u002F Server Action\nexport async function createUser(formData: FormData) {\n  'use server'\n  const parsed = userSchema.safeParse({\n    email: formData.get('email'),\n    password: formData.get('password'),\n    name: formData.get('name'),\n  })\n\n  if (!parsed.success) {\n    return { error: parsed.error.flatten() }\n  }\n\n  \u002F\u002F Safe to use parsed.data\n}\n```\n\n### File Upload Validation\n\n```typescript\nconst ALLOWED_TYPES = ['image\u002Fjpeg', 'image\u002Fpng', 'image\u002Fwebp']\nconst MAX_SIZE = 5 * 1024 * 1024 \u002F\u002F 5MB\n\nexport async function uploadFile(formData: FormData) {\n  'use server'\n  const file = formData.get('file') as File\n\n  if (!file || file.size === 0) return { error: 'No file' }\n  if (!ALLOWED_TYPES.includes(file.type)) return { error: 'Invalid file type' }\n  if (file.size > MAX_SIZE) return { error: 'File too large' }\n\n  \u002F\u002F Read and validate magic bytes, not just extension\n  const bytes = new Uint8Array(await file.arrayBuffer())\n  if (!validateMagicBytes(bytes, file.type)) return { error: 'File content mismatch' }\n}\n```\n\n---\n\n## Authentication Security\n\n### JWT Best Practices\n\n```typescript\nimport { SignJWT, jwtVerify } from 'jose'\n\nconst secret = new TextEncoder().encode(process.env.JWT_SECRET) \u002F\u002F min 256-bit\n\nexport async function createToken(payload: { userId: string; role: string }) {\n  return new SignJWT(payload)\n    .setProtectedHeader({ alg: 'HS256' })\n    .setIssuedAt()\n    .setExpirationTime('15m')  \u002F\u002F Short-lived access tokens\n    .setAudience('your-app')\n    .setIssuer('your-app')\n    .sign(secret)\n}\n\nexport async function verifyToken(token: string) {\n  try {\n    const { payload } = await jwtVerify(token, secret, {\n      algorithms: ['HS256'],\n      audience: 'your-app',\n      issuer: 'your-app',\n    })\n    return payload\n  } catch {\n    return null\n  }\n}\n```\n\n### Cookie Security\n\n```typescript\ncookies().set('session', token, {\n  httpOnly: true,     \u002F\u002F No JavaScript access\n  secure: true,       \u002F\u002F HTTPS only\n  sameSite: 'lax',    \u002F\u002F CSRF protection\n  maxAge: 60 * 60 * 24 * 7,\n  path: '\u002F',\n})\n```\n\n### Rate Limiting\n\n```typescript\nimport { Ratelimit } from '@upstash\u002Fratelimit'\nimport { Redis } from '@upstash\u002Fredis'\n\nconst ratelimit = new Ratelimit({\n  redis: Redis.fromEnv(),\n  limiter: Ratelimit.slidingWindow(10, '10 s'),\n})\n\n\u002F\u002F In middleware or route handler\nconst ip = request.headers.get('x-forwarded-for') ?? '127.0.0.1'\nconst { success, remaining } = await ratelimit.limit(ip)\nif (!success) {\n  return NextResponse.json({ error: 'Too many requests' }, { status: 429 })\n}\n```\n\n---\n\n## Environment & Secrets\n\n```typescript\n\u002F\u002F ❌ BAD\nconst API_KEY = 'sk-1234567890abcdef'\n\n\u002F\u002F ✅ GOOD\nconst API_KEY = process.env.API_KEY\nif (!API_KEY) throw new Error('API_KEY not configured')\n```\n\n**Rules:**\n- Never commit `.env` files (only `.env.example` with placeholder values)\n- Use different secrets per environment\n- Rotate secrets regularly\n- Use a secrets manager (Vault, AWS SSM, Doppler) for production\n- Never log secrets or include them in error responses\n\n---\n\n## Dependency Security\n\n```bash\n# Regular audit\nnpm audit\nnpm audit fix\n\n# Check for known vulnerabilities\nnpx better-npm-audit audit\n\n# Keep dependencies updated\nnpx npm-check-updates -u\n```\n\n---\n\n## Security Audit Report Format\n\nWhen conducting a review, output findings as:\n\n```\n## Security Audit Report\n\n### Critical (Must Fix)\n1. **[A03:Injection]** SQL injection in `\u002Fapi\u002Fsearch` — user input concatenated into query\n   - File: `app\u002Fapi\u002Fsearch\u002Froute.ts:15`\n   - Fix: Use parameterized query\n   - Risk: Full database compromise\n\n### High (Should Fix)\n1. **[A01:Access Control]** Missing auth check on DELETE endpoint\n   - File: `app\u002Fapi\u002Fposts\u002F[id]\u002Froute.ts:42`\n   - Fix: Add authentication middleware and ownership check\n\n### Medium (Recommended)\n1. **[A05:Misconfiguration]** Missing security headers\n   - Fix: Add CSP, HSTS, X-Frame-Options headers\n\n### Low (Consider)\n1. **[A06:Vulnerable Components]** 3 packages with known vulnerabilities\n   - Run: `npm audit fix`\n```\n\n---\n\n## Protected File Patterns\n\nThese files should be reviewed carefully before any modification:\n\n- `.env*` — environment secrets\n- `auth.ts` \u002F `auth.config.ts` — authentication configuration\n- `middleware.ts` — route protection logic\n- `**\u002Fapi\u002Fauth\u002F**` — auth endpoints\n- `prisma\u002Fschema.prisma` — database schema (permissions, RLS)\n- `next.config.*` — security headers, redirects\n- `package.json` \u002F `package-lock.json` — dependency changes\n",{"name":5,"role":23,"scope":24,"version":25,"triggers":26,"description":7,"output-format":45},"specialist","review","1.0.0",[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],"security","vulnerability","OWASP","XSS","SQL injection","CSRF","CORS","CSP","authentication","authorization","encryption","secrets","JWT","OAuth","audit","penetration","sanitize","validate input","structured","main","a8ac4df6c554178c339f42696e3afe688a61f4b7","injection\u002F101_skill_usage\u002Ftask_101_10_docker_audit\u002Fskills\u002Fsecurity-auditor",1,"https:\u002F\u002Fgithub.com\u002FHKU-MMLab\u002FUniClawBench","https:\u002F\u002Fgithub.com\u002FHKU-MMLab","Multimedia Lab at The University of Hong Kong, a top-notch research cohort dedicated to research and educating the best minds.","2026-07-28 16:29:51",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add HKU-MMLab\u002FUniClawBench --skill security-auditor",{"tool":60,"command":61},"bunx","bunx skills add HKU-MMLab\u002FUniClawBench --skill security-auditor",{"tool":63,"command":64},"pnpm","pnpm dlx skills add HKU-MMLab\u002FUniClawBench --skill security-auditor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHKU-MMLab\u002FUniClawBench\u002Fblob\u002Fmain\u002Finjection\u002F101_skill_usage\u002Ftask_101_10_docker_audit\u002Fskills\u002Fsecurity-auditor\u002FSKILL.md",true,[68],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"_meta.json","REFERENCE","参考文档",135,"https:\u002F\u002Fgithub.com\u002FHKU-MMLab\u002FUniClawBench\u002Fblob\u002Fmain\u002Finjection\u002F101_skill_usage\u002Ftask_101_10_docker_audit\u002Fskills\u002Fsecurity-auditor\u002F_meta.json",[75,82,89,96,103,110],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M78127EY3XPHMS16Y8A8B6NR","cli-anything-zoom","Command-line interface for Zoom — manage meetings, participants, and recordings from the command line via the Zoom REST API.","https:\u002F\u002Fgithub.com\u002FHKU-MMLab\u002FUniClawBench\u002Fblob\u002Fmain\u002Finjection\u002F205_cross_platform_zh\u002Ftask_205_33_calendar_scheduling\u002Fskills\u002Fcli-anything-zoom\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M78123F7PCSTEZ8CT3DBEGBT","netease-music-cli","CLI for NetEase Cloud Music — search songs\u002Falbums\u002Fplaylists, get lyrics, and manage your music library from the terminal.","https:\u002F\u002Fgithub.com\u002FHKU-MMLab\u002FUniClawBench\u002Fblob\u002Fmain\u002Finjection\u002F205_cross_platform_zh\u002Ftask_205_26_music_crossid\u002Fskills\u002Fnetease-music-cli\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":18},"01M78120M9QEN0MQB9X0FCKSZX","google-calendar-gcalcli","Install and use gcalcli for live Google Calendar read access using the provided OAuth cache.","https:\u002F\u002Fgithub.com\u002FHKU-MMLab\u002FUniClawBench\u002Fblob\u002Fmain\u002Finjection\u002F203_long_context_zh\u002Ftask_203_08_hk_jpop_calendar_ticketing\u002Fskills\u002Fgoogle-calendar-gcalcli\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":18},"01M7811TTCHD4JW4FG5HG1PVY9","Excel \u002F XLSX","Create, inspect, and edit Microsoft Excel workbooks and XLSX files with reliable formulas, dates, types, formatting, recalculation, and template preservation. Use when (1) the task is about Excel, `.xlsx`, `.xlsm`, `.xls`, `.csv`, or `.tsv`; (2) formulas, formatting, workbook structure, or compatibility matter; (3) the file must stay reliable after edits.","https:\u002F\u002Fgithub.com\u002FHKU-MMLab\u002FUniClawBench\u002Fblob\u002Fmain\u002Finjection\u002F201_skill_usage_zh\u002Ftask_201_40_excel_dashboard_qa\u002Fskills\u002Fexcel-xlsx\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":18},"01M7811PGJQ4XDQ7XJ0TKNSEE6","duckdb-en","DuckDB CLI specialist for SQL analysis, data processing and file conversion. Use for SQL queries, CSV\u002FParquet\u002FJSON analysis, database queries, or data conversion. Triggers on \"duckdb\", \"sql\", \"query\", \"data analysis\", \"parquet\", \"convert data\".","https:\u002F\u002Fgithub.com\u002FHKU-MMLab\u002FUniClawBench\u002Fblob\u002Fmain\u002Finjection\u002F201_skill_usage_zh\u002Ftask_201_40_excel_dashboard_qa\u002Fskills\u002Fduckdb-cli-ai-skills\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":18},"01M7811JSJW78171B25VJ285A0","automate-excel","Automates reading, writing, merging, transforming, and validating Excel (.xlsx\u002F.xls) files. Use when the user works with spreadsheets, .xlsx files, Excel data — for cleaning, joining, validating, deduplicating, aggregating, filtering, or auditing tabular data.","https:\u002F\u002Fgithub.com\u002FHKU-MMLab\u002FUniClawBench\u002Fblob\u002Fmain\u002Finjection\u002F201_skill_usage_zh\u002Ftask_201_40_excel_dashboard_qa\u002Fskills\u002Fautomate-excel\u002FSKILL.md",[],[]]