[remoting]: Remove enterprise params from JSON message interface. [chromium/src : main]

0 views
Skip to first unread message

Joe Downing (Gerrit)

unread,
Apr 2, 2026, 1:48:30 PM (yesterday) Apr 2
to Yuwei Huang, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org
Attention needed from Yuwei Huang

Joe Downing added 1 comment

Patchset-level comments
File-level comment, Patchset 7 (Latest):
Joe Downing . resolved

PTAL!

Open in Gerrit

Related details

Attention is currently required from:
  • Yuwei Huang
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I820691d9a8a4ccafdedf00c5f56c74e7adf62c2f
Gerrit-Change-Number: 7718584
Gerrit-PatchSet: 7
Gerrit-Owner: Joe Downing <joe...@chromium.org>
Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
Gerrit-Attention: Yuwei Huang <yuw...@chromium.org>
Gerrit-Comment-Date: Thu, 02 Apr 2026 17:48:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Yuwei Huang (Gerrit)

unread,
Apr 2, 2026, 2:44:12 PM (yesterday) Apr 2
to Joe Downing, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org
Attention needed from Joe Downing

Yuwei Huang voted and added 3 comments

Votes added by Yuwei Huang

Code-Review+1

3 comments

Patchset-level comments
Yuwei Huang . resolved

LGTM w/ AI comments that look valid to me.

File remoting/host/it2me/it2me_native_messaging_host.cc
Line 305, Patchset 7 (Latest): if (reconnect_params_.has_value()) {
Yuwei Huang . unresolved

Since `reconnect_params_` is now a member variable, you can eliminate the local `std::optional<ReconnectParams> reconnect_params;` entirely and avoid an unnecessary copy.

Also, doing the `CHECK` here means the host will crash if `reconnect_params_` is set but `enterprise_params_` is not. In the previous logic, reconnect parameters were gracefully ignored if it wasn't an enterprise session.

Consider removing the local `std::optional<ReconnectParams>` and simplifying this section to just:
```cpp
#if BUILDFLAG(IS_CHROMEOS) || !defined(NDEBUG)
bool is_enterprise_admin_user = enterprise_params_.has_value();
#endif
```
Line 381, Patchset 7 (Latest): if (reconnect_params.has_value()) {
Yuwei Huang . unresolved

If you remove the local `reconnect_params` above, you can update this block to use the member variable directly and safely perform the `CHECK` here since we are inside the `is_enterprise_admin_user` block:

```cpp
if (reconnect_params_.has_value()) {
CHECK(enterprise_params_->allow_reconnections);
it2me_host_->set_reconnect_params(*reconnect_params_);
}
```
Open in Gerrit

Related details

Attention is currently required from:
  • Joe Downing
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I820691d9a8a4ccafdedf00c5f56c74e7adf62c2f
    Gerrit-Change-Number: 7718584
    Gerrit-PatchSet: 7
    Gerrit-Owner: Joe Downing <joe...@chromium.org>
    Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
    Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Attention: Joe Downing <joe...@chromium.org>
    Gerrit-Comment-Date: Thu, 02 Apr 2026 18:44:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joe Downing (Gerrit)

    unread,
    Apr 2, 2026, 2:56:37 PM (yesterday) Apr 2
    to Yuwei Huang, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org

    Joe Downing voted and added 3 comments

    Votes added by Joe Downing

    Commit-Queue+2

    3 comments

    Patchset-level comments
    File-level comment, Patchset 8 (Latest):
    Joe Downing . resolved

    Thanks!

    File remoting/host/it2me/it2me_native_messaging_host.cc
    Line 305, Patchset 7: if (reconnect_params_.has_value()) {
    Yuwei Huang . resolved

    Since `reconnect_params_` is now a member variable, you can eliminate the local `std::optional<ReconnectParams> reconnect_params;` entirely and avoid an unnecessary copy.

    Also, doing the `CHECK` here means the host will crash if `reconnect_params_` is set but `enterprise_params_` is not. In the previous logic, reconnect parameters were gracefully ignored if it wasn't an enterprise session.

    Consider removing the local `std::optional<ReconnectParams>` and simplifying this section to just:
    ```cpp
    #if BUILDFLAG(IS_CHROMEOS) || !defined(NDEBUG)
    bool is_enterprise_admin_user = enterprise_params_.has_value();
    #endif
    ```
    Joe Downing

    I was on the fence about the AI suggestion about the CHECK condition but I think the local var cleanup is a good improvement so I'll apply both.

    Line 381, Patchset 7: if (reconnect_params.has_value()) {
    Yuwei Huang . resolved

    If you remove the local `reconnect_params` above, you can update this block to use the member variable directly and safely perform the `CHECK` here since we are inside the `is_enterprise_admin_user` block:

    ```cpp
    if (reconnect_params_.has_value()) {
    CHECK(enterprise_params_->allow_reconnections);
    it2me_host_->set_reconnect_params(*reconnect_params_);
    }
    ```
    Joe Downing

    Done

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I820691d9a8a4ccafdedf00c5f56c74e7adf62c2f
      Gerrit-Change-Number: 7718584
      Gerrit-PatchSet: 8
      Gerrit-Owner: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Comment-Date: Thu, 02 Apr 2026 18:56:26 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Yuwei Huang <yuw...@chromium.org>
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Apr 2, 2026, 3:49:38 PM (yesterday) Apr 2
      to Joe Downing, Yuwei Huang, chromium...@chromium.org, chromotin...@chromium.org

      Chromium LUCI CQ submitted the change with unreviewed changes

      Unreviewed changes

      7 is the latest approved patch-set.
      The change was submitted with unreviewed changes in the following files:

      ```
      The name of the file: remoting/host/it2me/it2me_native_messaging_host.cc
      Insertions: 5, Deletions: 9.

      @@ -299,13 +299,8 @@
      }
      }

      - std::optional<ReconnectParams> reconnect_params;

      #if BUILDFLAG(IS_CHROMEOS) || !defined(NDEBUG)
      bool is_enterprise_admin_user = enterprise_params_.has_value();
      -  if (reconnect_params_.has_value()) {
      - CHECK(enterprise_params_ && enterprise_params_->allow_reconnections);
      - reconnect_params.emplace(*reconnect_params_);
      - }
      #endif

      It2MeHost::CreateDeferredConnectContext create_connection_context;
      @@ -332,8 +327,8 @@
      api_token_getter_.set_access_token(access_token);
      }
      std::string ftl_device_id;
      - if (reconnect_params.has_value()) {
      - ftl_device_id = reconnect_params->ftl_device_id;
      + if (reconnect_params_.has_value()) {
      + ftl_device_id = reconnect_params_->ftl_device_id;
      }
      bool is_corp_user = message.FindBool(kIsCorpUser).value_or(false);
      create_connection_context = base::BindOnce(
      @@ -378,8 +373,9 @@

      dialog_style = It2MeConfirmationDialog::DialogStyle::kEnterprise;

      - if (reconnect_params.has_value()) {
      - it2me_host_->set_reconnect_params(std::move(*reconnect_params));
      + if (reconnect_params_.has_value()) {
      + CHECK(enterprise_params_->allow_reconnections);
      + it2me_host_->set_reconnect_params(*reconnect_params_);
      }
      }
      #endif
      ```

      Change information

      Commit message:
      [remoting]: Remove enterprise params from JSON message interface.

      This change refactors some code to prevent enterprise options from
      being injected via the NMH JSON interface since enterprise sessions
      have been using the Mojo interface for several years and no longer
      rely on that codepath.
      Bug: 497541219
      Change-Id: I820691d9a8a4ccafdedf00c5f56c74e7adf62c2f
      Commit-Queue: Joe Downing <joe...@chromium.org>
      Reviewed-by: Yuwei Huang <yuw...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1609435}
      Files:
      • M remoting/host/it2me/it2me_native_messaging_host.cc
      • M remoting/host/it2me/it2me_native_messaging_host.h
      • M remoting/host/it2me/it2me_native_messaging_host_ash.cc
      • M remoting/host/it2me/it2me_native_messaging_host_ash.h
      • M remoting/host/it2me/it2me_native_messaging_host_unittest.cc
      • M remoting/host/it2me/reconnect_params.cc
      • M remoting/host/it2me/reconnect_params.h
      Change size: M
      Delta: 7 files changed, 77 insertions(+), 34 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Yuwei Huang
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I820691d9a8a4ccafdedf00c5f56c74e7adf62c2f
      Gerrit-Change-Number: 7718584
      Gerrit-PatchSet: 9
      Gerrit-Owner: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages