aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/secure.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/secure.js')
-rw-r--r--server/middlewares/secure.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/server/middlewares/secure.js b/server/middlewares/secure.js
index 58f824d14..fd5bc51d6 100644
--- a/server/middlewares/secure.js
+++ b/server/middlewares/secure.js
@@ -12,27 +12,27 @@ const secureMiddleware = {
12} 12}
13 13
14function checkSignature (req, res, next) { 14function checkSignature (req, res, next) {
15 const url = req.body.signature.url 15 const host = req.body.signature.host
16 Pod.loadByUrl(url, function (err, pod) { 16 Pod.loadByHost(host, function (err, pod) {
17 if (err) { 17 if (err) {
18 logger.error('Cannot get signed url in decryptBody.', { error: err }) 18 logger.error('Cannot get signed host in decryptBody.', { error: err })
19 return res.sendStatus(500) 19 return res.sendStatus(500)
20 } 20 }
21 21
22 if (pod === null) { 22 if (pod === null) {
23 logger.error('Unknown pod %s.', url) 23 logger.error('Unknown pod %s.', host)
24 return res.sendStatus(403) 24 return res.sendStatus(403)
25 } 25 }
26 26
27 logger.debug('Decrypting body from %s.', url) 27 logger.debug('Decrypting body from %s.', host)
28 28
29 const signatureOk = peertubeCrypto.checkSignature(pod.publicKey, url, req.body.signature.signature) 29 const signatureOk = peertubeCrypto.checkSignature(pod.publicKey, host, req.body.signature.signature)
30 30
31 if (signatureOk === true) { 31 if (signatureOk === true) {
32 return next() 32 return next()
33 } 33 }
34 34
35 logger.error('Signature is not okay in decryptBody for %s.', req.body.signature.url) 35 logger.error('Signature is not okay in decryptBody for %s.', req.body.signature.host)
36 return res.sendStatus(403) 36 return res.sendStatus(403)
37 }) 37 })
38} 38}