claude-skills/

Anthropic公式スキル・プラグインの日本語ディレクトリ

last sync 22h ago
スキルOfficialsecurity

🔐42crunch-api-security-testing

説明

42Crunch の Audit と live Scan を単一のパイプラインで両方実行します。 次のような場合に使用: - Audit と Scan を一緒に実行したい場合 - セキュリティパイプライン全体を完了させたい場合 - どのフェーズを実行するか曖昧なリクエストの場合 「run audit and scan」「full 42crunch pipeline」「full security check」「audit then scan」「42crunch」「SQG」などのフレーズをトリガーとします。 ユーザーが Audit のみ(その場合は 42crunch-audit を使用)または Scan のみ(その場合は 42crunch-scan を使用)を明示的にリクエストしている場合は、このスキルを使用しないでください。

原文を表示

Run both a 42Crunch Audit and a live Scan together in a single pipeline. Use this skill when the user wants to run audit and scan together, complete the full security pipeline, or when the request is ambiguous about which phase to run. Triggers on phrases like "run audit and scan", "full 42crunch pipeline", "full security check", "audit then scan", "42crunch", or "SQG". Do NOT use this skill if the user explicitly requests only an audit (use 42crunch-audit) or only a scan (use 42crunch-scan).

ユースケース

  • AuditとScanを一緒に実行したい
  • セキュリティパイプライン全体を完了させたい
  • 実行フェーズが曖昧なリクエストを処理する

本文(日本語訳)

42Crunch API セキュリティ スキル

Audit(静的OAS解析とSQGフィックスループ)と Scan(ライブ適合性テスト+認可テスト)の2フェーズを統括します。 各フェーズは、実行前にユーザーの明示的な許可が必要です。


エントリーポイント

  1. プリフライトチェック。 ../../references/pre-flight.md を読み込み、すべてのステップ(セットアップ、OAS解決、タグ検出)を完了してください。 OASファイルの選択を促す際は、コンテキストとして "pipeline" を使用してください(例: "Which one should I run through the pipeline?")。 いずれかのステップが失敗した場合、またはユーザーがキャンセルした場合は、先に進まないでください。

  2. フェーズ1の実行許可を求める。 AskUserQuestion を呼び出します:

    • question: "Ready to run a 42Crunch Audit on <filename>. This will analyse your OAS file and produce a scored report. Shall I proceed?"
    • options: ["Yes, proceed", "No, cancel"]
  3. フェーズ1を実行 — Audit。 モードはプリフライトで確定済みです — 再導出は不要です。 ../../references/audit-workflow.md を読み込み、特定されたモードに対応するコマンドのみを全体を通して適用してください。

    ワークフローはAuditを実行したうえで、開発者が読みやすく、リスク別に分類されたレポート(SQGブロッキング / セキュリティ / データバリデーションの各ティア)を、平易な英語のタイトルとリスク説明とともに提示します(生のルールIDは表示しません)。 その後、一時停止してフィックスを適用する前にユーザーの同意を求めます。 フィックスは明示的な確認後にのみ適用されます。

  4. スキャン対象URLを解決する。

    OASファイルから servers[0].url を読み込みます。

    • 環境変数 SCAN42C_HOST が設定されている場合 → 以下を静かにアナウンスします:

      "Using scan target from SCAN42C_HOST: <url>" SCAN_TARGET_URL として保存し、処理を続行します。

    • 設定されていない場合 → AskUserQuestion を呼び出します:
      • question: "The OAS points to <servers[0].url> as the API target. Is this the right URL to scan against?" — options: ["Yes — use this URL", "No — I'll provide a different URL"]
      • No の場合 → ユーザーにURLの入力を求め、SCAN_TARGET_URL として保存します。
      • Yes の場合 → servers[0].urlSCAN_TARGET_URL として保存します。
  5. フェーズ2プレビューのためのOAS解析 — フェーズ1の完了後、フェーズ2の実行許可を求める前に、サイレントで実行します。

    OASファイルを読み込み、以下を収集します:

    • オペレーションの総数
    • securitySchemes から認証スキームの種別(Bearer/JWT、API Key、Basic、OAuth2)
    • BOLAの候補数: パスに {…Id}{…Key}{…Ref} などのリソースIDプレースホルダーが含まれ、かつメソッドがGET、PUT、PATCH、DELETEのいずれかであるオペレーション
    • OASにサンプルデータが含まれているか: リクエストボディまたはパラメータスキーマに exampleexamples、または default 値を持つオペレーションが存在するか
  6. フェーズ2の実行許可を求める。 まず以下のスキャンプレビューをチャットメッセージとして出力します:

    Ready to configure the scan?
      Target:   <SCAN_TARGET_URL>
      OAS:      <filename>  (<N> operations)
      Auth:     <scheme types>  [+  second user needed — <N> BOLA candidate(s)]
      Samples:  OAS has sample data  /  No samples — you'll need to provide test data
      Tag:      <category>:<tagname>           ← プラットフォームモードのみ、タグが割り当てられている場合; タグなしの場合は省略
      Mode:     Platform / Free Trial
    

    続いて AskUserQuestion を呼び出します:

    • question: "I'm ready to start configuring the scan. I'll ask for credentials, classify your operations, and set up test scenarios — then run a happy path validation before the full scan. Shall I proceed?"
    • options: ["Yes, let's configure", "No, cancel"]
  7. フェーズ2を実行 — Scan。 モードはプリフライトで確定済みです — 再導出は不要です。

    到達可能性チェック../../references/reachability-check.md を読み込み、2段階プローブを実行します。 完了したら(またはユーザーがキャンセルした場合は停止して)ここに戻ります。

    ../../references/scan-workflow.md を読み込み、特定されたモードに対応するコマンドのみを全体を通して適用してください。

    ワークフローはスキャン設定のセットアップ、クレデンシャルの収集、テストデータの収集を行い、オペレーションごとの完全な分類テーブルを表示します。 ハッピーパスの検証を行ったうえで、フルスキャンの実行前に再度許可を求めます。 リスク別に分類されたフィンディングレポート(認可の失敗 / SQGブロッキングの適合性 / 情報提供としての適合性)を提示します。 フィックス候補は、SQGブロッキングルールおよび認可の失敗によって決定されます(重大度のみによるものではありません)。 スキルは一時停止し、OASの変更またはサーバーサイドのコードフィックスを適用する前にユーザーの同意を求めます。 必要に応じて、サーバーサイドのコードフィックスが適用またはスキップされた後、最終スキャンサマリーの前にAPIの再起動をユーザーに促してください。

    必須チェックポイント: フェーズ2において、CONF_FILE への直接編集(environments.default.variables.*、認証のワイヤリング、シナリオチェーンを含む)を行った後は、scan conf validate を実行し、ハッピーパスまたはフルスキャンの実行に進む前にすべてのバリデーションエラーを解決してください。

  8. 最終的な統合サマリーを提示します(以下の出力フォーマットを参照)。

  9. 結果に応じた次のステップを推奨します:

    両フェーズがパスし、フィックスが適用された場合:

    "Both audit and scan are passing. Your OAS is more precise and your security contract is enforced. Consider committing the updated OAS file and rerunning 42crunch-api-security-testing after any significant API change."

    いずれかのフェーズが失敗した場合、またはユーザーがフィックスを拒否した場合:

    "Here's what's still open: [list remaining SQG-failing issues or unfixed scan findings by tier]. When you're ready to address them, run 42crunch-audit or 42crunch-scan individually."

    両フェーズで問題が検出されなかった場合:

    "Clean result — your API passed both static analysis and live testing. This is a good baseline to maintain."

各許可プロンプトでは、ユーザーの明示的な確認後にのみ処理を続行してください。


出力フォーマット

両フェーズの完了後、以下の形式でサマリーを生成します:

Phase 1 — Audit Complete
  Score:          <score> / 100  (Security: <sec-score> · Data Validation: <data-score>)
  Score change:   <initial-score> → <score>  (<delta>)  |  Data: <initial-data> → <data-score>  (<data-delta>)   ← フィックス未適用の場合は省略
  Mode:           Platform                          ← または "Free Trial"
  SQG:            PASSED  (<sqg-name> — your org's security quality gate is met)     ← プラットフォームモード、パスした場合
  SQG:            FAILED  (<sqg-name> — the quality gate is not met; fixes above are required)    ← プラットフォームモード、失敗した場合
  SQG:            N/A  (Free Trial — no automated gate; user-defined thresholds applied this session)    ← フリートライアルモード
  Tag:            <category>:<tagname>              ← プラットフォームモードのみ、タグが割り当てられている場合; タグなしの場合はこの行を省略
  Issues fixed:   2 SQG-blocking  (0 security · 2 data validation)
  OAS updated:    <path/to/openapi.json>

Phase 2 — Scan Complete
  Mode:           Platform                          ← または "Free Trial"
  SQG:            PASSED  (<sqg-name> — your org's security quality gate is met)    ← プラットフォームモード、パスした場合
  SQG:            FAILED  (<sqg-name> — the quality gate is not met; fixes above are required)    ← プラットフォームモード、失敗した場合
  SQG:            N/A  (Free Trial — scan findings are informational; no gate enforced)    ← フリートライアルモード
  Authorization:  BOLA confirmed on 1 operation — OAS updated · server-side fix applied
  Conformance:    1 SQG-blocking issue fixed (OAS + code) · 3 informational findings surfaced
  OAS updated:    <path/to/openapi.json>

各フェーズで表示するSQG行は、現在のモードと結果に一致する1行のみとしてください。

フェーズ1の Score change: 行は、../../references/audit-workflow.md のステップ4で計算されたデルタ値から生成します。 Auditフィックスが適用されなかった場合(ユーザーが同意ゲートで拒否した場合、またはSQGブロッキングの問題がなかった場合)は省略します。

フェーズがスキップされた場合(ユーザーが拒否した場合)は、結果の代わりにその旨を記載します。


環境変数

変数 用途
SCAN42C_HOST スキャン対象のベースURL(OASの servers[0] を上書き) — 両モード共通

その他の変数(API_KEYPLATFORM_HOSTTRIAL_TOKEN)および一般的な制約事項は、../../references/pre-flight.md に定義されています。

原文(English)を表示

42Crunch API Security Skill

Orchestrates two phases: Audit (static OAS analysis and SQG fix loop) and Scan (live conformance + authorization testing). Each phase requires explicit user permission before execution.


Entry Point

  1. Pre-flight checks. Read ../../references/pre-flight.md and complete all steps (setup, OAS resolution, tag detection). When prompting for OAS file selection, use the context "pipeline" (e.g. "Which one should I run through the pipeline?"). Do not proceed if any step fails or the user cancels.

  2. Ask for Phase 1 permission. Call AskUserQuestion:

    • question: "Ready to run a 42Crunch Audit on <filename>. This will analyse your OAS file and produce a scored report. Shall I proceed?"
    • options: ["Yes, proceed", "No, cancel"]
  3. Execute Phase 1 — Audit. Mode is already resolved from pre-flight — do not re-derive it. Read ../../references/audit-workflow.md and apply only the commands for the identified mode throughout. The workflow runs the audit, then presents a developer-readable, risk-classified report (SQG-Blocking / Security / Data Validation tiers) with plain-English titles and risk descriptions — no raw rule IDs. It then pauses and asks the user to consent before applying any fixes. Fixes are only applied after explicit confirmation.

  4. Resolve the scan target URL.

    Read servers[0].url from the OAS file.

    • If SCAN42C_HOST environment variable is set → announce silently:

      "Using scan target from SCAN42C_HOST: <url>" Store as SCAN_TARGET_URL and proceed.

    • If not set → call AskUserQuestion:
      • question: "The OAS points to <servers[0].url> as the API target. Is this the right URL to scan against?" — options: ["Yes — use this URL", "No — I'll provide a different URL"]
      • If No → ask the user to provide the URL and store it as SCAN_TARGET_URL.
      • If Yes → store servers[0].url as SCAN_TARGET_URL.
  5. OAS analysis for Phase 2 preview — run silently after Phase 1 completes, before asking for Phase 2 permission.

    Read the OAS file and collect:

    • Total operation count
    • Auth scheme types from securitySchemes (Bearer/JWT, API Key, Basic, OAuth2)
    • BOLA candidate count: operations where the path has {…Id}, {…Key}, {…Ref}, or similar resource-ID placeholders AND the method is GET, PUT, PATCH, or DELETE
    • Whether the OAS contains sample data: any operation with example, examples, or default values on its request body or parameter schemas
  6. Ask for Phase 2 permission. Output the following scan preview as a chat message first:

    Ready to configure the scan?
      Target:   <SCAN_TARGET_URL>
      OAS:      <filename>  (<N> operations)
      Auth:     <scheme types>  [+  second user needed — <N> BOLA candidate(s)]
      Samples:  OAS has sample data  /  No samples — you'll need to provide test data
      Tag:      <category>:<tagname>           ← platform mode only, when a tag is assigned; omit if no tag
      Mode:     Platform / Free Trial
    

    Then call AskUserQuestion:

    • question: "I'm ready to start configuring the scan. I'll ask for credentials, classify your operations, and set up test scenarios — then run a happy path validation before the full scan. Shall I proceed?"
    • options: ["Yes, let's configure", "No, cancel"]
  7. Execute Phase 2 — Scan. Mode is already resolved from pre-flight — do not re-derive it.

    Reachability check — read ../../references/reachability-check.md and run the two-stage probe now. Return here once it completes (or stop if the user cancels).

    Read ../../references/scan-workflow.md and apply only the commands for the identified mode throughout. The workflow sets up the scan config, collects credentials, gathers test data, shows a complete operation-by-operation classification table, validates happy paths, then asks for permission again before running the full scan. It presents a risk-classified findings report (Authorization failures / SQG-blocking conformance / informational conformance). Fix candidates are determined by SQG-blocking rules and authorization failures — not severity alone. The skill pauses and asks the user to consent before applying any OAS changes or server-side code fixes. Optionally prompt user to restart the API after server-side code fixes are applied, or skipped, before the final scan summary.

Mandatory checkpoint: during Phase 2, after any direct edit to CONF_FILE (including environments.default.variables.*, auth wiring, or scenario chains), run scan conf validate and resolve all validation errors before continuing to happy-path or full scan runs.

  1. Present the final combined summary (see Output Format below).

  2. Recommend next steps based on the outcome:

    If both phases passed and fixes were applied:

    "Both audit and scan are passing. Your OAS is more precise and your security contract is enforced. Consider committing the updated OAS file and rerunning 42crunch-api-security-testing after any significant API change."

    If either phase failed or the user declined fixes:

    "Here's what's still open: [list remaining SQG-failing issues or unfixed scan findings by tier]. When you're ready to address them, run 42crunch-audit or 42crunch-scan individually."

    If no issues were found in either phase:

    "Clean result — your API passed both static analysis and live testing. This is a good baseline to maintain."

Only continue after explicit user confirmation at each permission prompt.


Output Format

After both phases complete, produce a summary in this shape:

Phase 1 — Audit Complete
  Score:          <score> / 100  (Security: <sec-score> · Data Validation: <data-score>)
  Score change:   <initial-score> → <score>  (<delta>)  |  Data: <initial-data> → <data-score>  (<data-delta>)   ← omit if no fixes applied
  Mode:           Platform                          ← or "Free Trial"
  SQG:            PASSED  (<sqg-name> — your org's security quality gate is met)     ← platform mode, passed
  SQG:            FAILED  (<sqg-name> — the quality gate is not met; fixes above are required)    ← platform mode, failed
  SQG:            N/A  (Free Trial — no automated gate; user-defined thresholds applied this session)    ← free trial mode
  Tag:            <category>:<tagname>              ← platform mode only, when a tag is assigned; omit this row if no tag
  Issues fixed:   2 SQG-blocking  (0 security · 2 data validation)
  OAS updated:    <path/to/openapi.json>

Phase 2 — Scan Complete
  Mode:           Platform                          ← or "Free Trial"
  SQG:            PASSED  (<sqg-name> — your org's security quality gate is met)    ← platform mode, passed
  SQG:            FAILED  (<sqg-name> — the quality gate is not met; fixes above are required)    ← platform mode, failed
  SQG:            N/A  (Free Trial — scan findings are informational; no gate enforced)    ← free trial mode
  Authorization:  BOLA confirmed on 1 operation — OAS updated · server-side fix applied
  Conformance:    1 SQG-blocking issue fixed (OAS + code) · 3 informational findings surfaced
  OAS updated:    <path/to/openapi.json>

Show only the one SQG line per phase that matches the current mode and result.

The Score change: row in Phase 1 is produced from the delta values computed in Step 4 of ../../references/audit-workflow.md. Omit it when no audit fixes were applied (user declined at the consent gate, or there were no SQG-blocking issues).

If a phase was skipped (user declined), note that instead of its results.


Environment Variables

Variable Purpose
SCAN42C_HOST Scan target base URL (overrides OAS servers[0]) — Both modes

All other variables (API_KEY, PLATFORM_HOST, TRIAL_TOKEN) and general constraints are defined in ../../references/pre-flight.md.

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。