mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-15 14:12:27 +00:00
Refactor deserialization and authentication (#550)
* Refactor deserialization and more * Refactor authentication flow * Fix unit tests * Make deserialization better
This commit is contained in:
parent
505b5eb03b
commit
b3a00da554
48 changed files with 575 additions and 589 deletions
|
@ -14,10 +14,9 @@ public class ResourcesController : ControllerBase
|
|||
string path = FileHelper.GetImagePath($"{hash}.png");
|
||||
|
||||
string fullPath = Path.GetFullPath(path);
|
||||
string basePath = Path.GetFullPath(FileHelper.ImagePath);
|
||||
|
||||
// Prevent directory traversal attacks
|
||||
if (!fullPath.StartsWith(basePath)) return this.BadRequest();
|
||||
if (!fullPath.StartsWith(FileHelper.FullImagePath)) return this.BadRequest();
|
||||
|
||||
if (IOFile.Exists(path)) return this.File(IOFile.OpenRead(path), "image/png");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue