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

@ -360,19 +360,6 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.hasStatusValue(StatusValue.SERVER_UPDATE_PROHIBITED);
}
@Test
public void testSuccess_superuserCanSpecifyInvalidExistingHostName() throws Exception {
persistActiveHost("NS1.çiça199.tld.");
clock.advanceOneMilli();
setEppHostUpdateInput("NS1.çiça199.tld.", "ns1.xn--ia199-xrab.tld", null, null);
runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("host_update_response.xml"));
clock.advanceOneMilli();
assertThat(loadByForeignKey(HostResource.class, "NS1.çiça199.tld.", clock.nowUtc())).isNull();
assertThat(loadByForeignKey(HostResource.class, "ns1.xn--ia199-xrab.tld", clock.nowUtc()))
.isNotNull();
}
@Test
public void testSuccess_subordToSubord_lastTransferTimeFromPreviousSuperordinateWinsOut()
throws Exception {
@ -720,7 +707,6 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
@Test
public void testFailure_referToNonLowerCaseHostname() throws Exception {
persistActiveHost("ns1.EXAMPLE.tld");
setEppHostUpdateInput("ns1.EXAMPLE.tld", "ns2.example.tld", null, null);
thrown.expect(HostNameNotLowerCaseException.class);
runFlow();
@ -736,7 +722,6 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
@Test
public void testFailure_referToNonPunyCodedHostname() throws Exception {
persistActiveHost("ns1.çauçalito.tld");
setEppHostUpdateInput("ns1.çauçalito.tld", "ns1.sausalito.tld", null, null);
thrown.expect(HostNameNotPunyCodedException.class, "expected ns1.xn--aualito-txac.tld");
runFlow();