Skip to content
Extraits de code Groupes Projets
Valider e5e7943d rédigé par stackcoder's avatar stackcoder
Parcourir les fichiers

Allow underscores in trusted hosts

Underscores are valid characters in domain names, so don't prohibit them in trustedHosts[].
Also the domain name should be validated before creating the list with an invalid entry.
parent 8439a888
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -232,18 +232,18 @@ class Url ...@@ -232,18 +232,18 @@ class Url
$trustedHosts = self::getTrustedHosts(); $trustedHosts = self::getTrustedHosts();
// Only punctuation we allow is '[', ']', ':', '.', '_' and '-'
$hostLength = strlen($host);
if ($hostLength !== strcspn($host, '`~!@#$%^&*()+={}\\|;"\'<>,?/ ')) {
return false;
}
// if no trusted hosts, just assume it's valid // if no trusted hosts, just assume it's valid
if (empty($trustedHosts)) { if (empty($trustedHosts)) {
self::saveTrustedHostnameInConfig($host); self::saveTrustedHostnameInConfig($host);
return true; return true;
} }
// Only punctuation we allow is '[', ']', ':', '.' and '-'
$hostLength = strlen($host);
if ($hostLength !== strcspn($host, '`~!@#$%^&*()_+={}\\|;"\'<>,?/ ')) {
return false;
}
foreach ($trustedHosts as &$trustedHost) { foreach ($trustedHosts as &$trustedHost) {
$trustedHost = preg_quote($trustedHost); $trustedHost = preg_quote($trustedHost);
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter