Skip to content

Adam/fix tar symlink - #1407

Merged
adamhathcock merged 3 commits into
releasefrom
adam/fix-tar-symlink
Aug 5, 2026
Merged

adamhathcock merged 3 commits into
releasefrom
adam/fix-tar-symlink

Conversation

@adamhathcock

Copy link
Copy Markdown
Owner

fixes GHSA-rch7-vc9j-fw2v

This pull request introduces significant improvements to the security of directory extraction, specifically around symbolic links and reparse points. It ensures that symbolic links cannot target locations outside the extraction root and that extraction never follows symbolic links or reparse points in later entries. The changes also add comprehensive tests to verify these protections across multiple extraction APIs.

Security enhancements for extraction:

  • Extraction now rejects symbolic link targets that point outside the extraction root, and never follows symbolic links or reparse points when extracting subsequent entries. This prevents directory traversal and privilege escalation attacks. (src/SharpCompress/Common/DirectoryManagement.cs, src/SharpCompress/Common/IEntryExtensions.cs, src/SharpCompress/Common/IEntryExtensions.Async.cs, [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

  • New error messages and validation methods were added to enforce these checks and throw exceptions if a violation is detected. (src/SharpCompress/Common/DirectoryManagement.cs, [1] [2]

API and documentation updates:

  • The SymbolicLinkHandler documentation and interface were updated to clarify the new security guarantees and behaviors. (src/SharpCompress/Common/ExtractionOptions.cs, src/SharpCompress/Common/Options/IExtractionOptions.cs, [1] [2]
  • The public API documentation was updated to describe the new symbolic link extraction restrictions. (docs/API.md, docs/API.mdR466-R467)

Testing:

  • Added comprehensive tests for symbolic link extraction, covering cases where the link target is outside the extraction directory and where entries beneath a symbolic link are present. These tests ensure that the handler is not called and no files are written outside the extraction root, across both sync and async APIs. (tests/SharpCompress.Test/Security/SymbolicLinkExtractionTests.cs, tests/SharpCompress.Test/Security/SymbolicLinkExtractionTests.csR1-R304)

Overall, these changes greatly improve the safety of extracting archives containing symbolic links, providing robust defenses against common archive extraction vulnerabilities.

@adamhathcock
adamhathcock merged commit ec1c0ac into release Aug 5, 2026
1 of 3 checks passed
@adamhathcock
adamhathcock deleted the adam/fix-tar-symlink branch August 5, 2026 14:45
shpaass added a commit to Yafc-CE/yafc-ce that referenced this pull request Oct 25, 2026
Updated [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest)
from 18.7.0 to 18.11.0.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.NET.Test.Sdk's
releases](https://github.com/microsoft/vstest/releases)._

## 18.11.0

<!-- Release notes generated using configuration in .github/release.yml
at rel/18.11 -->

## What's Changed
* Fix TRX logger mangling astral-plane (non-BMP) characters by
@​azat-msft in microsoft/vstest#16318
* Disable the MTP testhost by default by @​nohwnd in
microsoft/vstest#16337
* Fix OS-blind apphost probe in MTP bridge on Unix (regression from
#​16201) by @​azat-msft in
microsoft/vstest#16336
* Retarget the MTP client onto
Microsoft.Testing.Platform.ServerMode.Client.Sources by @​nohwnd in
microsoft/vstest#16300
* Pass arguments to PowerShell with -File instead of -command by
@​nohwnd in microsoft/vstest#16363
* Respect console logger verbosity from a settings file by @​nohwnd in
microsoft/vstest#16044
* Fix backslash normalization in VSTestCLIRunSettings on Unix by
@​nohwnd in microsoft/vstest#15795
* Docs: fix typo explicitely -> explicitly by @​vaibhav8a in
microsoft/vstest#16397
* Copy acceptance test diagnostic logs into the test results directory
by @​nohwnd in microsoft/vstest#16403

## New Contributors
* @​vaibhav8a made their first contribution in
microsoft/vstest#16397

**Full Changelog**:
microsoft/vstest@v18.10.1...v18.11.0

## 18.10.1


## What's Changed
* Isolate code coverage files in published output by @​azat-msft in
microsoft/vstest#16476


**Full Changelog**:
microsoft/vstest@v18.10.0...v18.10.1

## 18.10.0


## What's Changed
* Drop Mono fallback, run .NET Framework tests on Windows only by
@​nohwnd in microsoft/vstest#16158
* Run Microsoft.Testing.Platform test apps under `vstest.console` and
datacollector by @​nohwnd in
microsoft/vstest#16201
* Fix test output eaten by MSBuild terminal logger by @​nohwnd in
microsoft/vstest#16223
* Remove the experimental test session feature by @​nohwnd in
microsoft/vstest#16231
* Skip a single bad executor instead of failing all executor loading by
@​nohwnd in microsoft/vstest#16239
* Assert apartment state instead of using Clipboard in UI tests by
@​nohwnd in microsoft/vstest#16270
* Surface test host crashes during protocol negotiation by @​nohwnd in
microsoft/vstest#16285
* Pass the inferred target platform to the host in run settings by
@​nohwnd in microsoft/vstest#16271
* Report raw invalid IsTargetPlatformInferred value, cover host x64
forcing by @​nohwnd in microsoft/vstest#16295
* Disable the MTP testhost by default (#​16337) by @​nohwnd in
microsoft/vstest#16341


**Full Changelog**:
microsoft/vstest@v18.9.0...v18.10.0

## 18.9.0

## What's Changed
* Fix tilde/exclamation characters corrupted in TerminalLogger test
output by @​nohwnd in microsoft/vstest#16046
* Make TranslationLayer Native AOT-compatible by @​drewnoakes in
microsoft/vstest#16045
* Guard GenerateProgramFile target against UseWinUI/UseUwpTools
evaluation order by @​nohwnd in
microsoft/vstest#16072
* Add RequestingAssembly to AssemblyResolveEventArgs for binary compat
by @​nohwnd in microsoft/vstest#16076
* Remove stale Microsoft.Extensions.FileSystemGlobbing binding redirect
from testhost.x86 and datacollector by @​Evangelink in
microsoft/vstest#16082
* Fix TRX attachment paths when LogFileName contains a subdirectory by
@​nohwnd in microsoft/vstest#15791
* Fix missing dumps for .NET Framework child processes in
NetClientHangDumper by @​nohwnd in
microsoft/vstest#16098
* Fix data collection channels to use negotiated protocol version
instead of V1 by @​nohwnd in
microsoft/vstest#16096
* Fix race condition in BlameCollector: skip hang dump when testhost
hasn't launched yet by @​nohwnd in
microsoft/vstest#16065
* Replace TestSDKAutoGeneratedCode with ExcludeFromCodeCoverage in
auto-generated Program files by @​nohwnd in
microsoft/vstest#16101
* Include testhost process path in crash error messages by @​nohwnd in
microsoft/vstest#16108
* Fix DataDriven test results being double-counted in TRX logger totals
by @​nohwnd in microsoft/vstest#15766
* Fix datacollector crash visibility: replace Assert with throwable
exceptions by @​nohwnd in microsoft/vstest#16048
* Add TreatErrorMessagesAsWarnings parameter to TRX logger by @​nohwnd
in microsoft/vstest#16106
* Wait for testhost stderr to drain before reading its crash output by
@​nohwnd in microsoft/vstest#16128
* Handle runtimeconfig.dev.json without additionalProbingPaths by @​tmat
in microsoft/vstest#16166
* Suggest Microsoft.NET.Test.Sdk when a managed test project brings no
testhost by @​nohwnd in microsoft/vstest#16169
* Fix x86 testhost loading mismatched x64 hostfxr (0x800700C1) when run
via vstest.console.exe directly (#​16151) by @​azat-msft in
microsoft/vstest#16156
* Preserve the real exception (type + stack trace) when a test run
aborts in BaseRunTests by @​nohwnd in
microsoft/vstest#16167

## New Contributors
* @​drewnoakes made their first contribution in
microsoft/vstest#16045

**Full Changelog**:
microsoft/vstest@v18.8.0...v18.9.0

## 18.8.1

## What's Changed
* Fix protocol negotiation timeout when STJ reflection is disabled
(18.8.1) by @​nohwnd in microsoft/vstest#16281


**Full Changelog**:
microsoft/vstest@v18.8.0...v18.8.1

## 18.8.0

## What's Changed
* Migrate from Newtonsoft.Json to System.Text.Json / Jsonite (merge to
main) by @​nohwnd in microsoft/vstest#15687
- For more detail refer to
https://devblogs.microsoft.com/dotnet/vs-test-is-removing-its-newtonsoft-json-dependency/
* Create source-only filter package by @​Youssef1313 in
microsoft/vstest#15638
* Add ARM64 msdia140.dll support to test platform packages by @​nohwnd
in microsoft/vstest#15692
* Fix mutex cleanup crash on macOS/Linux by @​nohwnd in
microsoft/vstest#15684
* Restrict artifact temp directory permissions on Unix by @​nohwnd in
microsoft/vstest#15729
* Add support for filtering uncategorized tests with TestCategory=None
by @​Evangelink in microsoft/vstest#15727
* Fix SCI binding failure in DTA hosts (main) by @​nohwnd in
microsoft/vstest#15724
* Fix HTML logger parallel file collision by @​nohwnd in
microsoft/vstest#15435
* Improve error message when testhost cannot be found by @​nohwnd in
microsoft/vstest#16053
* Fix HTML logger exception on invalid XML chars in test display names
by @​nohwnd in microsoft/vstest#16051

**Full Changelog**:
microsoft/vstest@v18.7.0...v18.8.0

Commits viewable in [compare
view](microsoft/vstest@v18.7.0...v18.11.0).
</details>

Updated [SharpCompress](https://github.com/adamhathcock/sharpcompress)
from 0.50.0 to 0.50.7.

<details>
<summary>Release notes</summary>

_Sourced from [SharpCompress's
releases](https://github.com/adamhathcock/sharpcompress/releases)._

## 0.50.7

## What's Changed
* Reduce allocations in RAR5 password key derivation by @​adamhathcock
in adamhathcock/sharpcompress#1464


**Full Changelog**:
adamhathcock/sharpcompress@0.50.6...0.50.7

## 0.50.6

## What's Changed
* Fix 7z encryption detection for streamless files by @​adamhathcock in
adamhathcock/sharpcompress#1446
* pr 1436 followups by @​adamhathcock in
adamhathcock/sharpcompress#1442
* Expose public exceptions for encrypted 7z decoding failures by
@​adamhathcock in
adamhathcock/sharpcompress#1445
* Fix empty and directory-only 7z archive finalization by @​adamhathcock
in adamhathcock/sharpcompress#1444
* Fix pooled buffer ownership and exception-safe cleanup by
@​adamhathcock in
adamhathcock/sharpcompress#1447
* Fix 7z writer attribute interoperability with libarchive by
@​adamhathcock in
adamhathcock/sharpcompress#1443
* fixes for release by @​adamhathcock in
adamhathcock/sharpcompress#1458


**Full Changelog**:
adamhathcock/sharpcompress@0.50.5...0.50.6

## 0.50.5

## What's Changed
* Cache RAR5 encrypted header key derivation by @​adamhathcock in
adamhathcock/sharpcompress#1419
* Update .NET SDK and SourceLink to fix NuGet auditing by @​adamhathcock
in adamhathcock/sharpcompress#1421
* Fix encrypted RAR5 archive comments by @​adamhathcock in
adamhathcock/sharpcompress#1420
* Reuse RAR5 derived keys across encrypted file entries by
@​adamhathcock in
adamhathcock/sharpcompress#1426
* Reapply uppercase split ZIP parts fix to release by @​adamhathcock in
adamhathcock/sharpcompress#1431
* Reapply gzip FEXTRA XLEN overflow fix to release by @​adamhathcock in
adamhathcock/sharpcompress#1433
* Reapply encrypted RAR header rescan fix to release by @​adamhathcock
in adamhathcock/sharpcompress#1432
* Reapply gzip reader/archive XLEN overflow fix to release by
@​adamhathcock in
adamhathcock/sharpcompress#1434
* Reapply 7z next-header bounds validation to release by @​adamhathcock
in adamhathcock/sharpcompress#1435


**Full Changelog**:
adamhathcock/sharpcompress@0.50.4...0.50.5

## 0.50.4

## What's Changed
* Adam/fix tar symlink by @​adamhathcock in
adamhathcock/sharpcompress#1407


**Full Changelog**:
adamhathcock/sharpcompress@0.50.3...0.50.4

## 0.50.3

## What's Changed
* Fix RAR5 async decompression corruption in UnpWriteBufAsync by
@​adamhathcock in
adamhathcock/sharpcompress#1396


**Full Changelog**:
adamhathcock/sharpcompress@0.50.2...0.50.3

## 0.50.2

## What's Changed
* Fix SeekableSharpCompressStream.StopRecording() to rewind to recorded…
by @​adamhathcock in
adamhathcock/sharpcompress#1393


**Full Changelog**:
adamhathcock/sharpcompress@0.50.1...0.50.2

## 0.50.1

## What's Changed
* Fix ArgumentException in ZlibBaseStream when disposing mid-stream GZip
probe in ReaderFactory by @​adamhathcock with @​Copilot in
adamhathcock/sharpcompress#1371
* Fixes ZipWriter to be fully forward only by @​adamhathcock in
adamhathcock/sharpcompress#1372
* Fix tar.gz reader detection for GZip archive entry streams by
@​adamhathcock with @​Copilot in
adamhathcock/sharpcompress#1376

Thanks for reporting!

**Full Changelog**:
adamhathcock/sharpcompress@0.50.0...0.50.1

Commits viewable in [compare
view](adamhathcock/sharpcompress@0.50.0...0.50.7).
</details>

Updated [System.IO.Hashing](https://github.com/dotnet/dotnet) from
10.0.9 to 10.0.13.

<details>
<summary>Release notes</summary>

_Sourced from [System.IO.Hashing's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>
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