浏览代码

fix: prosody: token alg is checked before public key is used

master
Aaron van Meerten 3 年前
父节点
当前提交
81c4e9a7fd
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7
    0
      resources/prosody-plugins/token/util.lib.lua

+ 7
- 0
resources/prosody-plugins/token/util.lib.lua 查看文件

@@ -270,6 +270,13 @@ function Util:process_and_verify_token(session, acceptedIssuers)
270 270
         if kid == nil then
271 271
             return false, "not-allowed", "'kid' claim is missing";
272 272
         end
273
+        local alg = header["alg"];
274
+        if alg == nil then
275
+            return false, "not-allowed", "'alg' claim is missing";
276
+        end
277
+        if alg.sub(alg,1,2) ~= "RS" then
278
+            return false, "not-allowed", "'kid' claim only support with RS family";
279
+        end
273 280
         pubKey = self:get_public_key(kid);
274 281
         if pubKey == nil then
275 282
             return false, "not-allowed", "could not obtain public key";

正在加载...
取消
保存