Skip to content

Fix Console bulk domain suspend and history - #3278

Open
CydeWeys wants to merge 1 commit into
google:masterfrom
CydeWeys:fix-console-bulk-domain-suspend
Open

CydeWeys wants to merge 1 commit into
google:masterfrom
CydeWeys:fix-console-bulk-domain-suspend

Conversation

@CydeWeys

@CydeWeys CydeWeys commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Fix two bugs in ConsoleBulkDomainAction:

  • Add runAsSuperuser() to ConsoleDomainActionType (returning true for
    SUSPEND and UNSUSPEND and false for DELETE) and pass it to
    EppController instead of user.getUserRoles().isAdmin(). Previously,
    DomainUpdateFlow rejected the server-only suspension statuses for
    non-admin FTE and SUPPORT_LEAD users who hold SUSPEND_DOMAIN.
    Superuser status is now driven solely by the action type, so DELETE
    never runs as superuser through the bulk domain action, even for
    admins. Superuser deletes, which bypass server statuses and can
    delete domains immediately, remain available through the nomulus CLI.
  • Prefix ConsoleUpdateHistory descriptions with <registrarId>| using
    ConsoleUpdateHistory.DESCRIPTION_SEPARATOR so bulk domain actions are
    returned by ConsoleHistoryDataAction's registrar history query and
    parsed properly in the Console history UI.
  • Add unit tests in ConsoleBulkDomainActionTest covering non-admin FTE
    and SUPPORT_LEAD suspend/unsuspend flows, permission enforcement,
    non-superuser DELETE for both admin and non-admin users, and
    ConsoleHistoryDataAction queries.

BUG= http://b/586480958


This change is Reviewable

@CydeWeys
CydeWeys requested a review from ptkach November 18, 2026 21:31
@CydeWeys

Copy link
Copy Markdown
Member Author

Do note that there are reasons to perform a superuser delete (that bypasses some checks and even can delete a domain instantly, bypassing the normal deletion lifecycle). However, this probably doesn't need to be doable through the bulk domain action.

Fix two bugs in ConsoleBulkDomainAction:

- Add runAsSuperuser() to ConsoleDomainActionType (returning true for
  SUSPEND and UNSUSPEND and false for DELETE) and pass it to
  EppController instead of user.getUserRoles().isAdmin(). Previously,
  DomainUpdateFlow rejected the server-only suspension statuses for
  non-admin FTE and SUPPORT_LEAD users who hold SUSPEND_DOMAIN.
  Superuser status is now driven solely by the action type, so DELETE
  never runs as superuser through the bulk domain action, even for
  admins. Superuser deletes, which bypass server statuses and can
  delete domains immediately, remain available through the nomulus CLI.
- Prefix ConsoleUpdateHistory descriptions with '<registrarId>|' using
  ConsoleUpdateHistory.DESCRIPTION_SEPARATOR so bulk domain actions are
  returned by ConsoleHistoryDataAction's registrar history query and
  parsed properly in the Console history UI.
- Add unit tests in ConsoleBulkDomainActionTest covering non-admin FTE
  and SUPPORT_LEAD suspend/unsuspend flows, permission enforcement,
  non-superuser DELETE for both admin and non-admin users, and
  ConsoleHistoryDataAction queries.

BUG= http://b/586480958
Comment on lines +105 to +110
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)));

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.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants