⚙️42crunch-setup
- ソース
- GitHub で見る ↗
説明
42Crunchの環境をセットアップし、auditおよびscanスキルがスムーズに実行できるようにします。 次のような場合に使用: - 42Crunchを初めて設定したいとき - 42c-astバイナリのインストールまたは更新を行いたいとき - APIキーを設定したいとき - 認証情報の不足やバイナリエラーのトラブルシューティングを行いたいとき 「setup 42crunch」「configure 42crunch」「install 42c-ast」「update 42c-ast」「set api key」「42crunch not working」「binary not found」などのフレーズ、またはauditやscanを実行する前に環境を準備するリクエストによってトリガーされます。
原文を表示
Set up the 42Crunch environment so that audit and scan skills can run without friction. Use this skill whenever the user wants to configure 42Crunch for the first time, install or update the 42c-ast binary, configure an API key, or troubleshoot missing credentials or binary errors. Triggers on phrases like "setup 42crunch", "configure 42crunch", "install 42c-ast", "update 42c-ast", "set api key", "42crunch not working", "binary not found", or any request to prepare the environment before running an audit or scan.
ユースケース
- ✓42Crunchを初めて設定したいとき
- ✓42c-astバイナリをインストール・更新したいとき
- ✓APIキーを設定したいとき
- ✓認証情報やバイナリエラーをトラブルシューティングするとき
本文(日本語訳)
42Crunch セットアップ
42Crunch の監査およびスキャンワークフローに向けて、環境を2つのフェーズで準備します:
42c-astバイナリを所定のパスにインストールする。- 認証情報を設定・保存する。
エントリポイント
呼び出し元コンテキストについて: このスキルは、ユーザーから直接呼び出される場合と、 別のスキル(例:
pre-flight)のサブルーチンとして呼び出される場合があります。 呼び出し元が渡されているかどうかを確認してください。 ステップ 1 および 6 はこのコンテキストによって動作が異なります — 各ステップの詳細を参照してください。
ステップ 1 — セットアップの導入
ユーザーから直接呼び出された場合(呼び出し元コンテキストなし)、ユーザーに挨拶し、 セットアップ完了後にできることを説明します:
ようこそ — 42Crunch 環境を準備します。これは約2分で完了する、一度限りのセットアップです。 完了後、以下のことが可能になります:
- 任意の OpenAPI ファイルをセキュリティの観点で 監査 し、スコア付きの実践的なレポートを取得する
- ライブ API を スキャン して、BOLA・BFLA・適合性の問題を検出する
- SQG をブロックしている問題を、各ステップで承認を得ながら自動的に 修正 する
以下の2ステップで進めます:
- このマシンに
42c-ast解析バイナリをインストールする。- 42Crunch の認証情報を接続する(既存のプラットフォームアカウント、または無料アカウント)。
それでは始めましょう。
サブルーチンとして呼び出された場合(呼び出し元コンテキストが設定されている場合)、 この挨拶は完全にスキップし、直接ステップ 2 に進みます。
ステップ 2 — バイナリのセットアップ
../../references/binary-setup.md の手順を最後まで実行します
(詳細表示モード — 各主要ステップをユーザーに都度アナウンスしてください)。
バイナリがインストールできない場合は、明確なエラーを表示して停止します。ステップ 3 には進まないでください。
ステップ 3 — 認証情報のセットアップ
../../references/credential-setup.md の手順を最後まで実行します。
この手順では、以下の内容を順番に実施します:
~/.42crunch/conf/env(macOS/Linux)または%APPDATA%\42Crunch\conf\env(Windows)に 認証情報がすでに存在するかどうかをサイレントで確認する。 設定済みの場合: モードとマスクされたキーを表示し、維持するか置き換えるかを確認する。- 未設定(または置き換える)の場合: ガイド付きフローでユーザーを案内する:
- 既存の 42Crunch ユーザーですか?
- はい → API キーを入力 → プラットフォーム URL を選択(US / EU / その他)
- いいえ → 42Crunch 無料トライアルの登録済みユーザーですか?
- はい → 無料トライアルトークンを入力
- いいえ → 登録リンク(
[42Crunch 無料トライアル](https://42crunch.com/freemium/?source=claude))を表示して停止
- 既存の 42Crunch ユーザーですか?
- 認証情報を
~/.42crunch/conf/envに書き込み、macOS/Linux ではchmod 600を設定する。
ステップ 4 — 最終確認
エンドツーエンドの簡易チェックを実行します:
# バイナリ(macOS / Linux)
"$HOME/.42crunch/bin/42c-ast" --version
# バイナリ(Windows)
& "$env:APPDATA\42Crunch\bin\42c-ast.exe" --version
# 認証情報(macOS / Linux)
grep -E "^(API_KEY|TRIAL_TOKEN)=" "$HOME/.42crunch/conf/env"
# 認証情報(Windows)
Select-String -Path "$env:APPDATA\42Crunch\conf\env" -Pattern "^(API_KEY|TRIAL_TOKEN)="
いずれかのチェックが失敗した場合は、具体的な失敗内容を報告し、 続行前にユーザーが解決できるよう案内してください。
ステップ 5 — サマリーの表示
セットアップサマリーを表示します(後述の「出力フォーマット」を参照)。
ステップ 6 — 次のステップの案内
サブルーチンとして呼び出された場合(呼び出し元コンテキストが設定されている場合)、
次のステップのプロンプトは完全にスキップします。
"セットアップ完了 — 処理を継続します。" とアナウンスし、呼び出し元に制御を返します。
呼び出し元(例: pre-flight)は、中断した箇所から処理を再開します。
ユーザーから直接呼び出された場合(呼び出し元コンテキストなし)、以下を表示します:
準備が整いました。今すぐ以下の操作が可能です:
42crunch-audit— OpenAPI ファイルを渡すと、スコアリングを行い、 すべてのセキュリティ問題を深刻度別に分類し、あなたの承認のもとで SQG をブロックしている問題を修正します。 この API をまだ監査したことがない場合は、ここから始めるのがおすすめです。
42crunch-scan— 実行中の API に対してライブの適合性テストと認可テストを実行します。 BOLA・BFLA・レスポンスコントラクト違反を確認します。 監査が通過した後に実行するのが最適です。
42crunch-api-security-testing— 監査とスキャンを連続して実行します。 1回のセッションで全体像を把握したい場合に推奨されるワークフローです。どちらから始めますか?
出力フォーマット
## 42Crunch セットアップ完了
| 項目 | ステータス |
|--------------------|--------------------------------------------------------|
| バイナリ | <BINARY_PATH> v<バージョン> |
| 認証情報モード | <Platform \| Free Trial> |
| API キー / トークン | Platform: `api_••••••••` または `ide_••••••••` |
| | Free Trial: `<先頭4文字>••••••••` |
| | (保存先: <パス>) |
| プラットフォームホスト | <url> ← Free Trial モードの場合はこの行を省略 |
全般的な制約事項
- すべての検出ステップ(バイナリ確認、認証情報確認)はサイレントで実行します。 失敗時またはユーザーへのプロンプト表示時にのみ出力します。
- ユーザーが入力した API キーや Free Trial トークンは、入力後に平文で表示しないでください。
常にマスクしてください
(プラットフォームトークンは
api_••••••••/ide_••••••••— プレフィックスを残し残りを置換; Free Trial トークンは<先頭4文字>••••••••、例:eyJh••••••••)。 - すべてのシェルコマンドには
Bashツールを使用し、設定ファイルの書き込みにはEditまたはWriteツールを使用してください — シェルのリダイレクトは使用しないでください。 - ダウンロードには
curlを使用し、curlが利用できない場合はwgetにフォールバックします。 Windows ではInvoke-WebRequestを使用します。 - Windows の場合: バイナリのファイル名は
42c-ast.exe、パスの区切り文字は\、 設定ファイルは%APPDATA%\42Crunch\conf\envに格納し、chmod 600はスキップします (Windows の ACL がAPPDATAを保護します)。
環境変数
| 変数名 | デフォルト値 | モード |
|---|---|---|
API_KEY |
(必須) | Platform |
PLATFORM_HOST |
(セットアップ時に設定) | Platform のみ |
TRIAL_TOKEN |
(必須) | Free Trial |
原文(English)を表示
42Crunch Setup
Prepares the environment for 42Crunch audit and scan workflows in two phases:
- Ensure the
42c-astbinary is installed at the canonical path. - Configure and store credentials.
Entry Point
Caller context: This skill may be invoked directly by the user or as a subroutine by another skill (e.g.
pre-flight). Check whether a caller was passed. Steps 1 and 6 behave differently depending on this context — see each step for details.
Step 1 — Introduce the setup
If called directly by the user (no caller context), greet the user and explain what they'll be able to do once setup is complete:
Welcome — let me get your 42Crunch environment ready. This is a one-time setup that takes about two minutes. Once done, you'll be able to:
- Audit any OpenAPI file for security issues and get a scored, actionable report
- Scan a live API to catch BOLA, BFLA, and conformance problems
- Fix SQG-blocking issues automatically, with your approval at every step
I'll handle this in two quick steps:
- Install the
42c-astanalysis binary on this machine.- Connect your 42Crunch credentials (existing platform account or free account).
Let's go.
If called as a subroutine (caller context is set), skip this greeting entirely and proceed directly to Step 2.
Step 2 — Binary setup
Follow ../../references/binary-setup.md completely (verbose mode — announce each major step to the user).
Stop and surface a clear error if the binary cannot be installed. Do not proceed to Step 3.
Step 3 — Credential setup
Follow ../../references/credential-setup.md completely.
The procedure covers, in order:
- Silently check whether credentials are already present in
~/.42crunch/conf/env(macOS/Linux) or%APPDATA%\42Crunch\conf\env(Windows). If already configured: show mode + masked key, offer to keep or replace. - If not configured (or replacing): walk the user through the guided flow:
- Are you an existing 42Crunch user?
- Yes → enter API Key → select Platform URL (US / EU / Other)
- No → Are you a registered 42Crunch Free Trial user?
- Yes → enter Free Trial Token
- No → show registration link (
[42Crunch Free Trial](https://42crunch.com/freemium/?source=claude)) and stop
- Are you an existing 42Crunch user?
- Write credentials to
~/.42crunch/conf/env, setchmod 600on macOS/Linux.
Step 4 — Final verification
Run a quick end-to-end check:
# Binary (macOS / Linux)
"$HOME/.42crunch/bin/42c-ast" --version
# Binary (Windows)
& "$env:APPDATA\42Crunch\bin\42c-ast.exe" --version
# Credentials (macOS / Linux)
grep -E "^(API_KEY|TRIAL_TOKEN)=" "$HOME/.42crunch/conf/env"
# Credentials (Windows)
Select-String -Path "$env:APPDATA\42Crunch\conf\env" -Pattern "^(API_KEY|TRIAL_TOKEN)="
If either check fails, report the specific failure and guide the user to resolve it before continuing.
Step 5 — Present summary
Display the setup summary (see Output Format below).
Step 6 — Recommend next steps
If called as a subroutine (caller context is set), skip the next-steps
prompt entirely. Announce "Setup complete — continuing." and return control
to the caller. The caller (e.g. pre-flight) will resume from where it left
off.
If called directly by the user (no caller context), present the following:
You're all set. Here's what you can do right now:
42crunch-audit— Hand me an OpenAPI file and I'll score it, classify every security issue by severity, and fix the SQG-blocking ones with your approval. A good first step if you haven't audited this API before.
42crunch-scan— Run a live conformance and authorization test against a running API. I'll check for BOLA, BFLA, and response-contract violations. Best run after the audit passes.
42crunch-api-security-testing— Runs both audit and scan back-to-back. The recommended workflow when you want the full picture in one session.Which would you like to start with?
Output Format
## 42Crunch Setup Complete
| Item | Status |
|------------------|-----------------------------------------------------|
| Binary | <BINARY_PATH> v<version> |
| Credential mode | <Platform \| Free Trial> |
| API key / Token | Platform: `api_••••••••` or `ide_••••••••` |
| | Free Trial: `<first-4-chars>••••••••` |
| | (stored in <path>) |
| Platform host | <url> ← omit this row for free trial mode |
General Constraints
- All detection steps (binary check, credential check) run silently. Surface output only on failure or when prompting the user.
- Never print the API key or Free Trial token in plaintext after the user enters
it. Always mask it (
api_••••••••/ide_••••••••for platform tokens — keep prefix, replace rest;<first-4-chars>••••••••for free trial tokens, e.g.eyJh••••••••). - Use the
Bashtool for all shell commands; use theEditorWritetools when writing config files — never shell redirection. - Use
curlfor downloads; fall back towgetifcurlis unavailable. On Windows useInvoke-WebRequest. - On Windows: binary filename is
42c-ast.exe, paths use\, config lives in%APPDATA%\42Crunch\conf\env, skipchmod 600(Windows ACLs protectAPPDATA).
Environment Variables
| Variable | Default | Mode |
|---|---|---|
API_KEY |
(required) | Platform |
PLATFORM_HOST |
(set during setup) | Platform only |
TRIAL_TOKEN |
(required) | Free Trial |
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。