Skip to content

Document that extracting single entries doesn't validate the destination - #449

Merged
weichsel merged 1 commit into
mainfrom
docs/extract-destination-validation
Nov 21, 2026
Merged

weichsel merged 1 commit into
mainfrom
docs/extract-destination-validation

Conversation

@weichsel

Copy link
Copy Markdown
Owner

Archive.extract(_:to:) writes to the passed URL as is. Unlike FileManager.unzipItem(at:to:), it doesn't check that the URL is located within a destination directory. Entry paths can contain .. or be absolute, and symlinks extracted earlier are followed. Callers that build the URL from entry.path have to validate it themselves.

  • Adds an Important note about this to the documentation of extract(_:to:).
  • Documents the default of symlinksValidWithin: the directory that contains the symlink.

Archive.extract(_:to:) writes to the passed URL as is. Unlike
FileManager.unzipItem(at:to:), it doesn't check that the URL is located
within a destination directory, so callers that build it from entry
paths have to validate it themselves.

Also document the default of symlinksValidWithin, which is the directory
that contains the symlink.
@weichsel weichsel self-assigned this Nov 21, 2026
@weichsel
weichsel merged commit 3b3af72 into main Nov 21, 2026
13 checks passed
@weichsel
weichsel deleted the docs/extract-destination-validation branch November 21, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant