mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Tighten up restrictions on domain/host naming on EPP resources
All domain/host names should be stored in their canonical forms (puny- coded and lower-cased). This validation is already in the flows, but this adds protection against bad data from other sources, e.g. admin consoles or RDE imports. This also removes an old work-around that temporarily suspended this validation for superusers, because we used to have non-canonicalized data in the system. The non-canonicalized data has since all been cleaned up, so this work-around is no longer necessary. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=146799558
This commit is contained in:
parent
ec55aa5361
commit
d2bc569b4b
11 changed files with 49 additions and 31 deletions
|
@ -26,6 +26,7 @@ import static google.registry.util.CollectionUtils.nullToEmpty;
|
|||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableSortedCopy;
|
||||
import static google.registry.util.CollectionUtils.union;
|
||||
import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
|
||||
import static google.registry.util.DomainNameUtils.getTldFromDomainName;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
|
||||
|
@ -209,6 +210,9 @@ public abstract class DomainBase extends EppResource {
|
|||
}
|
||||
|
||||
public B setFullyQualifiedDomainName(String fullyQualifiedDomainName) {
|
||||
checkArgument(
|
||||
fullyQualifiedDomainName.equals(canonicalizeDomainName(fullyQualifiedDomainName)),
|
||||
"Domain name must be in puny-coded, lower-case form");
|
||||
getInstance().fullyQualifiedDomainName = fullyQualifiedDomainName;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
|
||||
package google.registry.model.host;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.collect.Sets.difference;
|
||||
import static com.google.common.collect.Sets.union;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.model.ofy.Ofy.RECOMMENDED_MEMCACHE_EXPIRATION;
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -164,6 +166,9 @@ public class HostResource extends EppResource implements ForeignKeyedEppResource
|
|||
}
|
||||
|
||||
public Builder setFullyQualifiedHostName(String fullyQualifiedHostName) {
|
||||
checkArgument(
|
||||
fullyQualifiedHostName.equals(canonicalizeDomainName(fullyQualifiedHostName)),
|
||||
"Host name must be in puny-coded, lower-case form");
|
||||
getInstance().fullyQualifiedHostName = fullyQualifiedHostName;
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue