aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/secure.js9
-rw-r--r--server/middlewares/validators/remote/signature.js2
2 files changed, 9 insertions, 2 deletions
diff --git a/server/middlewares/secure.js b/server/middlewares/secure.js
index 2aae715c4..b6e6d818b 100644
--- a/server/middlewares/secure.js
+++ b/server/middlewares/secure.js
@@ -23,7 +23,14 @@ function checkSignature (req, res, next) {
23 23
24 logger.debug('Checking signature from %s.', host) 24 logger.debug('Checking signature from %s.', host)
25 25
26 const signatureOk = peertubeCrypto.checkSignature(pod.publicKey, host, req.body.signature.signature) 26 let signatureShouldBe
27 if (req.body.data) {
28 signatureShouldBe = req.body.data
29 } else {
30 signatureShouldBe = host
31 }
32
33 const signatureOk = peertubeCrypto.checkSignature(pod.publicKey, signatureShouldBe, req.body.signature.signature)
27 34
28 if (signatureOk === true) { 35 if (signatureOk === true) {
29 res.locals.secure = { 36 res.locals.secure = {
diff --git a/server/middlewares/validators/remote/signature.js b/server/middlewares/validators/remote/signature.js
index 5880a2c2c..002232c05 100644
--- a/server/middlewares/validators/remote/signature.js
+++ b/server/middlewares/validators/remote/signature.js
@@ -11,7 +11,7 @@ function signature (req, res, next) {
11 req.checkBody('signature.host', 'Should have a signature host').isURL() 11 req.checkBody('signature.host', 'Should have a signature host').isURL()
12 req.checkBody('signature.signature', 'Should have a signature').notEmpty() 12 req.checkBody('signature.signature', 'Should have a signature').notEmpty()
13 13
14 logger.debug('Checking signature parameters', { parameters: { signatureHost: req.body.signature.host } }) 14 logger.debug('Checking signature parameters', { parameters: { signature: req.body.signature } })
15 15
16 checkErrors(req, res, next) 16 checkErrors(req, res, next)
17} 17}