fix: server crashes when receiving file download request with invalid byte range; this fixes a security vulnerability that allows an attacker to impact the availability of the server instance; the fix improves parsing of the range parameter to properly handle invalid range requests ([GHSA-h423-w6qv-2wj3](https://github.com/parse-community/parse-server/security/advisories/GHSA-h423-w6qv-2wj3)) [skip release] (#8237)
This commit is contained in:
@@ -266,5 +266,10 @@ export class FilesRouter {
|
||||
}
|
||||
|
||||
function isFileStreamable(req, filesController) {
|
||||
return req.get('Range') && typeof filesController.adapter.handleFileStream === 'function';
|
||||
const range = (req.get('Range') || '/-/').split('-');
|
||||
const start = Number(range[0]);
|
||||
const end = Number(range[1]);
|
||||
return (
|
||||
(!isNaN(start) || !isNaN(end)) && typeof filesController.adapter.handleFileStream === 'function'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user