Skip to content

Commit 05c74fe

Browse files
committed
Fixed: DotNetZip Directory Traversal vulnerability
- Removed support for .NET 4.0 in the test samples
1 parent 59aef84 commit 05c74fe

18 files changed

+29
-554
lines changed

Samples/GdiW3cSvgTestSuite/App.net40.config

Lines changed: 0 additions & 19 deletions
This file was deleted.

Samples/GdiW3cSvgTestSuite/GdiW3cSvgTestSuite.VS2017.csproj

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="MSBuild.Sdk.Extras">
22
<PropertyGroup>
3-
<TargetFrameworks>net40;net45;net46;net47;net48</TargetFrameworks>
3+
<TargetFrameworks>net45;net46;net47;net48</TargetFrameworks>
44
<OutputType>WinExe</OutputType>
55
<UseWindowsForms>true</UseWindowsForms>
66
<ExtrasEnableWinFormsProjectSetup>true</ExtrasEnableWinFormsProjectSetup>
@@ -10,8 +10,6 @@
1010
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1111
<UseWindowsForms>true</UseWindowsForms>
1212
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
13-
<AppConfig Condition="'$(TargetFramework)' == 'net40'">App.net40.config</AppConfig>
14-
<AutoUnifyAssemblyReferences Condition="'$(TargetFramework)' == 'net40'">false</AutoUnifyAssemblyReferences>
1513
</PropertyGroup>
1614
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1715
<DebugType>full</DebugType>
@@ -29,34 +27,13 @@
2927
<RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
3028
</PropertyGroup>
3129
<PropertyGroup>
32-
<DefineConstants Condition=" '$(TargetFramework)' == 'net40' ">$(DefineConstants);DOTNET40;NETFULL</DefineConstants>
3330
<DefineConstants Condition="$(TargetFramework.StartsWith('net45'))">$(DefineConstants);DOTNET45;NETFULL</DefineConstants>
3431
<DefineConstants Condition="$(TargetFramework.StartsWith('net46'))">$(DefineConstants);DOTNET46;NETFULL</DefineConstants>
3532
<DefineConstants Condition="$(TargetFramework.StartsWith('net47'))">$(DefineConstants);DOTNET47;NETFULL</DefineConstants>
3633
<DefineConstants Condition="$(TargetFramework.StartsWith('net48'))">$(DefineConstants);DOTNET48;NETFULL</DefineConstants>
3734
<DefineConstants Condition="$(TargetFramework.StartsWith('netcore'))">$(DefineConstants);NETCORE</DefineConstants>
3835
<DefineConstants Condition="$(TargetFramework.StartsWith('netstandard'))">$(DefineConstants);NETSTANDARD</DefineConstants>
3936
</PropertyGroup>
40-
<ItemGroup Condition=" '$(TargetFramework)' == 'net40'">
41-
<Reference Include="System.Design" />
42-
<PackageReference Include="Microsoft.Bcl.Async" Version="1.0.168" />
43-
<PackageReference Include="DotNetZip" Version="1.13.8" />
44-
<Reference Include="ICSharpCode.TextEditor">
45-
<HintPath>..\..\Libraries\net40\ICSharpCode.TextEditor.dll</HintPath>
46-
</Reference>
47-
<Reference Include="SharpVectors.ShellFileDialogs">
48-
<HintPath>..\..\Libraries\net40\SharpVectors.ShellFileDialogs.dll</HintPath>
49-
</Reference>
50-
<Reference Include="WeifenLuo.WinFormsUI.Docking">
51-
<HintPath>..\..\Libraries\net40\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
52-
</Reference>
53-
<Reference Include="WeifenLuo.WinFormsUI.Docking.ThemeVS2015">
54-
<HintPath>..\..\Libraries\net40\WeifenLuo.WinFormsUI.Docking.ThemeVS2015.dll</HintPath>
55-
</Reference>
56-
<Reference Include="SharpVectors.HtmlRenderer.WinForms">
57-
<HintPath>..\..\Libraries\net40\SharpVectors.HtmlRenderer.WinForms.dll</HintPath>
58-
</Reference>
59-
</ItemGroup>
6037
<ItemGroup Condition=" '$(TargetFramework)' == 'net45'">
6138
<Reference Include="System.Net.Http" />
6239
<Reference Include="System.Design" />

Samples/GdiW3cSvgTestSuite/GdiW3cSvgTestSuite.VS2019.csproj

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
22
<PropertyGroup>
3-
<TargetFrameworks>net40;net45;net46;net47;net48;netcoreapp3.1;net5.0-windows</TargetFrameworks>
3+
<TargetFrameworks>net45;net46;net47;net48;netcoreapp3.1;net5.0-windows</TargetFrameworks>
44
<OutputType>WinExe</OutputType>
55
<UseWindowsForms>true</UseWindowsForms>
66
<RootNamespace>GdiW3cSvgTestSuite</RootNamespace>
@@ -9,8 +9,6 @@
99
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1010
<UseWindowsForms>true</UseWindowsForms>
1111
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
12-
<AppConfig Condition="'$(TargetFramework)' == 'net40'">App.net40.config</AppConfig>
13-
<AutoUnifyAssemblyReferences Condition="'$(TargetFramework)' == 'net40'">false</AutoUnifyAssemblyReferences>
1412
</PropertyGroup>
1513
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1614
<DebugType>full</DebugType>
@@ -28,7 +26,6 @@
2826
<RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
2927
</PropertyGroup>
3028
<PropertyGroup>
31-
<DefineConstants Condition=" '$(TargetFramework)' == 'net40' ">$(DefineConstants);DOTNET40;NETFULL</DefineConstants>
3229
<DefineConstants Condition="$(TargetFramework.StartsWith('net45'))">$(DefineConstants);DOTNET45;NETFULL</DefineConstants>
3330
<DefineConstants Condition="$(TargetFramework.StartsWith('net46'))">$(DefineConstants);DOTNET46;NETFULL</DefineConstants>
3431
<DefineConstants Condition="$(TargetFramework.StartsWith('net47'))">$(DefineConstants);DOTNET47;NETFULL</DefineConstants>
@@ -37,26 +34,6 @@
3734
<DefineConstants Condition="$(TargetFramework.StartsWith('net5'))">$(DefineConstants);NETCORE;NET50</DefineConstants>
3835
<DefineConstants Condition="$(TargetFramework.StartsWith('netstandard'))">$(DefineConstants);NETSTANDARD</DefineConstants>
3936
</PropertyGroup>
40-
<ItemGroup Condition=" '$(TargetFramework)' == 'net40'">
41-
<Reference Include="System.Design" />
42-
<PackageReference Include="Microsoft.Bcl.Async" Version="1.0.168" />
43-
<PackageReference Include="DotNetZip" Version="1.13.8" />
44-
<Reference Include="ICSharpCode.TextEditor">
45-
<HintPath>..\..\Libraries\net40\ICSharpCode.TextEditor.dll</HintPath>
46-
</Reference>
47-
<Reference Include="SharpVectors.ShellFileDialogs">
48-
<HintPath>..\..\Libraries\net40\SharpVectors.ShellFileDialogs.dll</HintPath>
49-
</Reference>
50-
<Reference Include="WeifenLuo.WinFormsUI.Docking">
51-
<HintPath>..\..\Libraries\net40\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
52-
</Reference>
53-
<Reference Include="WeifenLuo.WinFormsUI.Docking.ThemeVS2015">
54-
<HintPath>..\..\Libraries\net40\WeifenLuo.WinFormsUI.Docking.ThemeVS2015.dll</HintPath>
55-
</Reference>
56-
<Reference Include="SharpVectors.HtmlRenderer.WinForms">
57-
<HintPath>..\..\Libraries\net40\SharpVectors.HtmlRenderer.WinForms.dll</HintPath>
58-
</Reference>
59-
</ItemGroup>
6037
<ItemGroup Condition=" '$(TargetFramework)' == 'net45'">
6138
<Reference Include="System.Net.Http" />
6239
<Reference Include="System.Design" />

Samples/GdiW3cSvgTestSuite/GdiW3cSvgTestSuite.csproj

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
22
<PropertyGroup>
3-
<TargetFrameworks>net40;net45;net46;net47;net48;netcoreapp3.1;net6.0-windows;net7.0-windows;net8.0-windows</TargetFrameworks>
3+
<TargetFrameworks>net45;net46;net47;net48;netcoreapp3.1;net6.0-windows;net7.0-windows;net8.0-windows</TargetFrameworks>
44
<OutputType>WinExe</OutputType>
55
<UseWindowsForms>true</UseWindowsForms>
66
<RootNamespace>GdiW3cSvgTestSuite</RootNamespace>
@@ -9,8 +9,6 @@
99
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1010
<UseWindowsForms>true</UseWindowsForms>
1111
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
12-
<AppConfig Condition="'$(TargetFramework)' == 'net40'">App.net40.config</AppConfig>
13-
<AutoUnifyAssemblyReferences Condition="'$(TargetFramework)' == 'net40'">false</AutoUnifyAssemblyReferences>
1412
</PropertyGroup>
1513
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1614
<DebugType>full</DebugType>
@@ -28,7 +26,6 @@
2826
<RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
2927
</PropertyGroup>
3028
<PropertyGroup>
31-
<DefineConstants Condition=" '$(TargetFramework)' == 'net40' ">$(DefineConstants);DOTNET40;NETFULL</DefineConstants>
3229
<DefineConstants Condition="$(TargetFramework.StartsWith('net45'))">$(DefineConstants);DOTNET45;NETFULL</DefineConstants>
3330
<DefineConstants Condition="$(TargetFramework.StartsWith('net46'))">$(DefineConstants);DOTNET46;NETFULL</DefineConstants>
3431
<DefineConstants Condition="$(TargetFramework.StartsWith('net47'))">$(DefineConstants);DOTNET47;NETFULL</DefineConstants>
@@ -39,26 +36,6 @@
3936
<DefineConstants Condition="$(TargetFramework.StartsWith('net7'))">$(DefineConstants);NETCORE;NET70</DefineConstants>
4037
<DefineConstants Condition="$(TargetFramework.StartsWith('net8'))">$(DefineConstants);NETCORE;NET80</DefineConstants>
4138
</PropertyGroup>
42-
<ItemGroup Condition=" '$(TargetFramework)' == 'net40'">
43-
<Reference Include="System.Design" />
44-
<PackageReference Include="Microsoft.Bcl.Async" Version="1.0.168" />
45-
<PackageReference Include="DotNetZip" Version="1.13.8" />
46-
<Reference Include="ICSharpCode.TextEditor">
47-
<HintPath>..\..\Libraries\net40\ICSharpCode.TextEditor.dll</HintPath>
48-
</Reference>
49-
<Reference Include="SharpVectors.ShellFileDialogs">
50-
<HintPath>..\..\Libraries\net40\SharpVectors.ShellFileDialogs.dll</HintPath>
51-
</Reference>
52-
<Reference Include="WeifenLuo.WinFormsUI.Docking">
53-
<HintPath>..\..\Libraries\net40\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
54-
</Reference>
55-
<Reference Include="WeifenLuo.WinFormsUI.Docking.ThemeVS2015">
56-
<HintPath>..\..\Libraries\net40\WeifenLuo.WinFormsUI.Docking.ThemeVS2015.dll</HintPath>
57-
</Reference>
58-
<Reference Include="SharpVectors.HtmlRenderer.WinForms">
59-
<HintPath>..\..\Libraries\net40\SharpVectors.HtmlRenderer.WinForms.dll</HintPath>
60-
</Reference>
61-
</ItemGroup>
6239
<ItemGroup Condition=" '$(TargetFramework)' == 'net45'">
6340
<Reference Include="System.Net.Http" />
6441
<Reference Include="System.Design" />

Samples/GdiW3cSvgTestSuite/PromptDialog.cs

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
using System.IO.Compression;
88
using System.Net;
99
using System.Net.NetworkInformation;
10-
#if DOTNET40
11-
using Ionic.Zip;
12-
#else
1310
using System.Net.Http;
14-
#endif
1511

1612
using FolderBrowserDialog = ShellFileDialogs.FolderBrowserDialog;
1713

@@ -94,50 +90,6 @@ private void OnFormShown(object sender, EventArgs e)
9490
btnCancel.Focus();
9591
}
9692

97-
#if DOTNET40
98-
private void OnDownloadClicked(object sender, EventArgs e)
99-
{
100-
var dlg = new LoadingAdorner();
101-
dlg.Owner = this;
102-
dlg.StartPosition = FormStartPosition.Manual;
103-
dlg.Location = new Point(this.Location.X + (this.Width - dlg.Width) / 2,
104-
this.Location.Y + (this.Height - dlg.Height) / 2);
105-
dlg.Show(this);
106-
107-
string url = _optionSettings.WebSuitePath;
108-
109-
_downloadeFilePath = Path.Combine(_optionSettings.LocalSuitePath, "FullTestSuite.zip");
110-
if (File.Exists(_downloadeFilePath))
111-
{
112-
File.Delete(_downloadeFilePath);
113-
}
114-
115-
//ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; //TLS 1.2
116-
//ServicePointManager.SecurityProtocol = (SecurityProtocolType)768; //TLS 1.1
117-
ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;
118-
119-
using (WebClient client = new WebClient())
120-
{
121-
client.DownloadFileCompleted += delegate(object other, AsyncCompletedEventArgs args) {
122-
bool result = !args.Cancelled;
123-
if (!result)
124-
{
125-
return;
126-
}
127-
using (ZipFile zip = ZipFile.Read(_downloadeFilePath))
128-
{
129-
zip.ExtractAll(_optionSettings.LocalSuitePath);
130-
}
131-
132-
dlg.Close();
133-
134-
this.DialogResult = DialogResult.OK;
135-
this.Close();
136-
};
137-
client.DownloadFileAsync(new Uri(url), _downloadeFilePath);
138-
}
139-
}
140-
#else
14193
private async void OnDownloadClicked(object sender, EventArgs e)
14294
{
14395
var dlg = new LoadingAdorner();
@@ -176,7 +128,6 @@ private async void OnDownloadClicked(object sender, EventArgs e)
176128
}
177129
}
178130
}
179-
#endif
180131

181132
private void OnSvgSuitePathTextChanged(object sender, EventArgs e)
182133
{

Samples/WpfTestOtherSvg/App.net40.config

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)