diff options
Diffstat (limited to 'middlewares')
-rw-r--r-- | middlewares/misc.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/middlewares/misc.js b/middlewares/misc.js index 9755eeff0..c10b0792a 100644 --- a/middlewares/misc.js +++ b/middlewares/misc.js | |||
@@ -28,7 +28,12 @@ | |||
28 | PodsDB.findOne({ url: req.body.signature.url }, function (err, pod) { | 28 | PodsDB.findOne({ url: req.body.signature.url }, function (err, pod) { |
29 | if (err) { | 29 | if (err) { |
30 | logger.error('Cannot get signed url in decryptBody.', { error: err }) | 30 | logger.error('Cannot get signed url in decryptBody.', { error: err }) |
31 | res.sendStatus(500) | 31 | return res.sendStatus(500) |
32 | } | ||
33 | |||
34 | if (pod === null) { | ||
35 | logger.error('Unknown pod %s.', req.body.signature.url) | ||
36 | return res.sendStatus(403) | ||
32 | } | 37 | } |
33 | 38 | ||
34 | logger.debug('Decrypting body from %s.', req.body.signature.url) | 39 | logger.debug('Decrypting body from %s.', req.body.signature.url) |
@@ -43,7 +48,7 @@ | |||
43 | delete req.body.key | 48 | delete req.body.key |
44 | } else { | 49 | } else { |
45 | logger.error('Signature is not okay in decryptBody for %s.', req.body.signature.url) | 50 | logger.error('Signature is not okay in decryptBody for %s.', req.body.signature.url) |
46 | res.sendStatus(500) | 51 | return res.sendStatus(403) |
47 | } | 52 | } |
48 | 53 | ||
49 | next() | 54 | next() |