Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Merge branch 'master' into aaronkvanmeerten/jibri-queue-component-modules

Aaron van Meerten0c48e205d7b7
diff --cc resources/prosody-plugins/token/util.lib.lua
index 46246c3d75,22c663011b..fa86b235d2
--- a/resources/prosody-plugins/token/util.lib.lua
+++ b/resources/prosody-plugins/token/util.lib.lua
@@@ -127,28 -114,36 +128,31 @@@ function Util:get_public_key(keyId
-- If the key is not found in the cache.
module:log("debug", "Cache miss for key: "..keyId);
local code;
+ local timeout_occurred;
local wait, done = async.waiter();
local function cb(content_, code_, response_, request_)
- content, code = content_, code_;
- if code == 200 or code == 204 then
- self.cache:set(keyId, content);
+ if timeout_occurred == nil then
+ content, code = content_, code_;
+ if code == 200 or code == 204 then
- cache:set(keyId, content);
++ self.cache:set(keyId, content);
++ else
++ module:log("warn", "Error on public key request: Code %s, Content %s",
++ code_, content_);
+ end
+ done();
else
- module:log("warn", "Error on public key request: Code %s, Content %s",
- code_, content_);
+ module:log("warn", "public key reply delivered after timeout from: %s",keyurl);
end
- done();
end
- local keyurl = path.join(self.asapKeyServer, hex.to(sha256(keyId))..'.pem');
- module:log("debug", "Fetching public key from: "..keyurl);
-
- -- We hash the key ID to work around some legacy behavior and make
- -- deployment easier. It also helps prevent directory
- -- traversal attacks (although path cleaning could have done this too).
- local request = http.request(keyurl, {
- headers = http_headers or {},
- method = "GET"
- }, cb);
-
-- TODO: Is the done() call racey? Can we cancel this if the request
-- succeedes?
local function cancel()
-- TODO: This check is racey. Not likely to be a problem, but we should
-- still stick a mutex on content / code at some point.
if code == nil then
- -- no longer present in prosody 0.11, so check before calling
+ timeout_occurred = true;
+ module:log("warn", "Timeout %s seconds fetching public key from: %s",http_timeout,keyurl);
- if http.destroy_request then
+ if http.destroy_request ~= nil then
http.destroy_request(request);
end
done();
@@@ -183,10 -166,10 +187,14 @@@ en
--- Verifies issuer part of token
-- @param 'iss' claim from the token to verify
+ -- @param 'acceptedIssuers' list of issuers to check
-- @return nil and error string or true for accepted claim
- function Util:verify_issuer(issClaim)
- module:log("debug","verify_issuer claim: %s against accepted: %s",issClaim, self.acceptedIssuers);
- for i, iss in ipairs(self.acceptedIssuers) do
+ function Util:verify_issuer(issClaim, acceptedIssuers)
++ if not acceptedIssuers then
++ acceptedIssuers = self.acceptedIssuers
++ end
++ module:log("debug","verify_issuer claim: %s against accepted: %s",issClaim, acceptedIssuers);
+ for i, iss in ipairs(acceptedIssuers) do
if issClaim == iss then
--claim matches an accepted issuer so return success
return true;