fix(tar-extract): judge the entry name that is written; bound pax work per archive - #218
Merged
Merged
Conversation
…k per archive - Decode ustar name/prefix as strict UTF-8 (ignoreBOM) so the unsafe-character check, the path rules and the write all see the same string; a non-UTF-8 or BOM-led name refuses the archive instead of reaching the filesystem as U+FFFD. - Cap total pax global-header bytes per archive at 64 KiB and count global headers toward the entry cap. - Render header bytes in error messages via an escaping describer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0199owRmYfskqYQVQrVP679o
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What this changes
Fix 4 of the post-review batch (review of PHARN-01..18), shipped through
/pharn-dev-ship.name/prefixare now decoded as strict UTF-8 (TextDecoderfatal: true,ignoreBOM: true). Before, a lenient decode turned invalid bytes (e.g. raw C10x85) into U+FFFD, sohasUnsafeCharsjudged a different string from the one written. Invalid UTF-8 or a leading BOM now refuses the archive.g) pax headers total at most 64 KiB per archive, and each one counts towardmaxEntries. Before, the limits applied per header, so the total was unbounded.describeBytes, which escapes them as\xNNand caps the length.Type of change
feat— new stack option, wizard step, or command capabilityfix— bug fixdocs— docs-only changechore/refactor— tooling or internal restructure, no behavior changeArea(s) touched
src/lib/tar-extract.ts(fetch boundary),tests/tar-extract.test.ts,CHANGELOG.md(### Security),.dev/features/tar-entry-names/(pipeline artifacts).Checklist
.js-extension import convention.tests/*.test.ts— 9 new cases; 8 fail on the base code, and the BOM case is a guard.docs/page — N/A (no user-facing surface beyond CHANGELOG).Quality gates
npm run checkpasses locally (format:check+lint+typecheck+test) — 1507 tests.npm run buildsucceeds.npm run test:coveragepasses (coverage thresholds met).Notes for the reviewer
validateexit 0, regressno-regressions, verifyPASS, review GREEN with 2 minor advisory findings. See.dev/features/tar-entry-names/REVIEW.md.🤖 Generated with Claude Code
https://claude.ai/code/session_0199owRmYfskqYQVQrVP679o
Generated by Claude Code