From 8031ceea11f19b3a04dce149ac3ac84130b7199b Mon Sep 17 00:00:00 2001 From: Nick Hatt Date: Thu, 29 Oct 2015 16:45:41 -0500 Subject: [PATCH] don't send stack track back for body parse errors when environment is production --- lib/hooks/http/middleware/defaults.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/hooks/http/middleware/defaults.js b/lib/hooks/http/middleware/defaults.js index 857a44b12..26514afd2 100644 --- a/lib/hooks/http/middleware/defaults.js +++ b/lib/hooks/http/middleware/defaults.js @@ -168,6 +168,9 @@ module.exports = function(sails, app) { // is overridden in userland. Should probably be phased out at some point, // since it could be accomplished more elegantly- btu for now it's practical.) handleBodyParserError: function handleBodyParserError(err, req, res, next) { + if(IS_PRODUCTION){ + return res.send(400); + } var bodyParserFailureErrorMsg = 'Unable to parse HTTP body- error occurred :: ' + util.inspect((err&&err.stack)?err.stack:err, false, null); sails.log.error(bodyParserFailureErrorMsg); return res.send(400, bodyParserFailureErrorMsg);