File tree Expand file tree Collapse file tree 4 files changed +18
-6
lines changed
src/Application/src/RazorPagesTestSample Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 18
18
id-token : write
19
19
environment :
20
20
name : ${{ inputs.environment }}
21
- url : " https://techexcel -${{ inputs.environment }}.azurewebsites.net/"
21
+ url : " https://ghwxvgb4jngfa -${{ inputs.environment }}.azurewebsites.net/"
22
22
steps :
23
23
24
24
with :
Original file line number Diff line number Diff line change 1
1
2
2
.DS_Store
3
+ # Local configuration file for developers
4
+ src /Application /src /RazorPagesTestSample /config.json
Original file line number Diff line number Diff line change @@ -92,10 +92,24 @@ public async Task<IActionResult> OnPostAnalyzeMessagesAsync()
92
92
return RedirectToPage ( ) ;
93
93
}
94
94
95
+
96
+
95
97
public static void WriteToDirectory ( ZipArchiveEntry entry , string destDirectory )
96
98
{
99
+ // Get the full path of the destination file
97
100
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 ) ;
99
113
}
100
114
}
101
115
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments