Skip to content

Add cert hostname console UI behind feature flag - #3300

Open
anomaly2104 wants to merge 1 commit into
google:masterfrom
anomaly2104:epp-cert-console-ui
Open

anomaly2104 wants to merge 1 commit into
google:masterfrom
anomaly2104:epp-cert-console-ui

Conversation

@anomaly2104

@anomaly2104 anomaly2104 commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Shorter public TLS certificate lifetimes make manual fingerprint pinning
harder for registrars to maintain, so EPP login is moving to
hostname-based certificate authentication. Gate the new Registrar
Console Security settings UI behind a feature flag so it can land safely
ahead of EPP login enablement.

  • Add ALLOW_EPP_CLIENT_CERT_HOSTNAME_AUTH to FeatureFlag (and update
    db-schema.sql.generated) and expose allowEppClientCertHostnameAuth in
    /console-api/userdata, failing closed to false on lookup errors.
  • Show and edit Allowed EPP Client Certificate Hostnames and Revoked
    Client Certificate Hashes in Console Security settings when enabled
    (up to 20 entries each, with Back button and fail-fast openssl hash
    command), unifying StringListItem and list add/remove/conversion
    helpers across IP allowlist and certificate lists.
  • Guard saves against unloaded registrar state, omit hidden cert fields
    in SecurityService.saveChanges() when the flag is inactive, and omit
    unchanged cert fields on save to avoid stale-tab overwrites.

Partially implements b/573176420 (eppClientCertAuth.allowFingerprintAuth
config and RegistryConfig accessor will follow in a separate PR).

BUG=b/573176719


This change is Reviewable

@anomaly2104
anomaly2104 requested a review from CydeWeys November 26, 2026 16:55
@anomaly2104
anomaly2104 enabled auto-merge December 1, 2026 02:45
@ptkach
ptkach self-requested a review December 1, 2026 16:15

@ptkach ptkach left a comment

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.

Has it been deployed to alpha yet to see how it looks?

@ptkach made 7 comments.
Reviewable status: 0 of 13 files reviewed, 6 unresolved discussions (waiting on anomaly2104 and CydeWeys).


console-webapp/src/app/settings/security/security.component.html line 126 at r2 (raw file):

          <h2>Allowed EPP Client Certificate Hostnames</h2>
        </mat-list-item>
        <mat-list-item role="listitem">

is it missing lines parameter?


console-webapp/src/app/settings/security/security.component.spec.ts line 274 at r2 (raw file):

  });

  it('should omit hidden hostname and revoked hash fields when flag is inactive', async () => {

gemini identified that this and "userdata undefined" tests are nearly identical and add 100 lines of code. Can you please refactor?

Code quote:

flag is inactive

console-webapp/src/app/settings/security/security.component.spec.ts line 280 at r2 (raw file):

    >;
    const originalRegistrar = registrarSignal();
    try {

here and at all of the bottom tests there's a lot of boilerplate try {registrarSignal.set()} catch {}. Can you refactor and just create a fresh registrarSignal in beforeEach similar to what you did to userDataSignal


console-webapp/src/app/settings/security/securityEdit.component.html line 74 at r2 (raw file):

      Allow EPP logins with a certificate issued by a publicly trusted CA whose
      Subject Alternative Name (SAN) dNSName matches one of these exact
      hostnames (no wildcards; Subject CN is ignored; up to 20 entries). Once

how is it enforced on ui?

Code quote:

up to 20 entries

console-webapp/src/app/settings/security/securityEdit.component.html line 79 at r2 (raw file):

    @for ( hostname of dataSource().allowedEppClientCertificateHostnames; track
    hostname ) {
    <div class="settings-security__edit-ip">

it looks like it reuses a class name from. a difference css block - edit_ip? Can you either extract shared styling or create a separate block?


console-webapp/src/app/settings/security/securityEdit.component.ts line 90 at r2 (raw file):

    const payload: SecuritySettings = { ...this.dataSource() };
    if (!this.securityService.allowEppClientCertHostnameAuth()) {
      delete payload.allowedEppClientCertificateHostnames;

I'm curious why this is in UI component and not in a service? Seems like something service should be doing

@CydeWeys CydeWeys left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The backend, schema, and wire-contract pieces look clean overall, and the core feature-flag wiring and partial-update preservation behavior match SecurityAction. Requesting changes for a few blocking frontend issues (the unloaded-registrar() save hazard and moving flag-off omission to the service boundary), @ptkach's open cleanup items, and b/573176420 tracking:

  • b/573176420 partial implementation & PR description: b/573176420 also calls for eppClientCertAuth.allowFingerprintAuth in config plus a RegistryConfig accessor, which isn't in master or this PR yet. Please note in the PR/commit description that b/573176420 is only partially implemented here so it isn't closed on merge. While updating the description, consider opening with 1-2 sentences on why this change is needed (shorter certificate lifetimes motivating hostname-based auth, and feature-flagging the UI so it can land safely ahead of EPP login enablement) and noting the new /console-api/userdata field and db-schema.sql.generated update.
  • +1 to @ptkach's open cleanup items: unifying IpAllowListItem / StringListItem, sharing list conversion helpers (with .trim() applied consistently), collapsing the 8 add/remove methods to 2, replacing the reused settings-security__edit-ip class name, dropping the null as unknown as test if strict-impossible null guards are removed, and verifying the rendered UI visually on alpha.
  • Adjacent UX / reactivity items outside this diff (fine here or in an immediate follow-up):
    1. securityEdit.component.html currently has no Back/Cancel button calling goBack() (unlike rdapEdit.component.html, eppPasswordEdit.component.html, and contactDetails.component.html). Adding one prevents users from getting stuck in edit mode if they clear their last configured hostname and hit the HTTP 400 error.
    2. Pre-existing in security.component.ts (lines 44-52): the effect() tracks registrarService.registrar() instead of registrarService.registrarId(), so a background registrars reload emits a new object reference and kicks the user out of edit mode, discarding unsaved edits (see rdap.component.ts for the registrarId() pattern).

"technicalDocsUrl", technicalDocsUrl));
"technicalDocsUrl", technicalDocsUrl,
// Gates Console UI visibility for EPP client certificate hostname management
// (SecurityAction writes remain open; EPP login authentication checks this flag

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Design question: since SecurityAction forbids clearing allowedEppClientCertificateHostnames once non-empty and there is currently no nomulus CLI flag to edit or clear hostnames/revoked hashes, a user with EDIT_REGISTRAR_DETAILS can POST /console-api/settings/security directly while ALLOW_EPP_CLIENT_CERT_HOSTNAME_AUTH is INACTIVE and lock into a non-empty hostname state that is hidden in the Console UI. Can you confirm whether keeping SecurityAction writes ungated (e.g., for dark-launch pre-configuration) is intentional, versus rejecting writes to allowedEppClientCertificateHostnames while the flag is INACTIVE?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Adding a concrete kill-switch risk here: because UserDataService caches allowEppClientCertHostnameAuth: true for the entire browser tab lifetime without refresh and SecurityAction performs no server-side flag check, flipping ALLOW_EPP_CLIENT_CERT_HOSTNAME_AUTH back from ACTIVE to INACTIVE does not stop open browser tabs or direct API callers from continuing to write both fields indefinitely — reinforcing the need to evaluate server-side gating on SecurityAction writes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Keeping SecurityAction writes ungated is intentional. EPP login validation will check ALLOW_EPP_CLIENT_CERT_HOSTNAME_AUTH independently, so even if someone sets hostnames via an open tab or direct API call while the flag is INACTIVE, they won't be used during EPP login.

* the Registrar Console UI for managing allowed certificate hostnames and revoked certificate
* hashes.
*/
ALLOW_EPP_CLIENT_CERT_HOSTNAME_AUTH(FeatureStatus.INACTIVE);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Design question: this single flag gates Console UI visibility for both allowed hostnames and revokedClientCertificateHashes, even though Registrar enforces revocations against pinned certificates too. If we ever roll this flag back to INACTIVE as an emergency kill-switch, registrars/admins lose Console access to manage revoked certificate hashes with no CLI fallback. Confirming that coupling is acceptable for launch?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, keeping them under the same flag is intentional. Revocation hashes are needed for hostname-based auth; for fingerprint-based auth, registrars pin the actual certificate itself, so revoking via hash doesn't really make sense there (removing/replacing the cert already revokes it).

@CydeWeys CydeWeys left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Follow-up security pass surfaced 3 additional security issues in this PR (1 high, 2 medium) and 2 minor UX/error-handling notes (4 inline below; the non-diff error-handling note and pre-existing backend items are listed here):

Minor error-handling note (outside diff hunk)

  • console-webapp/src/app/settings/security/securityEdit.component.ts:99-100: this._snackBar.open(err.error || err.message) renders [object ProgressEvent] on network errors. Consider typeof err.error === 'string' && err.error ? err.error : err.message.

Pre-existing surrounding backend items worth tracking as follow-ups (out of scope for this PR)

  • SecurityAction.java:175-176: passes ImmutableSet.of() for contacts to sendExternalUpdatesIfNecessary (unlike RdapRegistrarFieldsAction.java:115-120), so registrar ADMIN POCs receive no email alerts when allowed certificate hostnames or revoked hashes are modified or un-revoked.
  • SecurityAction.java:82-88: loads savedRegistrar outside tm().transact(...) without optimistic concurrency control (lastUpdateTime/version check), creating a backend TOCTOU lost-update window on concurrent saves.
  • Registrar.java:901-947: runs ICU4J IDNA / base64().omitPadding().decode() on every input element before checking <= 20 (and without pre-checking hash.length() == 43) inside tm().transact(...), and currently accepts the empty-input SHA-256 constant 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU.

@anomaly2104

anomaly2104 commented Dec 4, 2026 •

Copy link
Copy Markdown
Member Author

Has it been deployed to alpha yet to see how it looks?

@ptkach made 7 comments.
Reviewable status: 0 of 13 files reviewed, 6 unresolved discussions (waiting on anomaly2104 and CydeWeys).

console-webapp/src/app/settings/security/security.component.html line 126 at r2 (raw file):

          <h2>Allowed EPP Client Certificate Hostnames</h2>
        </mat-list-item>
        <mat-list-item role="listitem">

is it missing lines parameter?

console-webapp/src/app/settings/security/security.component.spec.ts line 274 at r2 (raw file):

  });

  it('should omit hidden hostname and revoked hash fields when flag is inactive', async () => {

gemini identified that this and "userdata undefined" tests are nearly identical and add 100 lines of code. Can you please refactor?

Code quote:

flag is inactive

console-webapp/src/app/settings/security/security.component.spec.ts line 280 at r2 (raw file):

    >;
    const originalRegistrar = registrarSignal();
    try {

here and at all of the bottom tests there's a lot of boilerplate try {registrarSignal.set()} catch {}. Can you refactor and just create a fresh registrarSignal in beforeEach similar to what you did to userDataSignal

console-webapp/src/app/settings/security/securityEdit.component.html line 74 at r2 (raw file):

      Allow EPP logins with a certificate issued by a publicly trusted CA whose
      Subject Alternative Name (SAN) dNSName matches one of these exact
      hostnames (no wildcards; Subject CN is ignored; up to 20 entries). Once

how is it enforced on ui?

Code quote:

up to 20 entries

console-webapp/src/app/settings/security/securityEdit.component.html line 79 at r2 (raw file):

    @for ( hostname of dataSource().allowedEppClientCertificateHostnames; track
    hostname ) {
    <div class="settings-security__edit-ip">

it looks like it reuses a class name from. a difference css block - edit_ip? Can you either extract shared styling or create a separate block?

console-webapp/src/app/settings/security/securityEdit.component.ts line 90 at r2 (raw file):

    const payload: SecuritySettings = { ...this.dataSource() };
    if (!this.securityService.allowEppClientCertHostnameAuth()) {
      delete payload.allowedEppClientCertificateHostnames;

I'm curious why this is in UI component and not in a service? Seems like something service should be doing

  1. Yes, deployed to alpha and tested both states.
  2. lines is not needed. Adding lines will truncate it and I verified on alpha that it wraps cleanly. Screencast added.
  3. Consolidated those with it.each (also covering loaded userData with allowEppClientCertHostnameAuth omitted).
  4. Done. registrarSignal and registrarIdSignal are now created fresh in beforeEach and all the try/finally blocks are removed.
  5. Updated both + Add Hostname and + Add Revoked Certificate Hash to disable once the list hits 20 entries (also guarded in addEntry()), and added an N / 20 counter next to the button.
  6. Renamed settings-security__edit-ip to settings-security__edit-list-item and reused it across all three list sections (had avoided renaming it initially to keep the existing IP markup untouched).
  7. Fair point. Moved the flag-off omission into SecurityService.saveChanges() and added service-level tests for both flag-on and flag-off cases.

@anomaly2104 anomaly2104 closed this Dec 4, 2026
auto-merge was automatically disabled December 4, 2026 10:23

Pull request was closed

@anomaly2104 anomaly2104 reopened this Dec 4, 2026
@anomaly2104

Copy link
Copy Markdown
Member Author

The backend, schema, and wire-contract pieces look clean overall, and the core feature-flag wiring and partial-update preservation behavior match SecurityAction. Requesting changes for a few blocking frontend issues (the unloaded-registrar() save hazard and moving flag-off omission to the service boundary), @ptkach's open cleanup items, and b/573176420 tracking:

  • b/573176420 partial implementation & PR description: b/573176420 also calls for eppClientCertAuth.allowFingerprintAuth in config plus a RegistryConfig accessor, which isn't in master or this PR yet. Please note in the PR/commit description that b/573176420 is only partially implemented here so it isn't closed on merge. While updating the description, consider opening with 1-2 sentences on why this change is needed (shorter certificate lifetimes motivating hostname-based auth, and feature-flagging the UI so it can land safely ahead of EPP login enablement) and noting the new /console-api/userdata field and db-schema.sql.generated update.

  • +1 to @ptkach's open cleanup items: unifying IpAllowListItem / StringListItem, sharing list conversion helpers (with .trim() applied consistently), collapsing the 8 add/remove methods to 2, replacing the reused settings-security__edit-ip class name, dropping the null as unknown as test if strict-impossible null guards are removed, and verifying the rendered UI visually on alpha.

  • Adjacent UX / reactivity items outside this diff (fine here or in an immediate follow-up):

    1. securityEdit.component.html currently has no Back/Cancel button calling goBack() (unlike rdapEdit.component.html, eppPasswordEdit.component.html, and contactDetails.component.html). Adding one prevents users from getting stuck in edit mode if they clear their last configured hostname and hit the HTTP 400 error.
    2. Pre-existing in security.component.ts (lines 44-52): the effect() tracks registrarService.registrar() instead of registrarService.registrarId(), so a background registrars reload emits a new object reference and kicks the user out of edit mode, discarding unsaved edits (see rdap.component.ts for the registrarId() pattern).

All addressed:

  • Updated the commit/PR description to explain the motivation, mention /console-api/userdata and db-schema.sql.generated, and note that b/573176420 is only partially implemented here.
  • Addressed the blocking frontend issues, all of @ptkach's cleanup items, and verified the UI visually on alpha (both flag active and inactive).
  • For the Back button and security.component.ts effect() tracking registrarId(): those were pre-existing so I hadn't changed them initially, but since they came up in review I fixed both here as well.

@anomaly2104

Copy link
Copy Markdown
Member Author

Follow-up security pass surfaced 3 additional security issues in this PR (1 high, 2 medium) and 2 minor UX/error-handling notes (4 inline below; the non-diff error-handling note and pre-existing backend items are listed here):

Minor error-handling note (outside diff hunk)

  • console-webapp/src/app/settings/security/securityEdit.component.ts:99-100: this._snackBar.open(err.error || err.message) renders [object ProgressEvent] on network errors. Consider typeof err.error === 'string' && err.error ? err.error : err.message.

Pre-existing surrounding backend items worth tracking as follow-ups (out of scope for this PR)

  • SecurityAction.java:175-176: passes ImmutableSet.of() for contacts to sendExternalUpdatesIfNecessary (unlike RdapRegistrarFieldsAction.java:115-120), so registrar ADMIN POCs receive no email alerts when allowed certificate hostnames or revoked hashes are modified or un-revoked.
  • SecurityAction.java:82-88: loads savedRegistrar outside tm().transact(...) without optimistic concurrency control (lastUpdateTime/version check), creating a backend TOCTOU lost-update window on concurrent saves.
  • Registrar.java:901-947: runs ICU4J IDNA / base64().omitPadding().decode() on every input element before checking <= 20 (and without pre-checking hash.length() == 43) inside tm().transact(...), and currently accepts the empty-input SHA-256 constant 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU.

Fixed the ProgressEvent snackbar fallback (typeof err.error === 'string' && err.error ? err.error : err.message). Hadn't touched it earlier since it was pre-existing, but updated it now along with a test. Thanks for flagging the pre-existing backend items too; I'll keep those out of this PR as suggested.

@CydeWeys CydeWeys left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the thorough updates! The code, security fixes, reactivity updates, and tests in 9d3cd5c10c all look clean and address every comment from the previous round.

One minor public-repo hygiene request before approving: could you please remove the two internal screencast links from the PR description and your earlier comment (and attach them to b/573176719 instead) so internal hostnames aren't left on this public GitHub PR? (Good that they aren't in the commit message.)

@ptkach ptkach left a comment

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.

@ptkach reviewed 15 files and all commit messages, and resolved 1 discussion.
Reviewable status: all files reviewed, 21 unresolved discussions (waiting on anomaly2104 and CydeWeys).

Shorter public TLS certificate lifetimes make manual fingerprint pinning
harder for registrars to maintain, so EPP login is moving to
hostname-based certificate authentication. Gate the new Registrar
Console Security settings UI behind a feature flag so it can land safely
ahead of EPP login enablement.

- Add ALLOW_EPP_CLIENT_CERT_HOSTNAME_AUTH to FeatureFlag (and update
  db-schema.sql.generated) and expose allowEppClientCertHostnameAuth in
  /console-api/userdata, failing closed to false on lookup errors.
- Show and edit Allowed EPP Client Certificate Hostnames and Revoked
  Client Certificate Hashes in Console Security settings when enabled
  (up to 20 entries each, with Back button and fail-fast openssl hash
  command), unifying StringListItem and list add/remove/conversion
  helpers across IP allowlist and certificate lists.
- Guard saves against unloaded registrar state, omit hidden cert fields
  in SecurityService.saveChanges() when the flag is inactive, and omit
  unchanged cert fields on save to avoid stale-tab overwrites.

Partially implements b/573176420 (eppClientCertAuth.allowFingerprintAuth
config and RegistryConfig accessor will follow in a separate PR).

BUG=b/573176719
@anomaly2104

Copy link
Copy Markdown
Member Author

Thanks for the thorough updates! The code, security fixes, reactivity updates, and tests in 9d3cd5c10c all look clean and address every comment from the previous round.

One minor public-repo hygiene request before approving: could you please remove the two internal screencast links from the PR description and your earlier comment (and attach them to b/573176719 instead) so internal hostnames aren't left on this public GitHub PR? (Good that they aren't in the commit message.)

Done

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.

3 participants