-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abzu-160537-fix snyk issue related to Path Traversal #323
base: main
Are you sure you want to change the base?
Conversation
2a8c62e
to
87210c4
Compare
@@ -96,7 +97,7 @@ public ActionResult DownloadFile(string batchId, string fileName) | |||
} | |||
if (!string.IsNullOrEmpty(fileName)) | |||
{ | |||
bytes = fileShareService.GetFileData(configuration["HOME"], batchId, fileName); | |||
bytes = fileShareService.GetFileData(configuration["HOME"], Sanitise(batchId), fileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're (rightly) sanitising the BatchId, should we also consider the same for the filename? The filename is not allowed to include any path characters. It would be harder to provide an allowed list of characters, but we could exclude \
, /
, and :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also just realised that this is a mock, so possibly not worth doing!
HttpContext.Response.Headers.Add("x-redirect-status", "true"); | ||
} | ||
|
||
return File(bytes, "application/octet-stream", fileName); | ||
} | ||
|
||
public static string Sanitise(string text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very generic method name for a rather specific sanitisation. Should it be called something like SanitiseBatchId
? For example, it wouldn't be correct to use the current method to sanitise any other input.
No description provided.