Skip to content

Commit fc45db4

Browse files
committed
Merge branch 'bugfix'
# Conflicts: # RELEASE_NOTES.md # src/LockFileComparer/AssemblyInfo.fs # src/Paket.Bootstrapper/Properties/AssemblyInfo.cs # src/Paket.Core/AssemblyInfo.fs # src/Paket/AssemblyInfo.fs
2 parents 17ba173 + ecdfbe9 commit fc45db4

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
#### 6.0.0-alpha004 - 2019-12-04
1+
#### 6.0.0-alpha005 - 2019-12-05
22
* Full .NET Core / SDK compatible version
33

4+
#### 5.240.1 - 2019-12-05
5+
* SECURITY: Check against zip leak in the workaround case of 5.240.0 - https://github.com/fsprojects/Paket/pull/3747
6+
47
#### 5.240.0 - 2019-12-04
58
* WORKAROUND: Microsoft pushed couple of invalid zips to nuget.org this works around it - https://github.com/fsprojects/Paket/issues/3743
69

src/Paket.Core/Dependencies/NuGetCache.fs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,26 @@ let ExtractPackage(fileName:string, targetFolder, packageName:PackageName, versi
534534
with
535535
| exn ->
536536
try
537+
let target = FileInfo(targetFolder).FullName |> normalizePath
537538
traceWarnfn "Package couldn't be extracted to %s. Message: %s. Trying to extract files individually." targetFolder exn.Message
538539
use archive = ZipFile.OpenRead fileName
539540
for entry in archive.Entries do
540-
let destinationPath = Path.GetFullPath(Path.Combine(targetFolder, entry.FullName))
541+
let destinationPath = Path.GetFullPath(Path.Combine(targetFolder, entry.FullName.Trim([| '/'; '\\'|])))
542+
541543
let fi = FileInfo(destinationPath)
544+
let folder = fi.Directory.FullName |> normalizePath
545+
let isSubFolder =
546+
let comparer =
547+
if isLinux then
548+
System.StringComparison.Ordinal
549+
else
550+
System.StringComparison.OrdinalIgnoreCase
551+
552+
folder.StartsWith(target,comparer)
553+
554+
if not isSubFolder then
555+
raise (Exception(sprintf "Error during extraction of %s.%sPackage is corrupted or possible zip leak attac in entry \"%s\"." fileName Environment.NewLine entry.FullName))
556+
542557
if not fi.Directory.Exists then
543558
fi.Directory.Create()
544559
if fi.Exists then

0 commit comments

Comments
 (0)