[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FSSBNDA1TQ3RD0C47MYT51":3,"skill-same:01M6FSSBNDA1TQ3RD0C47MYT51":86},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":59,"commitSha":60,"skillDirectory":61,"forksCount":62,"repositoryHtmlUrl":63,"repositoryHomepageUrl":6,"ownerHtmlUrl":64,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":65,"install":66,"resources":79},"01M6FSSBNDA1TQ3RD0C47MYT51","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.","kbarbel640-del\u002Fskills","kbarbel640-del","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F255315490?v=4","01M6CJPPQGCCESXMG3K7BBGQ5J","01M6CJPPX2PB2BCZERFVM2C2B3",1,"MIT","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fjgarrison929\u002Fsecurity-auditor\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"security","security auditor","injection","headers","flows","Input Validation","input","secrets","vulnerability","csrf","xss","code review","owasp","encryption","audit","authentication","code","owasp top 10","sql","review","2026-11-10 10:12:30",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":43,"scope":37,"version":44,"triggers":45,"description":7,"output-format":58},"specialist","1.0.0",[18,26,46,47,48,49,50,51,33,52,31,25,53,54,32,55,56,57],"OWASP","XSS","SQL injection","CSRF","CORS","CSP","authorization","JWT","OAuth","penetration","sanitize","validate input","structured","main","e7e336ac628c3e3bd771aff1aaa469c93778f94a","skills\u002Fjgarrison929\u002Fsecurity-auditor",0,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del","2026-08-23 22:39:37",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":78},[68,71,74],{"tool":69,"command":70},"npx","npx skills add kbarbel640-del\u002Fskills --skill security-auditor",{"tool":72,"command":73},"bunx","bunx skills add kbarbel640-del\u002Fskills --skill security-auditor",{"tool":75,"command":76},"pnpm","pnpm dlx skills add kbarbel640-del\u002Fskills --skill security-auditor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fjgarrison929\u002Fsecurity-auditor\u002FSKILL.md",true,[80],{"path":81,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"_meta.json","REFERENCE","参考文档",290,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fjgarrison929\u002Fsecurity-auditor\u002F_meta.json",[87,113,137,155,160,180],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":38},"01M6G8J55967D6281ACMKAKTEQ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[],[94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112],"crowd prompting","prompting","api","with","tokens","domain","world","prompts","operations","instructions","text","tool","system","improve","productivity","marketplace","https","content","ai agents",{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":38},"01M6G8J0PKPAYVET6BWE8W4C26","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[],[120,96,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,101,136],"dilemm ai","arena","analyze","browser","openclaw agent","create","automation","browser automation","bot","openclaw","design","strategy","headless","compete","submit","matchmaking","use",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":38},"01M6G8HWAF3K9SW7NP3Z83CPJ6","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, or submitting paper reviews via API at http:\u002F\u002F150.158.152.82:8000.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Fweak-accept\u002FSKILL.md",[],[144,145,146,147,148,149,150,97,151,134,136,152,96,153,154],"arxiv paper reviews","reviews","arxiv","paper","crawler","papers","comments","fetch","read","http","via",{"skillNo":156,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":38},"01M6G8HQJ7N7WMY6YV7D7SSJ16","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[],[147,146,145,144,154,149,150,97,148,134,136,151,152,96,153],{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":38},"01M6G8HM95Y64JNVFC2HN4E2BG","git-summary","Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzweack\u002Fgit-summary\u002FSKILL.md",[],[167,168,169,170,171,172,173,174,175,176,177,178,179],"git","summary","git summary","commits","repository","win32","status","linux","contributors","true","quick","get","branches",{"skillNo":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":38},"01M6G8HGEGF05CNEJCGVYFSC4R","agent-constitution","Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fztsalexey\u002Fagent-constitution\u002FSKILL.md",[],[187,188,189,190,97,191,192,59,193,152,194,195,196,197,198,110,199,200,201],"agent constitution","constitution","contracts","tree","query","base","log","check","Rules","projects","compliance","actions","state","governance","github"]