Fix tar tests#131077
Closed
alinpahontu2912 wants to merge 2 commits into
Closed
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-formats-tar |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates System.Formats.Tar extraction tests related to symlink/link traversal and other extraction behaviors, aiming to unskip previously-disabled coverage and to tolerate Windows-specific exception differences when rejecting malicious archives.
Changes:
- Removes
[ActiveIssue(..., TestPlatforms.OSX)]from multipleTarFile.ExtractToDirectory*tests, re-enabling them on macOS. - Updates the Windows assertion in the chained symlink traversal test to accept either
IOExceptionorUnauthorizedAccessExceptiondepending on OS/build behavior. - Keeps the security postconditions (no files created outside destination) after the extraction failure checks.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs | Re-enables several async stream extraction tests on macOS by removing ActiveIssue. |
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.File.Tests.cs | Re-enables several async file-path extraction tests on macOS by removing ActiveIssue. |
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs | Re-enables several sync stream extraction tests on macOS by removing ActiveIssue. |
| src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.File.Tests.cs | Re-enables some sync file-path extraction tests on macOS; broadens Windows exception acceptance in chained-symlink traversal rejection test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
76
to
79
| [Theory] | ||
| [InlineData(TarEntryType.SymbolicLink)] | ||
| [InlineData(TarEntryType.HardLink)] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/129227", TestPlatforms.OSX)] | ||
| public void Extract_LinkEntry_TargetOutsideDirectory(TarEntryType entryType) |
Comment on lines
59
to
60
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/129227", TestPlatforms.OSX)] | ||
| public async Task SetsLastModifiedTimeOnExtractedFiles() |
Comment on lines
136
to
139
| [Theory] | ||
| [InlineData(TarEntryType.SymbolicLink)] | ||
| [InlineData(TarEntryType.HardLink)] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/129227", TestPlatforms.OSX)] | ||
| public async Task Extract_LinkEntry_TargetOutsideDirectory_Async(TarEntryType entryType) |
Comment on lines
211
to
212
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/129227", TestPlatforms.OSX)] | ||
| public void ExtractArchiveWithEntriesThatStartWithSlashDotPrefix() |
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.
Windows always creates file symlinks, not directories. Based on the build, the exception can be thrown either when creating the symlink or when parsing it. We are now dealing with both cases.