Skip to content

Commit 3d7e959

Browse files
authored
Merge pull request #927 from aneno-m-e/MOODLE_500_STABLE
auth_saml2 Ignore invalid idp request parameters
2 parents 9001926 + c251781 commit 3d7e959

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

classes/auth.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ public function saml_login() {
613613

614614
// We store the IdP in the session to generate the config/config.php array with the default local SP.
615615
$idpalias = optional_param('idpalias', '', PARAM_TEXT);
616+
$idp = optional_param('idp', '', PARAM_TEXT);
616617
if (!empty($idpalias)) {
617618
$idpfound = false;
618619

@@ -627,8 +628,11 @@ public function saml_login() {
627628
if (!$idpfound) {
628629
$this->error_page(get_string('noidpfound', 'auth_saml2', $idpalias));
629630
}
630-
} else if (isset($_GET['idp'])) {
631-
$SESSION->saml2idp = $_GET['idp'];
631+
} else if (!empty($idp)) {
632+
if (array_key_exists($idp, $this->metadataentities)) {
633+
$idpentity = $this->metadataentities[$idp];
634+
$SESSION->saml2idp = $idpentity->md5entityid;
635+
}
632636
} else if (!is_null($this->defaultidp)) {
633637
$SESSION->saml2idp = $this->defaultidp->md5entityid;
634638
} else if ($this->multiidp) {

0 commit comments

Comments
 (0)