Add warning to ZipFile.ExtractToDirectory and ExtractToDirectoryAsync docs#12355
Open
Add warning to ZipFile.ExtractToDirectory and ExtractToDirectoryAsync docs#12355
Conversation
…toryAsync remarks Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add security warning for ZipFile.ExtractToDirectory methods
Add zip-bomb security warning to ZipFile.ExtractToDirectory and ExtractToDirectoryAsync docs
Feb 27, 2026
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-io-compression |
Member
|
cc @GrabYourPitchforks, @blowdart for wording |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds security warnings to all ZipFile.ExtractToDirectory and ExtractToDirectoryAsync methods, alerting developers that these convenience APIs don't enforce limits on uncompressed size or entry count, making them vulnerable to zip-bomb attacks when used with untrusted archives.
Changes:
- Added security warnings to 16 method overloads in
ZipFile.xml - Warning directs users to manually iterate entries using
ZipArchiveand validate limits before extraction - Applied consistent warning text across three different XML documentation formats (markdown, para, plain text)
blowdart
approved these changes
Feb 27, 2026
gewarren
reviewed
Feb 27, 2026
| If <paramref name="destinationDirectoryName" /> or any of its parent directories is a pre-existing junction or symbolic link, the link is followed and the extraction writes to the final target folder. | ||
| If a file to be archived has an invalid last modified time, the first date and time representable in the zip timestamp format (midnight on January 1, 1980) will be used.</remarks> | ||
| If a file to be archived has an invalid last modified time, the first date and time representable in the zip timestamp format (midnight on January 1, 1980) will be used. | ||
| <format type="text/markdown"><![CDATA[> [!WARNING] |
Contributor
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.

ZipFile.ExtractToDirectoryand its async variants are convenience APIs that don't enforce any limits on total uncompressed size or entry count, making them unsafe for use with untrusted archives.Changes
[!WARNING]callout to the<remarks>of all 16 overloads acrossExtractToDirectoryandExtractToDirectoryAsyncinxml/System.IO.Compression/ZipFile.xmlZipArchivefor manual entry iteration and validate uncompressed size and entry count before extractionThe warning reads:
The three pre-existing remark formats across the overloads are all handled:
<format type="text/markdown"><![CDATA[...]]>) — warning inserted inline<para>...</para>) —<format type="text/markdown">wrapper appended before</remarks><format type="text/markdown">wrapper appended before</remarks>Original prompt
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.