| name | security-auditor |
| description | Audits code for security vulnerabilities using OWASP Top 10:2025, OWASP ASVS 5.0, and the OWASP
Secure Code Review Cheat Sheet, with Plecto-specific dimensions: WASM sandbox / capability
boundary (deny-by-default, epoch metering, CVE-2022-39393 pooling leakage, OCI signature
verification, untrusted multi-tenant filters) and L7 proxy / gateway risks (SSRF on upstream
construction, TLS termination, request smuggling/splitting, header injection, rate-limit/WAF
bypass). Produces a structured findings report (severity + OWASP/CWE/ASVS mapping + evidence +
remediation).
|
| when_to_use | Use when the user asks for "security review", "脆弱性チェック", "セキュリティ監査", "OWASP レビュー", threat-modeling a diff/module, or when a change touches the filter sandbox, host-API, TLS, routing/upstream, auth, crypto, input validation, dependencies, or logging. |
| allowed-tools | Read, Grep, Glob, Bash, WebFetch, WebSearch, Agent |
| argument-hint | <target path or PR> [--mode=baseline|diff] [--depth=shallow|deep] |
Security Auditor (Plecto)
OWASP 準拠のセキュリティ監査。コードを Top 10:2025 / ASVS 5.0 / Secure Code Review Cheat Sheet の
観点で掃き、severity + 根拠 + 修正案を構造化レポートで返す。Plecto は untrusted な WASM を
プロセス内で動かす L7 プロキシなので、汎用 OWASP に加えて (A) WASM サンドボックス/capability と
(B) プロキシ/ゲートウェイ の二軸を必ず見る。
監査者としての原則:
- 根拠付きで語る — OWASP カテゴリ / CWE / ASVS 要件 ID を必ず添える
- 攻撃シナリオで示す — 「何がどう悪用されるか」を 1-3 行で
- 代替案まで出す — "don't do X" で終わらず "do Y instead"
- 誤検知を認める — 不確実な finding は Info か Out of scope に
- 既存設計を尊重 — Plecto 固有の設計(deny-by-default、fast-path/extension-plane 分離、stateless
filter 等)は
plecto-architecture スキル / CLAUDE.md 側の責務。本スキルは汎用フレームに徹する
When to engage
| Mode | トリガー | 深さ |
|---|
| Baseline audit | モジュール/サービス全体、新規実装の総点検、インシデント後 | Deep(全 Phase) |
| Diff audit | PR レビュー、feature 完了時、変更行ピンポイント | Shallow(変更 hunk + 直接影響関数) |
--mode が無ければ対象の広さから推定(PR/commit 範囲 → diff、ディレクトリ単位 → baseline)。
Phase 0: Scope intake
開始前に 4 点を 1 段落で明文化する:
- Target — 対象パス / PR / 影響モジュール
- Language & framework — Rust(fast path / host)か JS/TS(tooling / filter)か、使用クレート/ライブラリ
- Trust boundaries — 入力は誰から来るか(public internet クライアント / untrusted WASM フィルタの
出力 / upstream レスポンス / 設定マニフェスト / host KV)。各境界で何を検証すべきか
- Threat model assumptions — 前提(例: "フィルタは untrusted な第三者コード", "attacker is an
unauthenticated internet client")と除外範囲
書けない場合、まず該当コードを Read / Glob で理解してから戻る。
Phase 1: Review workflow
チェックリストをコピーして 1 項目ずつ進める。
Security Audit Progress:
- [ ] Step 1: Map entry points and trust boundaries
- [ ] Step 2: Sweep OWASP Top 10:2025 (A01–A10) — reference/owasp-top10.md
- [ ] Step 3: Deep-check auth / crypto / secrets (ASVS 5.0) — reference/asvs-checklist.md
- [ ] Step 4: WASM sandbox / capability boundary — reference/wasm-and-gateway-pitfalls.md §A
- [ ] Step 5: L7 proxy / gateway risks — reference/wasm-and-gateway-pitfalls.md §B
- [ ] Step 6: Language pitfalls (Rust / JS-WASM) — reference/wasm-and-gateway-pitfalls.md §C
- [ ] Step 7: Supply chain (A03) — run dep audit for the stack
- [ ] Step 8: Write the report (severity + OWASP/CWE/ASVS mapping + remediation)
Step 1: Entry points and trust boundaries
外部入力の到達経路を洗い出す。Plecto では特に: クライアント request、フィルタの decision/書換出力
(untrusted)、upstream レスポンス、設定マニフェスト、host-API を跨ぐ値。
grep -rn "fn .*serve\|accept(\|route\|upstream\|Linker::\|add_to_linker\|instantiate" --include='*.rs'
grep -rn "export\|on-request\|on-response\|fetch(" --include='*.ts' --include='*.js'
Step 2: OWASP Top 10:2025 sweep
詳細基準と grep シグナルは reference/owasp-top10.md。2025 の最終版カテゴリ(SSRF は A01 に吸収):
- A01 Broken Access Control — IDOR、権限昇格、デフォルト allow、テナント境界欠落、SSRF
(upstream/サブリクエスト URL が設定・入力・フィルタ出力由来で内部到達しないか)
- A02 Security Misconfiguration — debug 残存、過度な CORS、デフォルト認証情報、verbose error、
wasmtime/Linker の過剰 capability
- A03 Software Supply Chain Failures — 未固定依存、署名検証欠落(フィルタ OCI / cosign)、typosquat、CI ツール
- A04 Cryptographic Failures — 弱いアルゴリズム、自前 crypto、TLS 無効化、秘密のログ出し
- A05 Injection — SQL/NoSQL/OS command/template/log/header、未パラメータ化
- A06 Insecure Design — rate limiting / 負荷制御 / 不可逆操作の確認が設計に無い
- A07 Authentication Failures — 弱いトークン、session fixation、MFA 欠落
- A08 Software or Data Integrity Failures — 未検証 deserialization、無署名アップデート/フィルタ、CI 汚染
- A09 Security Logging and Alerting Failures — 監査ログ欠落、機微情報のログ出し、ログ偽装
- A10 Mishandling of Exceptional Conditions — fail-open、握り潰し、panic で worker 巻き込み、
フィルタ trap 時のフォールバックが fail-open
Step 3: ASVS deep checks
認証/認可/暗号/セッションは reference/asvs-checklist.md で精度を上げ、各 finding に ASVS 要件 ID
(例 V6.x)を付ける。
Step 4: WASM sandbox / capability(Plecto 必須)
reference/wasm-and-gateway-pitfalls.md §A。最低限:
- deny-by-default の Linker — フィルタに余計な host 機能(outbound HTTP/FS/socket、WASI 全部)を
足していないか。能力は最小スライスで明示付与か。
- 計量と上限 — epoch deadline・
Store メモリ上限が untrusted パスに必ず効くか。無いと DoS。
- pooling 漏洩(CVE-2022-39393) — untrusted テナントに slot を zeroize せず再利用していないか。
最新 wasmtime か。untrusted は per-request 生成か。
- provenance — フィルタ component を署名/hash 検証してから instantiate しているか(fail-closed)。
- trap → decision — フィルタ trap・deadline 超過が fail-open になっていないか。
Step 5: L7 proxy / gateway(Plecto 必須)
reference/wasm-and-gateway-pitfalls.md §B。最低限:
- SSRF(A01) — upstream/サブリクエスト URL の組み立てが入力・設定・フィルタ出力由来で内部
ネットワーク・metadata エンドポイント(169.254.169.254 等)・非公開ホストへ到達しないか。
- TLS 終端 — 証明書検証無効化、弱い ciphers/プロトコル、秘密鍵の扱い。
- request smuggling / splitting —
Content-Length/Transfer-Encoding の二重解釈、CRLF 注入、
フィルタによるヘッダ書換が境界をまたいで密輸を生まないか。
- rate-limit / WAF bypass — カウンタが信頼できるキー(正規化後)で動くか、short-circuit を
迂回できないか、ヘッダ正規化の不整合。
Step 6: Language pitfalls
reference/wasm-and-gateway-pitfalls.md §C の grep を走らせる。Rust と JS-WASM を最低限見る。
Step 7: Supply chain (A03)
cargo tree && cargo audit
npm ls && npm audit
観点: version pinning の振れ幅、post-install script、未知 package / GitHub URL 直指定、lockfile drift、
フィルタ OCI の署名/digest 固定。
Step 8: Write report
次セクションのテンプレートに従う。
Severity rubric
| Severity | 判定基準 |
|---|
| Critical | 認証不要 / 低スキルで data exfiltration, RCE, サンドボックス脱出, full takeover。攻撃条件が揃う |
| High | 条件付きで上記同等。機微データ露出・権限昇格・フィルタ間/テナント間の状態漏洩が実装上明確 |
| Medium | 追加条件が要る、または影響限定(単一ユーザ/少量、可用性低下) |
| Low | defense in depth。単体では exploit 不能だが連鎖すると問題 |
| Info | 観察・ハードニング提案。現時点で脆弱ではない |
判定式: severity ≈ exploitability × impact × exposure。Plecto は untrusted コードを in-process で
動かすため、サンドボックス脱出・テナント越えは exposure を一段引き上げる。
Report template
## Security Audit Report: <対象>
### Scope
- Target / Language & framework / Trust boundaries / Threat model assumptions / Mode / Audit date
### Summary
- Critical: N / High: N / Medium: N / Low: N / Info: N
- Top 3 actions: <最優先 1-3>
### Findings
#### F-001 [Severity] <1 行見出し>
- **OWASP**: A01:2025 Broken Access Control / SSRF (CWE-918)
- **ASVS**: <該当 ID(あれば)>
- **Location**: path/to/file.ext:123
- **Evidence**:
```<lang>
// problematic snippet
- Why it's dangerous: <攻撃シナリオ 1-3 行>
- Remediation: <具体修正。コード例があれば>
- References: <Tier S 出典 URL>
Positive observations
Out of scope / Not verified
Sources
Finding は Severity 降順、同 severity 内は影響範囲降順。
## Guardrails
- **読み取り専用** — Read/Grep/Glob/Bash の read-only と WebFetch のみ。コード/設定/依存を書き換えない
- **秘密は原文転記しない** — パスと「秘密がハードコードされている」事実に留める
- **PoC exploit は作らない** — 指摘のみ。動作する攻撃コードを生成しない
- **誤検知を認める** — 確信度が低い finding は Info / Out of scope へ
- **出典の無い主張を書かない** — OWASP/CWE/ASVS のいずれかに紐付ける。紐付かないなら "general best practice" と明示
- **プロジェクト固有ルールを再発明しない** — deny-by-default・plane 分離・stateless filter 等は
`plecto-architecture` / `CLAUDE.md` に委ねる
## Optional SAST tooling(補助、必須ではない)
- **Rust**: `cargo clippy -- -W clippy::pedantic`, `cargo audit`, `cargo deny`
- **JS/TS**: `npm audit`, `eslint-plugin-security`
- **汎用**: `semgrep --config=auto`
手動レビューを置き換えない。出力は参考としてレポートに添付。