diff --git a/java/google/registry/flows/contact/ContactInfoFlow.java b/java/google/registry/flows/contact/ContactInfoFlow.java
index 2f35f48b4..4e15f1870 100644
--- a/java/google/registry/flows/contact/ContactInfoFlow.java
+++ b/java/google/registry/flows/contact/ContactInfoFlow.java
@@ -21,6 +21,7 @@ import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import com.google.common.base.Optional;
import google.registry.flows.EppException;
+import google.registry.flows.FlowModule.ClientId;
import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.LoggedInFlow;
import google.registry.model.contact.ContactResource;
@@ -33,12 +34,14 @@ import javax.inject.Inject;
*
*
The response includes the contact's postal info, phone numbers, emails, the authInfo which can
* be used to request a transfer and the details of the contact's most recent transfer if it has
- * ever been transferred. Any registrar can see any contact's information.
+ * ever been transferred. Any registrar can see any contact's information, but the authInfo is only
+ * visible to the registrar that owns the contact or to a registrar that already supplied it.
*
* @error {@link google.registry.flows.exceptions.ResourceToQueryDoesNotExistException}
*/
public final class ContactInfoFlow extends LoggedInFlow {
+ @Inject @ClientId String clientId;
@Inject @TargetId String targetId;
@Inject Optional authInfo;
@Inject ContactInfoFlow() {}
@@ -47,6 +50,9 @@ public final class ContactInfoFlow extends LoggedInFlow {
public final EppOutput run() throws EppException {
ContactResource contact = loadResourceForQuery(ContactResource.class, targetId, now);
verifyOptionalAuthInfoForResource(authInfo, contact);
+ if (!clientId.equals(contact.getCurrentSponsorClientId()) && !authInfo.isPresent()) {
+ contact = contact.asBuilder().setAuthInfo(null).build();
+ }
return createOutput(SUCCESS, cloneResourceWithLinkedStatus(contact, now));
}
}
diff --git a/javatests/google/registry/flows/contact/ContactInfoFlowTest.java b/javatests/google/registry/flows/contact/ContactInfoFlowTest.java
index d0c87dd0f..0236f74b2 100644
--- a/javatests/google/registry/flows/contact/ContactInfoFlowTest.java
+++ b/javatests/google/registry/flows/contact/ContactInfoFlowTest.java
@@ -118,6 +118,49 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase
+
+
+
+ sh8013
+
+
+ ABC-12345
+
+
diff --git a/javatests/google/registry/flows/contact/testdata/contact_info_response_no_authinfo.xml b/javatests/google/registry/flows/contact/testdata/contact_info_response_no_authinfo.xml
new file mode 100644
index 000000000..2ad7709fd
--- /dev/null
+++ b/javatests/google/registry/flows/contact/testdata/contact_info_response_no_authinfo.xml
@@ -0,0 +1,44 @@
+
+
+
+ Command completed successfully
+
+
+
+ sh8013
+ SH8013-REP
+
+
+ John Doe
+ Example Inc.
+
+ 123 Example Dr.
+ Suite 100
+ Dulles
+ VA
+ 20166-6503
+ US
+
+
+ +1.7035555555
+ +1.7035555556
+ jdoe@example.com
+ TheRegistrar
+ NewRegistrar
+ 1999-04-03T22:00:00.0Z
+ NewRegistrar
+ 1999-12-03T09:00:00.0Z
+ 2000-04-08T09:00:00.0Z
+
+
+
+
+
+
+
+ ABC-12345
+ server-trid
+
+
+