Merge pull request #2396 from nextcloud/enh/noid/improve-accepted-domains-feedback

add further domain validation feedback
This commit is contained in:
Simon L 2023-04-22 11:41:25 +02:00 committed by GitHub
commit 07dc39c832
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -239,6 +239,16 @@ class ConfigurationManager
throw new InvalidSettingConfigurationException("Domain must contain at least one dot!");
}
// Validate that no slashes are contained
if (strpos($domain, '/') !== false) {
throw new InvalidSettingConfigurationException("Domain must not contain slashes!");
}
// Validate that no colons are contained
if (strpos($domain, ':') !== false) {
throw new InvalidSettingConfigurationException("Domain must not contain colons!");
}
// Validate domain
if (!filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
throw new InvalidSettingConfigurationException("Domain is not a valid domain!");