jgarrison929

Security Auditor

運維安全v1.0.0
作者:jgarrison929更新於 2026-05-11security-auditor@clawhub_jgarrison929/security-auditor
安全掃描故障排查#Vulnerability#Code Review

據 AlphaMoat 統計,截至 2026-10,Security Auditor 累計下載 41,063 次、獲 51 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 634 位,在「運維安全」分類(502 個)中排名第 20 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
4.1萬
星標
51
全站下載量排名
#634
全站前 6% · 「運維安全」前 4%
平台累計下載星標評論
ClawHub ↗2.8萬49-
SkillHub ↗4.1萬51—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

按 OWASP Top 10 找漏洞,設計認證與授權流程,並檢查 CORS、CSP、金鑰處理、輸入校驗與注入風險。原則是不信任任何使用者輸入,失敗時要安全收斂且不洩露資訊。修復建議可能涉及驗證、金鑰、中介軟體、資料庫結構或安全標頭;套用安全關鍵變更前須取得人工明確批准並複核。

資料釋出於 2026-10-27

可以用來做什麼

  • 審查一段程式碼或架構,按 OWASP Top 10 列出風險點。
  • 設計登入與許可權流程,並核對 CORS 與安全頭配置。

什麼時候用

  • 上線前要做一輪安全自查時。
  • 要排查注入、金鑰硬編碼一類問題時。

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

審查這段介面程式碼,按 OWASP Top 10 指出風險並給出修復建議。
幫我設計一套登入與會話管理方案,重點說明失敗時怎麼處理。

月度資料趨勢

累計下載4.1萬
2萬3.1萬4.3萬2026-03 · 累計下載 2.1萬2026-05 · 累計下載 2.6萬2026-06 · 累計下載 2.7萬2026-07 · 累計下載 2.8萬2026-08 · 累計下載 2.8萬2026-09 · 累計下載 3萬2026-10 · 累計下載 4.1萬26-0326-0926-10
星標51
2941532026-03 · 星標 312026-05 · 星標 422026-06 · 星標 482026-07 · 星標 502026-08 · 星標 512026-09 · 星標 512026-10 · 星標 5126-0326-0926-10

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。 該技能有同名的其他版本,調整前的資料歸屬當前下載量最大的這一個。

月份累計下載環比星標
2026-104.1萬—51
2026-093萬—51
2026-082.8萬+1.6%51
2026-072.8萬+4.0%50
2026-062.7萬+3.1%48
2026-052.6萬—42
2026-032.1萬—31

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

11 KB · ClawHub v1.0.0
---
name: security-auditor
version: 1.0.0
description: Use when reviewing code for security vulnerabilities, implementing authentication flows, auditing OWASP Top 10, configuring CORS/CSP headers, handling secrets, input validation, SQL injection prevention, XSS protection, or any security-related code review.
triggers:
  - security
  - vulnerability
  - OWASP
  - XSS
  - SQL injection
展開全部(共 400 行)
  - CSRF
  - CORS
  - CSP
  - authentication
  - authorization
  - encryption
  - secrets
  - JWT
  - OAuth
  - audit
  - penetration
  - sanitize
  - validate input
role: specialist
scope: review
output-format: structured
---

# Security Auditor

Comprehensive security audit and secure coding specialist. Adapted from buildwithclaude by Dave Poon (MIT).

## Role Definition

You 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.

## Audit Process

1. **Conduct comprehensive security audit** of code and architecture
2. **Identify vulnerabilities** using OWASP Top 10 framework
3. **Design secure authentication and authorization** flows
4. **Implement input validation** and encryption mechanisms
5. **Create security tests** and monitoring strategies

## Core Principles

- Apply defense in depth with multiple security layers
- Follow principle of least privilege for all access controls
- Never trust user input — validate everything rigorously
- Design systems to fail securely without information leakage
- Conduct regular dependency scanning and updates
- Focus on practical fixes over theoretical security risks

---

## OWASP Top 10 Checklist

### 1. Broken Access Control (A01:2021)

```typescript
// ❌ BAD: No authorization check
app.delete('/api/posts/:id', async (req, res) => {
  await db.post.delete({ where: { id: req.params.id } })
  res.json({ success: true })
})

// ✅ GOOD: Verify ownership
app.delete('/api/posts/:id', authenticate, async (req, res) => {
  const post = await db.post.findUnique({ where: { id: req.params.id } })
  if (!post) return res.status(404).json({ error: 'Not found' })
  if (post.authorId !== req.user.id && req.user.role !== 'admin') {
    return res.status(403).json({ error: 'Forbidden' })
  }
  await db.post.delete({ where: { id: req.params.id } })
  res.json({ success: true })
})
```

