fix(resolution): reject oversized targets before decoding (#1553) - #2006
Merged
Merged
Conversation
Workspace imports could follow excluded dependency archives and decode them without a size guard. Reuse extraction's 1 MiB limit, reject non-files before reading, and cache null results. Add sparse-HAR and real ohpm indexing coverage while preserving legitimate import edges. Co-authored-by: danusha2345 <ewidusoc498@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Workspace imports could decode excluded dependency archives without a size limit, causing large allocations.
Fix
Reapply only PR #1583's targeted guard and sparse-HAR test, sharing extraction's existing 1 MiB limit. Reject non-files and oversized targets before decoding and cache rejection. Extend coverage using real SQLite and valid ohpm imports.
Validation
repro.sh "$PWD": before exit 1 with a 2,097,152-character decode; after exit 0 with zero HAR reads.npx vitest run __tests__/resolution-file-read.test.ts __tests__/resolution.test.ts __tests__/arkts-resolution.test.ts __tests__/extraction.test.ts __tests__/daemon-pid-reuse.test.ts: 890 passed; daemon test required rerunning with daemon enabled.npx vitest run __tests__/daemon-pid-reuse.test.ts: passed with CODEGRAPH_NO_DAEMON unset.npx tsc && npm run copy-assets,npx tsc --noEmit, andgit diff --check: passed.Fixes #1553
🤖 Generated with Claude Code