Skip to content

Commit 4dd06f2

Browse files
author
Raffaele Marcello
committed
Update .gitignore to include src/Application/src/RazorPagesTestSample/config.json. resolve #11
1 parent 7337500 commit 4dd06f2

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11

22
.DS_Store
3+
src/Application/src/RazorPagesTestSample/config.json

src/Application/src/RazorPagesTestSample/Pages/Index.cshtml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ public async Task<IActionResult> OnPostAnalyzeMessagesAsync()
9595
public static void WriteToDirectory(ZipArchiveEntry entry, string destDirectory)
9696
{
9797
string destFileName = Path.Combine(destDirectory, entry.FullName);
98+
99+
// Ensure the destination file is within the destination directory
100+
if (!Path.GetFullPath(destFileName).StartsWith(Path.GetFullPath(destDirectory), StringComparison.Ordinal))
101+
{
102+
throw new InvalidOperationException("Entry is trying to write outside of the destination directory.");
103+
}
104+
98105
entry.ExtractToFile(destFileName);
99106
}
100107
}

src/Application/src/RazorPagesTestSample/config.json

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

src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.3" />
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
1515
<PackageReference Include="Moq" Version="4.20.70" />
16-
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
16+
<PackageReference Include="Newtonsoft.Json" Version="11.0.3" />
1717
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />
1818
<PackageReference Include="System.Net.Http" Version="4.3.4" />
1919
<PackageReference Include="xunit" Version="2.7.0" />

0 commit comments

Comments
 (0)