Repository navigation
Chromium: unzip writes nothing outside its folder, even through chained links - #556
Open
MopigamesYT wants to merge 2 commits into
Open
MopigamesYT wants to merge 2 commits into
MopigamesYT wants to merge 2 commits into
Conversation
…ed links (#524) unzip created each link as it came and checked its target from its name in the archive. Each link in a chain such as p/q/r -> .., p/q/r/s -> ../.., p/q/r/s/t -> ../../../x really points one folder higher than its name says, so the last one, and anything written through it, landed outside the folder (the test shows the link ending above dest). Now a name must be local (filepath.IsLocal: no "..", not absolute, while "..env.example" is fine); files and folders are written first, while no link exists; links come after, each resolved against the folder it really is in, then all of them against the real filesystem. Special files are refused. Part of #524: the other four extractors are not merged into one yet. Tests: TestUnzipRefusesHostileArchives (chained links, "..", absolute names and links, a file under a link), TestUnzipKeepsLegitimateLinks (a macOS framework's links, "..env.example"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tpm28
approved these changes
Nov 18, 2026
This branch has not been deployed
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.
Part of #524
What changed
unzip(Chromium's archive) created each link as it came and checked its target from its name in the archive. Each link in a chain such asp/q/r -> ..,p/q/r/s -> ../..,p/q/r/s/t -> ../../../xreally points one folder higher than its name says. With the old code, the test's archive leaves a link outsidedest(one/two/t was written outside dest).Now:
filepath.IsLocal: no.., not absolute, while..env.exampleis fine);Tests:
TestUnzipRefusesHostileArchives(chained links,.., absolute names and links, a file under a link: nothing may exist outsidedest),TestUnzipKeepsLegitimateLinks(a macOS framework'sVersions/Currentlinks,..env.example).Why "Part of"
The other four extractors (extensions, updates, the phone's Debian root, project sync) are not merged into one
internal/coreextractor yet. That is the rest of #524.Nothing visible: no screenshots. Checked here:
go test ./internal/browser(the old code fails the chained-links case).Assisted-by: Claude Opus 5.5 medium
🤖 Generated with Claude Code