Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/WebAuthn.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,12 @@ private function _checkOrigin($origin) {
$host = \parse_url($origin, PHP_URL_HOST);
$host = \trim($host, '.');

// The RP ID must be equal to the origin's effective domain, or a registrable
// domain suffix of the origin's effective domain.
return \preg_match('/' . \preg_quote($this->_rpId) . '$/i', $host) === 1;
// The RP ID must be equal to the origin's effective domain, or the
// origin's host must be a subdomain of the RP ID (i.e. preceded by a dot).
if (\strcasecmp($host, $this->_rpId) === 0) {
return true;
}
return \str_ends_with(\strtolower($host), '.' . \strtolower($this->_rpId));
}

/**
Expand Down