Skip to content

Mention filename validation and permission handling for ZIP and TAR extraction#54844

Open
rzikm wants to merge 3 commits into
mainfrom
tar-zip-docs-improvement
Open

Mention filename validation and permission handling for ZIP and TAR extraction#54844
rzikm wants to merge 3 commits into
mainfrom
tar-zip-docs-improvement

Conversation

@rzikm

@rzikm rzikm commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

Introduce filename validation to ensure extracted entry names conform to acceptable patterns and enhance permission handling for extracted files on Unix systems.


Internal previews

📄 File 🔗 Preview link
docs/standard/io/zip-tar-best-practices.md Best practices for working with ZIP and TAR archives in .NET

Copilot AI review requested due to automatic review settings July 21, 2026 13:57
@rzikm
rzikm requested review from a team and adegeo as code owners July 21, 2026 13:57
@dotnetrepoman dotnetrepoman Bot added this to the July 2026 milestone Jul 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the ZIP/TAR extraction best-practices guidance to address two additional safety considerations: validating archive entry names against an application policy, and handling Unix permission bits that might be restored from archive metadata during extraction.

Changes:

  • Added guidance sections for validating entry names and for Unix permission-bit handling during extraction.
  • Expanded the Unix permissions discussion with examples showing how to clear/mask permissions prior to extraction.
  • Updated the C# snippet sample to include filename-policy validation and permission masking/clearing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
docs/standard/io/zip-tar-best-practices.md Adds new guidance sections, updates the untrusted-archive checklist, and expands Unix permission handling content.
docs/standard/io/snippets/zip-tar-best-practices/csharp/Program.cs Adds a placeholder name-validation function and applies name validation and permission handling in the safe extraction examples.

Comment thread docs/standard/io/zip-tar-best-practices.md Outdated
Comment thread docs/standard/io/zip-tar-best-practices.md Outdated
Comment thread docs/standard/io/zip-tar-best-practices.md Outdated
Comment thread docs/standard/io/snippets/zip-tar-best-practices/csharp/Program.cs Outdated
Comment thread docs/standard/io/snippets/zip-tar-best-practices/csharp/Program.cs Outdated
Comment thread docs/standard/io/snippets/zip-tar-best-practices/csharp/Program.cs

@gewarren gewarren left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some minor grammar suggestions.

Comment thread docs/standard/io/snippets/zip-tar-best-practices/csharp/Program.cs Outdated
Comment thread docs/standard/io/snippets/zip-tar-best-practices/csharp/Program.cs Outdated
Comment thread docs/standard/io/snippets/zip-tar-best-practices/csharp/Program.cs Outdated
Comment thread docs/standard/io/snippets/zip-tar-best-practices/csharp/Program.cs Outdated
Comment thread docs/standard/io/zip-tar-best-practices.md Outdated
Comment thread docs/standard/io/zip-tar-best-practices.md Outdated
Comment thread docs/standard/io/zip-tar-best-practices.md Outdated
Comment thread docs/standard/io/zip-tar-best-practices.md Outdated
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>

@alinpahontu2912 alinpahontu2912 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, great updates 👍

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.

4 participants