From aa267fb6a251f7be8457ac23acd35e43aa5e9aaf Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Mon, 6 Feb 2023 15:22:21 +0800 Subject: [PATCH] fix: verify sign error --- .../uni-id-co/middleware/verify-request-sign.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/middleware/verify-request-sign.js b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/middleware/verify-request-sign.js index 84420e3..480c3a3 100644 --- a/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/middleware/verify-request-sign.js +++ b/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/middleware/verify-request-sign.js @@ -8,10 +8,15 @@ const needSignFunctions = new Set([ module.exports = function () { const methodName = this.getMethodName() const { source } = this.getUniversalClientInfo() - // 非 HTTP 方式请求不需要鉴权 - if (source !== 'http') return // 指定接口需要鉴权 if (!needSignFunctions.has(methodName)) return + + // 非 HTTP 方式请求不需要鉴权 + if (source !== 'http') { + throw { + errCode: ERROR.ILLEGAL_REQUEST + } + } const timeout = 20 * 1000 // 请求超过20秒不能再请求,防止重放攻击 const { headers, body: _body } = this.getHttpInfo() -- GitLab