From 8b053847a974642ceec9cf0da8e295bec21f56c2 Mon Sep 17 00:00:00 2001 From: Widthdom Date: Tue, 3 Nov 2026 21:33:50 +0900 Subject: [PATCH] Override minimatch to 11.0.4 to fix GHSA-g3hv-75wg-m249 Jest pulls minimatch 10.2.6 and 9.0.9 through glob and test-exclude, both below the first patched release 11.0.1. Pin every <11.0.1 copy to 11.0.4 via npm overrides and refresh the lockfile. Resolves Dependabot alert #31. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 ++ package-lock.json | 51 ++++++++++++----------------------------------- package.json | 3 ++- 3 files changed, 17 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17f22120..0d3ae6b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), #### Fixed +- **npm audit CI uses patched minimatch** — Added a `minimatch@<11.0.1` override pinned to `11.0.4` and updated the lockfile, so the transitive copies pulled in by Jest (`glob` and `test-exclude`, previously `10.2.6` and `9.0.9`) no longer carry the `GHSA-g3hv-75wg-m249` denial-of-service vulnerability. No audit exception was added. - **ilspycmd `-o` fallback reads the IL it actually writes** — `ilspycmd -o` takes an output directory and writes `.il` inside it, but nildiff passed a file path, so the fallback always returned empty IL after a successful exit and left `ilspy_out_*` directories in the temp folder. nildiff now passes a fresh temporary directory, reads the generated `.il` file, and deletes the directory recursively after every attempt, including failures and timeouts. Affected: `Services/DotNetDisassembleService.cs`, `Services/DotNetDisassembleService.Streaming.cs`, `Services/DotNetDisassembleService.VersionLabel.cs`, `FolderDiffIL4DotNet.Tests/Helpers/FakeDisassemblerProgram.cs`. Tests: `DisassembleAsync_WhenIlspyStdoutModeFails_ReadsIlFromOutputDirectoryAndRemovesIt`, `DisassemblePairAsLinesWithSameDisassemblerAsync_WhenIlspyStdoutModeFails_ReadsIlFromOutputDirectoryAndRemovesIt`, `ResolveIlspyOutputFile_ReturnsInputNamedIlFileOnly`, `BuildArgSets_IlspyCommand_PassesTemporaryOutputDirectoryToOutputFlag`, `CleanupTemporaryPathBestEffort_WhenPathIsDirectory_DeletesItRecursivelyWithoutWarning`. - **Disassembler runs that exit 0 without IL are failures** — Such runs were accepted as successful empty IL, which skipped the remaining argument sets and disassemblers and made IL comparison fail after its raw-disassembly retries. They now count toward the disassembler failure blacklist, log a console warning with the command, file, ilspycmd output directory (marked `(no IL file found)` when ilspycmd wrote no IL file), and stderr, and continue with the next argument set or disassembler. IL cache hits that contain only disassembler notices are removed and regenerated instead of becoming empty IL. Added `ILCache.RemoveIL`. Affected: `Services/DotNetDisassembleService.cs`, `Services/DotNetDisassembleService.Streaming.cs`, `Services/DotNetDisassembleService.OutputSanitizer.cs`, `Services/Caching/ILCache.cs`, `doc/TROUBLESHOOTING.md`. Tests: `DisassembleAsync_WhenPrimaryToolExitsZeroWithoutIl_LogsStderrAndFallsBackToNextTool`, `DisassemblePairAsLinesWithSameDisassemblerAsync_WhenPrimaryToolExitsZeroWithoutIl_LogsStderrAndFallsBackToNextTool`, `DisassemblePairAsLinesWithSameDisassemblerAsync_WhenEveryToolExitsZeroWithoutIl_ThrowsInsteadOfReturningEmptyIl`, `DisassembleAsync_WhenCachedIlContainsOnlyToolNotices_RemovesEntryAndRegeneratesIl`, `ILCacheRemoveIL_RemovesMemoryAndDiskEntries`, `ContainsIlContent_DetectsAnyLineThatIsNeitherBlankNorToolNotice`. - **Disassembler timeouts are reported when a fallback succeeds** — A timed-out attempt was silent unless every disassembler failed, so its `DisassemblerTimeoutSeconds` guidance never reached users whose run fell back to another argument set or tool. Each failed attempt is now logged with the file, command, and working directory: timeouts as console warnings that keep the `DisassemblerTimeoutSeconds` guidance, and start failures and non-zero exits in the log file only, because they are routine fallback steps (for example, a candidate tool that is not installed) and the final error already reports the root cause when every attempt fails. Affected: `Services/DotNetDisassembleService.cs`, `Services/DotNetDisassembleService.Streaming.cs`, `USER_GUIDE.md`, `doc/TROUBLESHOOTING.md`. Tests: `DisassemblePairAsLinesWithSameDisassemblerAsync_WhenAttemptTimesOut_LogsTimeoutGuidanceToConsoleAndFallsBack`, `DisassembleAsync_WhenAttemptExitsNonZero_LogsFailureToFileOnlyAndFallsBack`. @@ -1783,6 +1784,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), #### 修正 +- **npm audit CI で修正版 minimatch を使用** — `minimatch@<11.0.1` を `11.0.4` に固定する override を追加して lockfile を更新し、Jest が依存先として取り込む `glob` と `test-exclude` 経由のコピー(従来は `10.2.6` と `9.0.9`)から `GHSA-g3hv-75wg-m249` のサービス拒否の脆弱性を解消しました。監査例外は追加していません。 - **ilspycmd の `-o` フォールバックで実際に書き出された IL を読むように修正** — `ilspycmd -o` は出力ディレクトリを受け取り、その中に `<入力名>.il` を書き出しますが、nildiff はファイルパスを渡していたため、このフォールバックは正常終了しても常に空の IL を返し、一時フォルダに `ilspy_out_*` ディレクトリを残していました。新しい一時ディレクトリを渡して生成された `<入力名>.il` ファイルを読み取り、失敗やタイムアウトを含むすべての試行の後にディレクトリを再帰的に削除するようにしました。対象: `Services/DotNetDisassembleService.cs`, `Services/DotNetDisassembleService.Streaming.cs`, `Services/DotNetDisassembleService.VersionLabel.cs`, `FolderDiffIL4DotNet.Tests/Helpers/FakeDisassemblerProgram.cs`。テスト: `DisassembleAsync_WhenIlspyStdoutModeFails_ReadsIlFromOutputDirectoryAndRemovesIt`, `DisassemblePairAsLinesWithSameDisassemblerAsync_WhenIlspyStdoutModeFails_ReadsIlFromOutputDirectoryAndRemovesIt`, `ResolveIlspyOutputFile_ReturnsInputNamedIlFileOnly`, `BuildArgSets_IlspyCommand_PassesTemporaryOutputDirectoryToOutputFlag`, `CleanupTemporaryPathBestEffort_WhenPathIsDirectory_DeletesItRecursivelyWithoutWarning`。 - **終了コード 0 で IL を出さない逆アセンブラ実行を失敗として扱うように修正** — このような実行は空の IL として成功扱いされていたため、残りの引数セットや逆アセンブラが試されず、IL 比較は raw 逆アセンブルの再試行後に失敗していました。逆アセンブラ失敗のブラックリスト計数に含め、コマンド、ファイル、ilspycmd の出力ディレクトリ(ilspycmd が IL ファイルを書かなかった場合は `(no IL file found)` を付記)、stderr を含む警告をコンソールに出力したうえで、次の引数セットまたは逆アセンブラへ進むようにしました。逆アセンブラの通知行だけを含む IL キャッシュヒットは、空の IL にせず削除して再生成します。`ILCache.RemoveIL` を追加しました。対象: `Services/DotNetDisassembleService.cs`, `Services/DotNetDisassembleService.Streaming.cs`, `Services/DotNetDisassembleService.OutputSanitizer.cs`, `Services/Caching/ILCache.cs`, `doc/TROUBLESHOOTING.md`。テスト: `DisassembleAsync_WhenPrimaryToolExitsZeroWithoutIl_LogsStderrAndFallsBackToNextTool`, `DisassemblePairAsLinesWithSameDisassemblerAsync_WhenPrimaryToolExitsZeroWithoutIl_LogsStderrAndFallsBackToNextTool`, `DisassemblePairAsLinesWithSameDisassemblerAsync_WhenEveryToolExitsZeroWithoutIl_ThrowsInsteadOfReturningEmptyIl`, `DisassembleAsync_WhenCachedIlContainsOnlyToolNotices_RemovesEntryAndRegeneratesIl`, `ILCacheRemoveIL_RemovesMemoryAndDiskEntries`, `ContainsIlContent_DetectsAnyLineThatIsNeitherBlankNorToolNotice`。 - **フォールバックが成功した場合も逆アセンブラのタイムアウトを通知するように修正** — タイムアウトした試行は、すべての逆アセンブラが失敗しない限り何も出力されなかったため、別の引数セットやツールへフォールバックした実行では `DisassemblerTimeoutSeconds` の案内が利用者に届きませんでした。失敗した各試行を、ファイル、コマンド、作業ディレクトリとともにログ出力するようにしました。タイムアウトは `DisassemblerTimeoutSeconds` の案内を含む警告としてコンソールにも出力し、起動失敗と非 0 終了はログファイルのみに記録します。後者はフォールバックの通常過程(未インストールの候補ツール等)であり、すべての試行が失敗した場合は最終エラーが原因を報告するためです。対象: `Services/DotNetDisassembleService.cs`, `Services/DotNetDisassembleService.Streaming.cs`, `USER_GUIDE.md`, `doc/TROUBLESHOOTING.md`。テスト: `DisassemblePairAsLinesWithSameDisassemblerAsync_WhenAttemptTimesOut_LogsTimeoutGuidanceToConsoleAndFallsBack`, `DisassembleAsync_WhenAttemptExitsNonZero_LogsFailureToFileOnlyAndFallsBack`。 diff --git a/package-lock.json b/package-lock.json index 6c01ddf1..dff63f55 100644 --- a/package-lock.json +++ b/package-lock.json @@ -782,6 +782,13 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/@isaacs/nonrecursive-glob-match": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.0.3.tgz", + "integrity": "sha512-SI7kyKHq4XXDRozw+r9GlRZkia1ZkFrpLW98r2IC2Bpr8YkFGE3fvjzmxCG0x78A++69HmDNrDvSMYBZmHGpKA==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -4132,16 +4139,17 @@ } }, "node_modules/minimatch": { - "version": "10.2.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", - "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.4.tgz", + "integrity": "sha512-/UJ1dEoVQTjPNDh6SGlUo+ueLMmoHTas4q+8yaAR/5t6nLAIiBDJtoYUh20IYleix7ehiQkgczb84PE3uzHkxg==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^5.0.8" + "@isaacs/nonrecursive-glob-match": "^1.0.3", + "brace-expansion": "^5.0.12" }, "engines": { - "node": "18 || 20 || >=22" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -4783,23 +4791,6 @@ "node": ">=18" } }, - "node_modules/test-exclude/node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/test-exclude/node_modules/brace-expansion": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz", - "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/test-exclude/node_modules/glob": { "version": "10.5.0", "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", @@ -4822,22 +4813,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/test-exclude/node_modules/glob/node_modules/minimatch": { - "version": "9.0.9", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", - "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.2" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/test-exclude/node_modules/lru-cache": { "version": "10.4.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", diff --git a/package.json b/package.json index 88f39b9f..7accb8f5 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "overrides": { "brace-expansion@<1.1.18": "1.1.18", "brace-expansion@>=2.0.0 <2.1.7": "2.1.7", - "js-yaml@>=3.0.0 <3.15.2": "3.15.2" + "js-yaml@>=3.0.0 <3.15.2": "3.15.2", + "minimatch@<11.0.1": "11.0.4" } }