Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ protected void postHandler(User user) {

checkPermission(user, registrarId, actionType.getNecessaryPermission());

boolean isSuperuser = actionType.runAsSuperuser();
ImmutableMap<String, ConsoleEppOutput> result =
domainList.domainList.stream()
.collect(
toImmutableMap(d -> d, d -> executeEpp(actionType.getXmlContentsToRun(d), user)));
toImmutableMap(
d -> d, d -> executeEpp(actionType.getXmlContentsToRun(d), isSuperuser)));
Comment on lines +105 to +110

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must land after (or rebased onto) #3287:
Setting runAsSuperuser() = true for SUSPEND and UNSUSPEND bypasses DomainUpdateFlow's verifyResourceOwnership and checkAllowedAccessToTld checks for all users holding SUSPEND_DOMAIN (including non-admin FTE and SUPPORT_LEAD users, who previously ran with isSuperuser = false).

Without #3287's registrar ownership check in place first:

  1. Non-admin FTE and SUPPORT_LEAD requests tagged with registrarId = RegistrarB can suspend/unsuspend domains sponsored by RegistrarA.
  2. handleHistoryAdditions below then logs RegistrarB|<domain> in ConsoleUpdateHistory, misattributing the audit entry to RegistrarB and hiding the action from RegistrarA's Console Activity History.

When rebasing onto #3287, also add a test verifying cross-registrar SUSPEND/UNSUSPEND rejection for non-admin FTE/SUPPORT_LEAD users.

handleHistoryAdditions(result, actionType);
// Front end should parse situations where only some commands worked
consoleApiParams.response().setPayload(consoleApiParams.gson().toJson(result));
Expand All @@ -125,19 +127,24 @@ private void handleHistoryAdditions(
e ->
finishAndPersistConsoleUpdateHistory(
new ConsoleUpdateHistory.Builder()
.setDescription(e.getKey())
.setDescription(
String.format(
"%s%s%s",
registrarId,
ConsoleUpdateHistory.DESCRIPTION_SEPARATOR,
e.getKey()))
.setType(actionType.getConsoleUpdateHistoryType()))));
}

private ConsoleEppOutput executeEpp(String xml, User user) {
private ConsoleEppOutput executeEpp(String xml, boolean isSuperuser) {
return ConsoleEppOutput.fromEppOutput(
eppController.handleEppCommand(
new StatelessRequestSessionMetadata(
registrarId, ProtocolDefinition.getVisibleServiceExtensionUris()),
new PasswordOnlyTransportCredentials(),
EppRequestSource.CONSOLE,
false,
user.getUserRoles().isAdmin(),
isSuperuser,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify if intentional — registrar EPP PollMessage suppressed & DomainHistory attributed to the registrar itself:
executeEpp runs EppController with StatelessRequestSessionMetadata(registrarId, ...) (the sponsoring registrar's ID, rather than registryAdminClientId) and isSuperuser = true.

In DomainUpdateFlow.createPollMessageForServerStatusUpdates, if (registrarId.equals(existingDomain.getPersistedCurrentSponsorRegistrarId())) returns Optional.empty(). As a result:

  1. No EPP PollMessage.OneTime ("The registry administrator has added/removed the status(es) ...") is enqueued for the sponsoring registrar when a domain is suspended/unsuspended from the Console (unlike CLI suspensions via UpdateServerLocksCommand using the admin client ID).
  2. DomainHistory.registrarId and Domain.lastEppUpdateRegistrarId record the sponsoring registrar as having suspended its own domain, even though <metadata:requestedByRegistrar>false</metadata:requestedByRegistrar> is set.

xml.getBytes(UTF_8)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class ConsoleBulkDomainDeleteActionType extends ConsoleDomainActionType {

private static final String DOMAIN_DELETE_XML =
"""
"""
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
Expand All @@ -40,7 +40,8 @@ public class ConsoleBulkDomainDeleteActionType extends ConsoleDomainActionType {
</extension>
<clTRID>RegistryConsole</clTRID>
</command>
</epp>""";
</epp>\
""";

public ConsoleBulkDomainDeleteActionType(JsonElement jsonElement) {
super(jsonElement);
Expand All @@ -56,6 +57,11 @@ public ConsolePermission getNecessaryPermission() {
return ConsolePermission.EXECUTE_EPP_COMMANDS;
}

@Override
public boolean runAsSuperuser() {
return false;
}

@Override
public ConsoleUpdateHistory.Type getConsoleUpdateHistoryType() {
return ConsoleUpdateHistory.Type.DOMAIN_DELETE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class ConsoleBulkDomainSuspendActionType extends ConsoleDomainActionType {

private static final String DOMAIN_SUSPEND_XML =
"""
"""
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<epp
xmlns="urn:ietf:params:xml:ns:epp-1.0">
Expand Down Expand Up @@ -50,7 +50,8 @@ public class ConsoleBulkDomainSuspendActionType extends ConsoleDomainActionType
</extension>
<clTRID>RegistryConsole</clTRID>
</command>
</epp>""";
</epp>\
""";

public ConsoleBulkDomainSuspendActionType(JsonElement jsonElement) {
super(jsonElement);
Expand All @@ -66,6 +67,11 @@ public ConsolePermission getNecessaryPermission() {
return ConsolePermission.SUSPEND_DOMAIN;
}

@Override
public boolean runAsSuperuser() {
return true;
}

@Override
public ConsoleUpdateHistory.Type getConsoleUpdateHistoryType() {
return ConsoleUpdateHistory.Type.DOMAIN_SUSPEND;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class ConsoleBulkDomainUnsuspendActionType extends ConsoleDomainActionType {

private static final String DOMAIN_SUSPEND_XML =
"""
"""
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<epp
xmlns="urn:ietf:params:xml:ns:epp-1.0">
Expand Down Expand Up @@ -50,7 +50,8 @@ public class ConsoleBulkDomainUnsuspendActionType extends ConsoleDomainActionTyp
</extension>
<clTRID>RegistryConsole</clTRID>
</command>
</epp>""";
</epp>\
""";

public ConsoleBulkDomainUnsuspendActionType(JsonElement jsonElement) {
super(jsonElement);
Expand All @@ -66,6 +67,11 @@ public ConsolePermission getNecessaryPermission() {
return ConsolePermission.SUSPEND_DOMAIN;
}

@Override
public boolean runAsSuperuser() {
return true;
}

@Override
public ConsoleUpdateHistory.Type getConsoleUpdateHistoryType() {
return ConsoleUpdateHistory.Type.DOMAIN_UNSUSPEND;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ public String getXmlContentsToRun(String domainName) {
/** Returns the permission necessary to successfully perform this action. */
public abstract ConsolePermission getNecessaryPermission();

/**
* Returns whether the EPP command for this action runs with superuser privileges.
*
* <p>This is evaluated only after {@link #getNecessaryPermission()} has been verified, and it
* applies to all users regardless of whether they are admins.
*/
public abstract boolean runAsSuperuser();

/** Returns the type of history / audit logging object to save. */
public abstract ConsoleUpdateHistory.Type getConsoleUpdateHistoryType();

Expand Down
Loading
Loading