mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Website: Update body parser error handling. (#31427)
Closes: https://github.com/fleetdm/fleet/issues/31418 Changes: - Updated the body parser middleware to return a 403 response if a multi-part request is sent to a URL that could be for a static asset.
This commit is contained in:
parent
cb4f1e447a
commit
1f11196b67
1 changed files with 3 additions and 0 deletions
3
website/config/http.js
vendored
3
website/config/http.js
vendored
|
|
@ -59,6 +59,9 @@ module.exports.http = {
|
|||
// If an error occurs while parsing an incoming request body, we'll return a badRequest response if error.statusCode is between 400-500
|
||||
if (_.isNumber(err.statusCode) && err.statusCode >= 400 && err.statusCode < 500) {
|
||||
return res.status(400).send(err.message);
|
||||
// If an error occurs and this was a request going to a static asset, return a 403 response.
|
||||
} else if(req.url.match(sails.LOOKS_LIKE_ASSET_RX)) {
|
||||
return res.status(403).send();
|
||||
} else {
|
||||
sails.log.error('Sending 500 ("Server Error") response: \n', err);
|
||||
return res.status(500).send();
|
||||
|
|
|
|||
Loading…
Reference in a new issue