Skip to content

Commit 3afbd6a

Browse files
author
Admin user
committed
security fix
1 parent b9dcad6 commit 3afbd6a

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

.github/workflows/reusable-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
id-token: write
1919
environment:
2020
name: ${{ inputs.environment }}
21-
url: "https://techexcel-${{ inputs.environment }}.azurewebsites.net/"
21+
url: "https://ghwxvgb4jngfa-${{ inputs.environment }}.azurewebsites.net/"
2222
steps:
2323
- uses: azure/[email protected]
2424
with:

.gitignore

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

22
.DS_Store
3+
# Local configuration file for developers
4+
src/Application/src/RazorPagesTestSample/config.json

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,24 @@ public async Task<IActionResult> OnPostAnalyzeMessagesAsync()
9292
return RedirectToPage();
9393
}
9494

95+
96+
9597
public static void WriteToDirectory(ZipArchiveEntry entry, string destDirectory)
9698
{
99+
// Get the full path of the destination file
97100
string destFileName = Path.Combine(destDirectory, entry.FullName);
98-
entry.ExtractToFile(destFileName);
101+
102+
// Ensure the destination directory exists
103+
Directory.CreateDirectory(Path.GetDirectoryName(destFileName));
104+
105+
// Check if the destination file path is within the intended directory
106+
if (!destFileName.StartsWith(Path.GetFullPath(destDirectory), StringComparison.OrdinalIgnoreCase))
107+
{
108+
throw new InvalidOperationException("Attempt to extract file outside of the destination directory.");
109+
}
110+
111+
// Extract the file
112+
entry.ExtractToFile(destFileName, overwrite: true);
99113
}
100114
}
101115
}

src/Application/src/RazorPagesTestSample/config.json

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

0 commit comments

Comments
 (0)