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 84420e3afbbf6861719b48cbd0941519b33c1b6e..480c3a3b9348726a381a1d0cf49d33c19a58dcde 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()