comparison mod_http_oauth2/mod_http_oauth2.lua @ 5401:c8d04ac200fc

mod_http_oauth2: Reject loopback URIs as client_uri This really should be a proper website with info, https://localhost is not good enough. Ideally we'd validate that it's got proper DNS and is actually reachable, but triggering HTTP or even DNS lookups seems like it would carry abuse potential that would best to avoid.
author Kim Alvefur <zash@zash.se>
date Tue, 02 May 2023 16:20:55 +0200
parents 71766a4a7322
children fbf3ede7541b
comparison
equal deleted inserted replaced
5400:71766a4a7322 5401:c8d04ac200fc
752 client_metadata[propname] = propspec.default; 752 client_metadata[propname] = propspec.default;
753 end 753 end
754 end 754 end
755 755
756 local client_uri = url.parse(client_metadata.client_uri); 756 local client_uri = url.parse(client_metadata.client_uri);
757 if not client_uri or client_uri.scheme ~= "https" then 757 if not client_uri or client_uri.scheme ~= "https" or loopbacks:contains(client_uri.host) then
758 return nil, oauth_error("invalid_request", "Missing, invalid or insecure client_uri"); 758 return nil, oauth_error("invalid_request", "Missing, invalid or insecure client_uri");
759 end 759 end
760 760
761 for _, redirect_uri in ipairs(client_metadata.redirect_uris) do 761 for _, redirect_uri in ipairs(client_metadata.redirect_uris) do
762 if not redirect_uri_allowed(redirect_uri, client_uri, client_metadata.application_type) then 762 if not redirect_uri_allowed(redirect_uri, client_uri, client_metadata.application_type) then