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:
mcilwain 2017-02-07 10:06:38 -08:00 committed by Ben McIlwain
parent ec55aa5361
commit d2bc569b4b
11 changed files with 49 additions and 31 deletions

View file

@ -422,4 +422,18 @@ public class DomainResourceTest extends EntityTestCase {
public void testToHydratedString_notCircular() {
domain.toHydratedString(); // If there are circular references, this will overflow the stack.
}
@Test
public void testFailure_uppercaseDomainName() {
thrown.expect(
IllegalArgumentException.class, "Domain name must be in puny-coded, lower-case form");
domain.asBuilder().setFullyQualifiedDomainName("AAA.BBB");
}
@Test
public void testFailure_utf8DomainName() {
thrown.expect(
IllegalArgumentException.class, "Domain name must be in puny-coded, lower-case form");
domain.asBuilder().setFullyQualifiedDomainName("みんな.みんな");
}
}