Selaa lähdekoodia

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

master
Aaron van Meerten 3 vuotta sitten
vanhempi
commit
81c4e9a7fd
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  1. 7
    0
      resources/prosody-plugins/token/util.lib.lua

+ 7
- 0
resources/prosody-plugins/token/util.lib.lua Näytä tiedosto

@@ -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";

Loading…
Peruuta
Tallenna