Repository navigation
Description
Since v2.4.12, the mdq metadata source (SimpleSAML\Metadata\Sources\MDQ) can no longer download metadata. Every lookup that is not already in the cache fails with:
Error: Call to undefined method SimpleSAML\Utils\HTTP::createHttpClient()
The call came with the backport of the MDQ entityID checks in 8e11903 ("Merge commit from fork"). That commit added this to MDQ::getMetaData() (src/SimpleSAML/Metadata/Sources/MDQ.php:330):
$client = $this->httpUtils->createHttpClient([
'headers' => ['Accept' => 'application/samlmetadata+xml'],
]);
Utils\HTTP::createHttpClient() exists only in 2.5. On the 2.4 branch the method does not exist, and $client is never used: the metadata is still downloaded a few lines below with $httpUtils->fetch($mdq_url, $context), through a
separately created Utils\HTTP instance.
The tests added in the same commit injected a Utils\HTTP double that defines createHttpClient(), so they passed. They were removed from the legacy branch in f82c9b2, so nothing covers this code path with the real Utils\HTTP class.
Because Error is not an Exception, the catch (Exception $e) around the download does not catch it either. The whole metadata lookup aborts, and every IdP or SP that comes only from MDQ becomes unusable (e.g. login via eduGAIN fails).
Affected versions: v2.4.12, v2.4.13 (v2.4.11 is not affected).
Steps to reproduce
- Configure an MDQ source, e.g.:
'metadata.sources' => [
[
'type' => 'mdq',
'server' => 'https://mdq.aai.dfn.de',
'validateCertificate' => '/path/to/mdq-signer.crt',
'cachedir' => '/tmp/mdq-cache',
],
], - With an empty cache directory, look up any entity:
$handler = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler();
$handler->getMetaData('https://idp.example.org/idp/shibboleth', 'saml20-idp-remote'); - Result: Error: Call to undefined method SimpleSAML\Utils\HTTP::createHttpClient().
Expected behaviour: the metadata is downloaded with Utils\HTTP::fetch(), as in v2.4.11, and the new entityID checks are applied.
Suggested fix (2.4 branch): remove the unused statement:
-
$client = $this->httpUtils->createHttpClient([ -
'headers' => ['Accept' => 'application/samlmetadata+xml'], -
]);
Optionally, use the injected $this->httpUtils for the fetch() call instead of new Utils\HTTP(), so that setHttpUtils() actually affects the download and the code path can be tested.
Workaround until a fix is released: subclass the source (in a module) and, after parent::__construct(), call setHttpUtils() with a Utils\HTTP subclass that defines a no-op createHttpClient(). This restores the 2.4.11 download path and
keeps the entityID checks.
Activity