verify_react_vulnerability.py)これは、プロジェクトが重大なReact2Shell脆弱性(別名CVE-2025-55182)の影響を受けているかどうかをすばやく判断するのに役立つ、シンプルでスタンドアロンのPythonスクリプトです。
これは2段階のチェックを実行します:
package.jsonファイルを検査し、既知の脆弱性のあるReactおよびNext.jsのバージョンを確認します。package.jsonを検索: 実行されたディレクトリ内でpackage.jsonファイルを探します。reactとnextの正確なバージョンを特定します。npm installコマンドを提供します。"use server""use client"createSafeActionClientregisterServerReferencereact-server-dom-webpackpython3 --versionを実行して確認できます。pip install packaging
verify_react_vulnerability.pyスクリプトがプロジェクトのルートディレクトリ(package.jsonと同じディレクトリ)にあることを確認してください。
ターミナルを開いて、次のコマンドを実行してください:
python3 verify_react_vulnerability.py
脆弱なライブラリのバージョンが見つかった場合、スクリプトはすぐに停止して問題を報告します:
--- Step 1: Checking versions in package.json ---
❌ VULNERABLE: Found React version 19.0.1.
...
-------------------------------------------------
❌ SUMMARY: Your project is VULNERABLE based on dependency versions.
Please update the following dependencies immediately.
--- Recommended Fixes ---
npm install [email protected] [email protected]
...
-------------------------------------------------
依存関係が安全な場合、スクリプトは詳細スキャンを提案します。
--- Step 1: Checking versions in package.json ---
✅ OK: Found React version 18.3.1. Not in a known vulnerable range.
...
-------------------------------------------------
✅ INFO: Your project's dependencies do not seem to be affected by React2Shell.
However, vulnerable features might be in use if code was copy-pasted or 'vendored'.
Do you want to perform a comprehensive deep code scan? (y/n): y
詳細スキャンで指標が見つかった場合、詳細なレポートが提供されます:
--- Step 2: Performing Comprehensive Deep Code Scan ---
Searching for patterns related to React Server Components...
⚠️ WARNING: Deep scan found indicators of React Server Component usage.
This does not guarantee a vulnerability, but warrants a manual review.
Ensure your framework versions are fully patched.
- Found pattern '"use server"':
Reason: Indicates a file contains React Server Actions, the primary feature associated with the vulnerability.
In files: ['src/actions/auth.ts']
- Found pattern '"use client"':
Reason: Indicates a Client Component, which may import and use Server Actions from other files.
In files: ['src/components/LoginButton.tsx', 'src/components/ThemeSwitcher.tsx']
-------------------------------------------------
詳細スキャンで何も見つからなかった場合、プロジェクトが安全である可能性が高いことを確認します:
--- Step 2: Performing Comprehensive Deep Code Scan ---
Searching for patterns related to React Server Components...
✅ OK: The comprehensive deep scan did not find any indicators of RSC usage.
-------------------------------------------------