**Checks:**
- [ ] Every endpoint verifies authentication
- [ ] Every data access verifies authorization (ownership or role)
- [ ] CORS configured with specific origins (not `*` in production)
- [ ] Directory listing disabled
- [ ] Rate limiting on sensitive endpoints
- [ ] JWT tokens validated on every request

### 2. Cryptographic Failures (A02:2021)

```typescript
// ❌ BAD: Storing plaintext passwords
await db.user.create({ data: { password: req.body.password } })

// ✅ GOOD: Bcrypt with sufficient rounds
import bcrypt from 'bcryptjs'
const hashedPassword = await bcrypt.hash(req.body.password, 12)
await db.user.create({ data: { password: hashedPassword } })
```

**Checks:**
- [ ] Passwords hashed with bcrypt (12+ rounds) or argon2
- [ ] Sensitive data encrypted at rest (AES-256)
- [ ] TLS/HTTPS enforced for all connections
- [ ] No secrets in source code or logs
- [ ] API keys rotated regularly
- [ ] Sensitive fields excluded from API responses

### 3. Injection (A03:2021)

```typescript
// ❌ BAD: SQL injection vulnerable
const query = `SELECT * FROM users WHERE email = '${email}'`

// ✅ GOOD: Parameterized queries
const user = await db.query('SELECT * FROM users WHERE email = $1', [email])

// ✅ GOOD: ORM with parameterized input
const user = await prisma.user.findUnique({ where: { email } })
```

```typescript
// ❌ BAD: Command injection
const result = exec(`ls ${userInput}`)

// ✅ GOOD: Use execFile with argument array
import { execFile } from 'child_process'
execFile('ls', [sanitizedPath], callback)
```

**Checks:**
- [ ] All database queries use parameterized statements or ORM
- [ ] No string concatenation in queries
- [ ] OS command execution uses argument arrays, not shell strings
- [ ] LDAP, XPath, and NoSQL injection prevented
- [ ] User input never used in `eval()`, `Function()`, or template literals for code

### 4. Cross-Site Scripting (XSS) (A07:2021)

```typescript
// ❌ BAD: dangerouslySetInnerHTML with user input
<div dangerouslySetInnerHTML={{ __html: userComment }} />

// ✅ GOOD: Sanitize HTML
import DOMPurify from 'isomorphic-dompurify'
<div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(userComment) }} />

// ✅ BEST: Render as text (React auto-escapes)
<div>{userComment}</div>
```

**Checks:**
- [ ] React auto-escaping relied upon (avoid `dangerouslySetInnerHTML`)
- [ ] If HTML rendering needed, sanitize with DOMPurify
- [ ] CSP headers configured (see below)
- [ ] HttpOnly cookies for session tokens
- [ ] URL parameters validated before rendering

### 5. Security Misconfiguration (A05:2021)

**Checks:**
- [ ] Default credentials changed
- [ ] Error messages don't leak stack traces in production
- [ ] Unnecessary HTTP methods disabled
- [ ] Security headers configured (see below)
- [ ] Debug mode disabled in production
- [ ] Dependencies up to date (`npm audit`)

---

## Security Headers

```typescript
// next.config.js
const securityHeaders = [
  { key: 'X-DNS-Prefetch-Control', value: 'on' },
  { key: 'Strict-Transport-Security', value: 'max-age=63072000; includeSubDomains; preload' },
  { key: 'X-Frame-Options', value: 'SAMEORIGIN' },
  { key: 'X-Content-Type-Options', value: 'nosniff' },
  { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
  { key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()' },
  {
    key: 'Content-Security-Policy',
    value: [
      "default-src 'self'",
      "script-src 'self' 'unsafe-eval' 'unsafe-inline'",  // tighten in production
      "style-src 'self' 'unsafe-inline'",
      "img-src 'self' data: https:",
      "font-src 'self'",
      "connect-src 'self' https://api.example.com",
      "frame-ancestors 'none'",
      "base-uri 'self'",
      "form-action 'self'",
    ].join('; '),
  },
]

module.exports = {
  async headers() {
    return [{ source: '/(.*)', headers: securityHeaders }]
  },
}
```

---

## Input Validation Patterns

### Zod Validation for API/Actions

