Skip to content

Commit 260b0db

Browse files
committed
Remove contact as a supported object type in EPP
This primarily affects the EPP greeting. We already were erroring out when any contact flows attempted to be run; this should just prevent registrars from even trying them at all. This PR is designed to be minimally invasive, and does not remove any of the contact flows or Jakarta XML/XJC objects/files themselves. That can be done later as a follow-up. Also note that the contact namespace urn:ietf:params:xml:ns:contact-1.0 is still present for now in RDE exports, but I'll remove that subsequently as well. This is a redo of PR #2932, which had been reverted, but now controlled via FeatureFlag so that it won't be enabled until we schedule it to do so (and only after sufficient time has passed after notifying registrars in advance). BUG= http://b/475506288
1 parent f2f9694 commit 260b0db

File tree

25 files changed

+65
-31
lines changed

25 files changed

+65
-31
lines changed

core/src/main/java/google/registry/flows/session/LoginFlow.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package google.registry.flows.session;
1616

1717
import static com.google.common.collect.Sets.difference;
18+
import static google.registry.model.common.FeatureFlag.FeatureName.PROHIBIT_CONTACT_OBJECTS_ON_LOGIN;
1819
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
1920
import static google.registry.util.CollectionUtils.nullToEmpty;
2021

@@ -39,6 +40,7 @@
3940
import google.registry.flows.TlsCredentials.MissingRegistrarCertificateException;
4041
import google.registry.flows.TransportCredentials;
4142
import google.registry.flows.TransportCredentials.BadRegistrarPasswordException;
43+
import google.registry.model.common.FeatureFlag;
4244
import google.registry.model.eppcommon.ProtocolDefinition;
4345
import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension;
4446
import google.registry.model.eppinput.EppInput;
@@ -114,9 +116,13 @@ private EppResponse runWithoutLogging() throws EppException {
114116
}
115117
Services services = login.getServices();
116118
stopwatch.tick("LoginFlow getServices");
117-
Set<String> unsupportedObjectServices = difference(
118-
nullToEmpty(services.getObjectServices()),
119-
ProtocolDefinition.SUPPORTED_OBJECT_SERVICES);
119+
120+
Set<String> unsupportedObjectServices =
121+
difference(
122+
nullToEmpty(services.getObjectServices()),
123+
FeatureFlag.isActiveNow(PROHIBIT_CONTACT_OBJECTS_ON_LOGIN)
124+
? ProtocolDefinition.SUPPORTED_OBJECT_SERVICES
125+
: ProtocolDefinition.SUPPORTED_OBJECT_SERVICES_WITH_CONTACT);
120126
stopwatch.tick("LoginFlow difference unsupportedObjectServices");
121127
if (!unsupportedObjectServices.isEmpty()) {
122128
throw new UnimplementedObjectServiceException();

core/src/main/java/google/registry/model/common/FeatureFlag.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public enum FeatureStatus {
6464

6565
/** The names of the feature flags that can be individually set. */
6666
public enum FeatureName {
67+
6768
/** Feature flag name used for testing only. */
6869
TEST_FEATURE(FeatureStatus.INACTIVE),
6970

@@ -76,7 +77,10 @@ public enum FeatureName {
7677
/**
7778
* If we're including the upcoming domain drop date in the exported list of registered domains.
7879
*/
79-
INCLUDE_PENDING_DELETE_DATE_FOR_DOMAINS(FeatureStatus.INACTIVE);
80+
INCLUDE_PENDING_DELETE_DATE_FOR_DOMAINS(FeatureStatus.INACTIVE),
81+
82+
/** If we're prohibiting the inclusion of the contact object URI on login. */
83+
PROHIBIT_CONTACT_OBJECTS_ON_LOGIN(FeatureStatus.INACTIVE);
8084

8185
private final FeatureStatus defaultStatus;
8286

core/src/main/java/google/registry/model/eppcommon/ProtocolDefinition.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ public class ProtocolDefinition {
4646
public static final String LANGUAGE = "en";
4747

4848
public static final ImmutableSet<String> SUPPORTED_OBJECT_SERVICES =
49-
ImmutableSet.of(
50-
"urn:ietf:params:xml:ns:host-1.0",
51-
"urn:ietf:params:xml:ns:domain-1.0",
52-
"urn:ietf:params:xml:ns:contact-1.0");
49+
ImmutableSet.of("urn:ietf:params:xml:ns:host-1.0", "urn:ietf:params:xml:ns:domain-1.0");
50+
51+
public static final ImmutableSet<String> SUPPORTED_OBJECT_SERVICES_WITH_CONTACT =
52+
new ImmutableSet.Builder<String>()
53+
.addAll(SUPPORTED_OBJECT_SERVICES)
54+
.add("urn:ietf:params:xml:ns:contact-1.0")
55+
.build();
5356

5457
/** Enum representing which environments should have which service extensions enabled. */
5558
private enum ServiceExtensionVisibility {

core/src/test/java/google/registry/flows/domain/DomainCheckFlowTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,6 @@ void testFeeExtension_invalid_multipleCurrencies_std_v1() {
11511151
.marshalsToXml();
11521152
}
11531153

1154-
11551154
@Test
11561155
void testSuccess_eapFeeCheck_std_v1() throws Exception {
11571156
runEapFeeCheckTestWithXmlInputOutput(

core/src/test/java/google/registry/flows/session/LoginFlowTestCase.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@
1616

1717
import static com.google.common.io.BaseEncoding.base64;
1818
import static com.google.common.truth.Truth.assertThat;
19+
import static google.registry.model.common.FeatureFlag.FeatureName.PROHIBIT_CONTACT_OBJECTS_ON_LOGIN;
1920
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
2021
import static google.registry.testing.DatabaseHelper.deleteResource;
2122
import static google.registry.testing.DatabaseHelper.loadRegistrar;
2223
import static google.registry.testing.DatabaseHelper.persistResource;
2324
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
25+
import static google.registry.util.DateTimeUtils.START_OF_TIME;
2426
import static org.junit.jupiter.api.Assertions.assertThrows;
2527

2628
import com.google.common.collect.ImmutableMap;
29+
import com.google.common.collect.ImmutableSortedMap;
2730
import google.registry.flows.EppException;
2831
import google.registry.flows.EppException.UnimplementedExtensionException;
2932
import google.registry.flows.EppException.UnimplementedObjectServiceException;
@@ -36,6 +39,8 @@
3639
import google.registry.flows.session.LoginFlow.RegistrarAccountNotActiveException;
3740
import google.registry.flows.session.LoginFlow.TooManyFailedLoginsException;
3841
import google.registry.flows.session.LoginFlow.UnsupportedLanguageException;
42+
import google.registry.model.common.FeatureFlag;
43+
import google.registry.model.common.FeatureFlag.FeatureStatus;
3944
import google.registry.model.eppoutput.EppOutput;
4045
import google.registry.model.registrar.Registrar;
4146
import google.registry.model.registrar.Registrar.State;
@@ -56,6 +61,11 @@ void beforeEachLoginFlowTestCase() {
5661
sessionMetadata.setRegistrarId(null); // Don't implicitly log in (all other flows need to).
5762
registrar = loadRegistrar("NewRegistrar");
5863
registrarBuilder = registrar.asBuilder();
64+
persistResource(
65+
new FeatureFlag.Builder()
66+
.setFeatureName(PROHIBIT_CONTACT_OBJECTS_ON_LOGIN)
67+
.setStatusMap(ImmutableSortedMap.of(START_OF_TIME, FeatureStatus.ACTIVE))
68+
.build());
5969
}
6070

6171
// Can't inline this since it may be overridden in subclasses.
@@ -117,6 +127,21 @@ void testFailure_invalidExtension() {
117127
doFailingTest("login_invalid_extension.xml", UnimplementedExtensionException.class);
118128
}
119129

130+
@Test
131+
void testFailure_invalidContactObjectUri() {
132+
doFailingTest("login_with_contact_objuri.xml", UnimplementedObjectServiceException.class);
133+
}
134+
135+
@Test
136+
void testSuccess_contactObjectUri_worksWhenNotProhibited() throws Exception {
137+
persistResource(
138+
FeatureFlag.get(PROHIBIT_CONTACT_OBJECTS_ON_LOGIN)
139+
.asBuilder()
140+
.setStatusMap(ImmutableSortedMap.of(START_OF_TIME, FeatureStatus.INACTIVE))
141+
.build());
142+
doSuccessfulTest("login_with_contact_objuri.xml");
143+
}
144+
120145
@Test
121146
void testFailure_invalidTypes() {
122147
doFailingTest("login_invalid_types.xml", UnimplementedObjectServiceException.class);

core/src/test/java/google/registry/model/eppinput/EppInputTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ void testUnmarshalling_login() throws Exception {
6868
assertThat(loginCommand.options.version).isEqualTo("1.0");
6969
assertThat(loginCommand.options.language).isEqualTo("en");
7070
assertThat(loginCommand.services.objectServices)
71-
.containsExactly(
72-
"urn:ietf:params:xml:ns:host-1.0",
73-
"urn:ietf:params:xml:ns:domain-1.0",
74-
"urn:ietf:params:xml:ns:contact-1.0");
71+
.containsExactly("urn:ietf:params:xml:ns:host-1.0", "urn:ietf:params:xml:ns:domain-1.0");
7572
assertThat(loginCommand.services.serviceExtensions)
7673
.containsExactly("urn:ietf:params:xml:ns:launch-1.0", "urn:ietf:params:xml:ns:rgp-1.0");
7774
}

core/src/test/resources/google/registry/flows/greeting.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<version>1.0</version>
77
<lang>en</lang>
88
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
9-
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
109
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
1110
<svcExtension>
1211
<extURI>urn:ietf:params:xml:ns:launch-1.0</extURI>

core/src/test/resources/google/registry/flows/login.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<svcs>
1111
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
1212
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
13-
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
1413
<svcExtension>
1514
<extURI>urn:ietf:params:xml:ns:launch-1.0</extURI>
1615
<extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>

core/src/test/resources/google/registry/flows/login_update_password.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<svcs>
1212
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
1313
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
14-
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
1514
<svcExtension>
1615
<extURI>urn:ietf:params:xml:ns:launch-1.0</extURI>
1716
<extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>

core/src/test/resources/google/registry/flows/login_valid_fee_extension.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<svcs>
1111
<objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
1212
<objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
13-
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
1413
<svcExtension>
1514
<extURI>urn:ietf:params:xml:ns:launch-1.0</extURI>
1615
<extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>

0 commit comments

Comments
 (0)