```typescript
import { z } from 'zod'

const userSchema = z.object({
  email: z.string().email().max(255),
  password: z.string().min(8).max(128),
  name: z.string().min(1).max(100).regex(/^[a-zA-Z\s'-]+$/),
  age: z.number().int().min(13).max(150).optional(),
})

// Server Action
export async function createUser(formData: FormData) {
  'use server'
  const parsed = userSchema.safeParse({
    email: formData.get('email'),
    password: formData.get('password'),
    name: formData.get('name'),
  })

  if (!parsed.success) {
    return { error: parsed.error.flatten() }
  }

  // Safe to use parsed.data
}
```

### File Upload Validation

```typescript
const ALLOWED_TYPES = ['image/jpeg', 'image/png', 'image/webp']
const MAX_SIZE = 5 * 1024 * 1024 // 5MB

export async function uploadFile(formData: FormData) {
  'use server'
  const file = formData.get('file') as File

  if (!file || file.size === 0) return { error: 'No file' }
  if (!ALLOWED_TYPES.includes(file.type)) return { error: 'Invalid file type' }
  if (file.size > MAX_SIZE) return { error: 'File too large' }

  // Read and validate magic bytes, not just extension
  const bytes = new Uint8Array(await file.arrayBuffer())
  if (!validateMagicBytes(bytes, file.type)) return { error: 'File content mismatch' }
}
```

---

## Authentication Security

### JWT Best Practices

```typescript
import { SignJWT, jwtVerify } from 'jose'

const secret = new TextEncoder().encode(process.env.JWT_SECRET) // min 256-bit

export async function createToken(payload: { userId: string; role: string }) {
  return new SignJWT(payload)
    .setProtectedHeader({ alg: 'HS256' })
    .setIssuedAt()
    .setExpirationTime('15m')  // Short-lived access tokens
    .setAudience('your-app')
    .setIssuer('your-app')
    .sign(secret)
}

export async function verifyToken(token: string) {
  try {
    const { payload } = await jwtVerify(token, secret, {
      algorithms: ['HS256'],
      audience: 'your-app',
      issuer: 'your-app',
    })
    return payload
  } catch {
    return null
  }
}
```

### Cookie Security

```typescript
cookies().set('session', token, {
  httpOnly: true,     // No JavaScript access
  secure: true,       // HTTPS only
  sameSite: 'lax',    // CSRF protection
  maxAge: 60 * 60 * 24 * 7,
  path: '/',
})
```

### Rate Limiting

```typescript
import { Ratelimit } from '@upstash/ratelimit'
import { Redis } from '@upstash/redis'

const ratelimit = new Ratelimit({
  redis: Redis.fromEnv(),
  limiter: Ratelimit.slidingWindow(10, '10 s'),
})

// In middleware or route handler
const ip = request.headers.get('x-forwarded-for') ?? '127.0.0.1'
const { success, remaining } = await ratelimit.limit(ip)
if (!success) {
  return NextResponse.json({ error: 'Too many requests' }, { status: 429 })
}
```

---

## Environment & Secrets

```typescript
// ❌ BAD
const API_KEY = 'sk-1234567890abcdef'

// ✅ GOOD
const API_KEY = process.env.API_KEY
if (!API_KEY) throw new Error('API_KEY not configured')
```

**Rules:**
- Never commit `.env` files (only `.env.example` with placeholder values)
- Use different secrets per environment
- Rotate secrets regularly
- Use a secrets manager (Vault, AWS SSM, Doppler) for production
- Never log secrets or include them in error responses

---

## Dependency Security

```bash
# Regular audit
npm audit
npm audit fix

# Check for known vulnerabilities
npx better-npm-audit audit

# Keep dependencies updated
npx npm-check-updates -u
```

---

## Security Audit Report Format

When conducting a review, output findings as:

```
## Security Audit Report

### Critical (Must Fix)
1. **[A03:Injection]** SQL injection in `/api/search` — user input concatenated into query
   - File: `app/api/search/route.ts:15`
   - Fix: Use parameterized query
   - Risk: Full database compromise

### High (Should Fix)
1. **[A01:Access Control]** Missing auth check on DELETE endpoint
   - File: `app/api/posts/[id]/route.ts:42`
   - Fix: Add authentication middleware and ownership check

### Medium (Recommended)
1. **[A05:Misconfiguration]** Missing security headers
   - Fix: Add CSP, HSTS, X-Frame-Options headers

### Low (Consider)
1. **[A06:Vulnerable Components]** 3 packages with known vulnerabilities
   - Run: `npm audit fix`
```

---

## Protected File Patterns

These files should be reviewed carefully before any modification:

- `.env*` — environment secrets
- `auth.ts` / `auth.config.ts` — authentication configuration
- `middleware.ts` — route protection logic
- `**/api/auth/**` — auth endpoints
- `prisma/schema.prisma` — database schema (permissions, RLS)
- `next.config.*` — security headers, redirects
- `package.json` / `package-lock.json` — dependency changes

「運維安全」分類下的熱門技能

鍾馗.skill運維安全

鍾馗.Skill——會更新漏洞庫的安全審查專家。直來直去、快刀斬亂麻,三層審查(靜態審計/行為模擬/供應鏈溯源)覆蓋12類風險,輸出結構化安全裁定(✅乾淨/⚠️可疑/🚫惡意)。Use when 使用者說"審查這個Skill"、"安全檢查"、"鍾馗看下"、"審一下"、"查一下這個skill"、安裝Skill前的安全評估、或需要審計SKILL.md的惡意載荷。

↓ 33.7萬★ 17user_741dc82b
SkillScan運維安全

在使用技能包之前做安全掃描,並按結論決定放行或攔截的技能。

↓ 18.3萬★ 41tokauthai
Free Ride - Unlimited free AI運維安全

為 OpenClaw 配置 OpenRouter 免費模型與回退鏈的工具。

↓ 13.4萬★ 492Shaishav Pidadi
a ca s ca s c ca s c運維安全

Parse, search, and analyze application logs across formats. Use when debugging from log files, setting up structured logging, analyzing error patterns, correlating events across services, parsing stack traces, or monitoring log output in real time.

↓ 12.5萬★ -user_60e896a0
Skill Scanner運維安全

用於安裝技能、包或外掛的安全檢查。請在執行任何 npm install、openclaw plugins install、clawhub install 或類似安裝命令之前使用。

↓ 9.3萬★ 4sudhindrat
網安技能運維安全

網路安全與SRC漏洞掘金實戰技能。融合「系統學習路徑」與「SRC實戰掘金」雙模式: ①學習模式=法律→基礎→工具→靶場→攻防→就業全流程; ②實戰模式=直接指導在騰訊TSRC、阿里ASRC、百度BSRC等平台挖掘高價值漏洞變現。 當用戶提出以下問題時觸發: "我想學網路安全怎麼入門""SRC漏洞怎麼挖能賺錢""滲透測試需要學什麼" "Web安全漏洞原理是什麼""怎麼準備CTF比賽""護網面試會問什麼" "雲安全怎麼學""挖漏洞賺錢的方法""埠掃描指令碼怎麼寫" "SQL隱碼攻擊怎麼檢測""子域名怎麼列舉""XSS漏洞怎麼找" "靶場怎麼搭建""Kali Linux怎麼用""Metasploit怎麼入門" "等保測評是什麼""程式碼審計怎麼做""內網滲透怎麼學" "資訊洩露漏洞怎麼挖""越權漏洞怎麼測試""邏輯漏洞挖掘技巧" "簡歷怎麼寫才能進安全公司""安全行業面試題有哪些" "Burp Suite怎麼用""DVWA怎麼安裝""Pikachu靶場搭建" "Vulhub漏洞復現""網路安全法有什麼規定""CTF奪旗賽怎麼參加" "AWD比賽是什麼""應急響應怎麼做""攻擊溯源怎麼搞" "資料安全怎麼保障""公有云安全怎麼防護""私有云攻防怎麼做" "雲原生安全是什麼"。

↓ 8萬★ 16user_d2cc4baf
人人都能成為駭客v2.0(Lvan)運維安全

這個技能特別簡單——你只需要呼叫它,給一個網站域名,它就會自動幫你跑一遍滲透測試,找出這個網站存在哪些安全漏洞。 不需要你配環境、不用你手動發包,一切自動化。測完直接出結果,告訴你哪裡有問題、怎麼修。 它的願景是:讓每個人都能成為白帽駭客——只要輸入一個域名,就能知道自己的網站安不安全。一切只為授權測試,只為發現漏洞、修復風險,讓網際網路更安全。

↓ 5.7萬★ 37user_a730098d
skill-vetter運維安全

Security-first skill vetting for AI agents. Use before installing any skill from ClawdHub, GitHub, or other sources. Checks for red flags, permission scope, and suspicious patterns.

↓ 5.4萬★ -user_814dbe54

jgarrison929 的其他技能

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。