Convert PasswordForm::password_value to ProcessBoundU16String [chromium/src : main]

0 views
Skip to first unread message

Jeffrey Gour (Gerrit)

unread,
Aug 12, 2026, 3:24:12 PM (4 days ago) Aug 12
to Viktor Semeniuk, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, nicolas...@chromium.org, ramyagopa...@google.com, crmulli...@chromium.org, jorgel...@chromium.org, rginda...@chromium.org, ios-revie...@chromium.org, browser-comp...@chromium.org, rkgibso...@chromium.org, tmartino+tran...@chromium.org, marq+...@chromium.org, ios-web-view...@google.com, feature-me...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, andysjl...@chromium.org, chromium-a...@chromium.org, derinel+wat...@google.com, dullweb...@chromium.org, extension...@chromium.org, gcasto+w...@chromium.org, msrame...@chromium.org, nwoked...@chromium.org, rrsilva+wat...@google.com, tbarzi...@chromium.org, vakh+safe_br...@chromium.org, vasilii+watchlis...@chromium.org, webauthn...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
Attention needed from Viktor Semeniuk

Jeffrey Gour voted and added 1 comment

Votes added by Jeffrey Gour

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 28:
Jeffrey Gour . resolved

Hi @vsem...@google.com. Here is the CL for the Phase 2 of my design for migrating to using ProcessBoundString for passwords. Could you please review it?

Thank you!

Open in Gerrit

Related details

Attention is currently required from:
  • Viktor Semeniuk
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not 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: Idc563eb26e42b7ee3864e738fd011783220e5cdc
Gerrit-Change-Number: 7922632
Gerrit-PatchSet: 40
Gerrit-Owner: Jeffrey Gour <jeffr...@microsoft.com>
Gerrit-Reviewer: Jeffrey Gour <jeffr...@microsoft.com>
Gerrit-Reviewer: Viktor Semeniuk <vsem...@google.com>
Gerrit-Attention: Viktor Semeniuk <vsem...@google.com>
Gerrit-Comment-Date: Wed, 12 Aug 2026 19:24:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Viktor Semeniuk (Gerrit)

unread,
Aug 14, 2026, 5:06:29 AM (2 days ago) Aug 14
to Jeffrey Gour, SLSA Policy Verification Service, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, nicolas...@chromium.org, ramyagopa...@google.com, crmulli...@chromium.org, jorgel...@chromium.org, rginda...@chromium.org, ios-revie...@chromium.org, browser-comp...@chromium.org, rkgibso...@chromium.org, tmartino+tran...@chromium.org, marq+...@chromium.org, ios-web-view...@google.com, feature-me...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, andysjl...@chromium.org, chromium-a...@chromium.org, derinel+wat...@google.com, dullweb...@chromium.org, extension...@chromium.org, gcasto+w...@chromium.org, msrame...@chromium.org, nwoked...@chromium.org, rrsilva+wat...@google.com, tbarzi...@chromium.org, vakh+safe_br...@chromium.org, vasilii+watchlis...@chromium.org, webauthn...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
Attention needed from Jeffrey Gour

Viktor Semeniuk added 14 comments

Patchset-level comments
File-level comment, Patchset 40 (Latest):
Viktor Semeniuk . resolved

I didn't review the CL fully yet. Left a few initial comments. Thanks!

Commit Message
Line 9, Patchset 40 (Latest):This CL is the implements the second "pillar" (or phase 2) for migrating
Viktor Semeniuk . unresolved

This CL implements the second

Line 13, Patchset 40 (Latest):The first pillar was implement in https://crrev.com/c/7922887.
Viktor Semeniuk . unresolved

implemented

Line 22, Patchset 40 (Latest):are mechanical changes to adjust to the new type for for
Viktor Semeniuk . unresolved

for

Line 25, Patchset 40 (Latest):significant changes to them beyond mechanical updates, followed but a
Viktor Semeniuk . unresolved

by?

Line 97, Patchset 40 (Latest): assigned to from a const ref to a an actual L-value variable to support the
Viktor Semeniuk . unresolved

an

File chrome/browser/password_manager/android/save_update_password_message_delegate.cc
Line 450, Patchset 40 (Latest): usernames, current_username, current_password, account_email_);
Viktor Semeniuk . unresolved

Just provide password in place.

File chrome/browser/password_manager/password_change/change_password_form_filler.cc
Line 125, Patchset 40 (Latest): form_to_save.password_value = stored_password_;
Viktor Semeniuk . unresolved

How does it work if the copy assignment is deleted?

File chrome/browser/sync/test/integration/password_manager_sync_test.cc
Line 87, Patchset 40 (Latest): arg.password_value.value() == base::UTF8ToUTF16(password);
Viktor Semeniuk . unresolved

`PasswordString` already implements `operator==(const PasswordString&, const std::u16string&)` so `arg.password_value == base::UTF8ToUTF16(password);` should work, right?

File chrome/browser/ui/passwords/manage_passwords_ui_controller.h
Line 191, Patchset 40 (Latest): const password_manager::PasswordString& password) override;
Viktor Semeniuk . unresolved

Can we pass PasswordString by value here an below? How difficult would it be to do so?

File chrome/browser/ui/passwords/passwords_model_delegate.h
Line 134, Patchset 40 (Latest): const password_manager::PasswordString& password) = 0;
Viktor Semeniuk . unresolved

Should we pass by value here? I know it's a bit more work, but let's be consistent

File chrome/browser/ui/views/passwords/manage_passwords_details_view.cc
Line 630, Patchset 40 (Latest): base::BindRepeating(&WriteToClipboard,
password_form.password_value.value(),
Viktor Semeniuk . unresolved

Please add a TODO to bind `PasswordString` instead of plain text password.

File chrome/browser/ui/views/passwords/password_save_update_view.cc
Line 634, Patchset 40 (Latest): if (password_dropdown_) {
new_password = password_manager::PasswordString(
std::u16string(password_dropdown_->GetText()));
}
Viktor Semeniuk . unresolved

Avoid copy-initializing new_password. Only create a PasswordString if `password_dropdown_` is present

```
password_manager::PasswordString new_password =
password_dropdown_
? password_manager::PasswordString(
std::u16string(password_dropdown_->GetText()))
: password_manager::PasswordString(
controller_.pending_password().password_value.value());
```
File components/password_manager/core/browser/password_form.h
Line 327, Patchset 40 (Latest): PasswordString password_value;
Viktor Semeniuk . unresolved

Could you please add explicit unit tests in `password_form_unittest.cc` verifying copy, move, and equality semantics of `PasswordForm` with `PasswordString` to guarantee that move-clearing and copy-re-encryption behave as expected

Open in Gerrit

Related details

Attention is currently required from:
  • Jeffrey Gour
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • 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: Idc563eb26e42b7ee3864e738fd011783220e5cdc
    Gerrit-Change-Number: 7922632
    Gerrit-PatchSet: 40
    Gerrit-Owner: Jeffrey Gour <jeffr...@microsoft.com>
    Gerrit-Reviewer: Jeffrey Gour <jeffr...@microsoft.com>
    Gerrit-Reviewer: SLSA Policy Verification Service <devtools-gerritco...@google.com>
    Gerrit-Attention: Jeffrey Gour <jeffr...@microsoft.com>
    Gerrit-Comment-Date: Fri, 14 Aug 2026 09:06:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Jeffrey Gour (Gerrit)

    unread,
    Aug 14, 2026, 9:18:03 PM (2 days ago) Aug 14
    to SLSA Policy Verification Service, Viktor Semeniuk, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, nicolas...@chromium.org, ramyagopa...@google.com, crmulli...@chromium.org, jorgel...@chromium.org, rginda...@chromium.org, ios-revie...@chromium.org, browser-comp...@chromium.org, rkgibso...@chromium.org, tmartino+tran...@chromium.org, marq+...@chromium.org, ios-web-view...@google.com, feature-me...@chromium.org, ios-rev...@chromium.org, ios-r...@chromium.org, andysjl...@chromium.org, chromium-a...@chromium.org, derinel+wat...@google.com, dullweb...@chromium.org, extension...@chromium.org, gcasto+w...@chromium.org, msrame...@chromium.org, nwoked...@chromium.org, rrsilva+wat...@google.com, tbarzi...@chromium.org, vakh+safe_br...@chromium.org, vasilii+watchlis...@chromium.org, webauthn...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org
    Attention needed from Jeffrey Gour and Viktor Semeniuk

    Jeffrey Gour voted and added 14 comments

    Votes added by Jeffrey Gour

    Commit-Queue+1

    14 comments

    Patchset-level comments
    File-level comment, Patchset 46 (Latest):
    Jeffrey Gour . resolved

    Replied to all the comments and resolved most. The two unresolved I'd like some additional thoughts from you on. Thank you for your help!

    Commit Message
    Line 9, Patchset 40:This CL is the implements the second "pillar" (or phase 2) for migrating
    Viktor Semeniuk . resolved

    This CL implements the second

    Jeffrey Gour

    Acknowledged

    Line 13, Patchset 40:The first pillar was implement in https://crrev.com/c/7922887.
    Viktor Semeniuk . resolved

    implemented

    Jeffrey Gour

    Acknowledged

    Line 22, Patchset 40:are mechanical changes to adjust to the new type for for
    Viktor Semeniuk . resolved

    for

    Jeffrey Gour

    Acknowledged

    Line 25, Patchset 40:significant changes to them beyond mechanical updates, followed but a
    Viktor Semeniuk . resolved

    by?

    Jeffrey Gour

    Acknowledged

    Line 97, Patchset 40: assigned to from a const ref to a an actual L-value variable to support the
    Viktor Semeniuk . resolved

    an

    Jeffrey Gour

    Acknowledged

    File chrome/browser/password_manager/android/save_update_password_message_delegate.cc
    Line 450, Patchset 40: usernames, current_username, current_password, account_email_);
    Viktor Semeniuk . resolved

    Just provide password in place.

    Jeffrey Gour

    Acknowledged

    File chrome/browser/password_manager/password_change/change_password_form_filler.cc
    Line 125, Patchset 40: form_to_save.password_value = stored_password_;
    Viktor Semeniuk . resolved

    How does it work if the copy assignment is deleted?

    Jeffrey Gour

    Copy assignment isn't deleted anymore to support these cases. It's one of the changes I made in this PR though I forgot to call out it in the description. Will add that.

    File chrome/browser/sync/test/integration/password_manager_sync_test.cc
    Line 87, Patchset 40: arg.password_value.value() == base::UTF8ToUTF16(password);
    Viktor Semeniuk . resolved

    `PasswordString` already implements `operator==(const PasswordString&, const std::u16string&)` so `arg.password_value == base::UTF8ToUTF16(password);` should work, right?

    Jeffrey Gour

    Acknowledged

    File chrome/browser/ui/passwords/manage_passwords_ui_controller.h
    Line 191, Patchset 40: const password_manager::PasswordString& password) override;
    Viktor Semeniuk . unresolved

    Can we pass PasswordString by value here an below? How difficult would it be to do so?

    Jeffrey Gour

    See my reply on your comment about this on password_model_delegate.h. Basically could you elaborate on why you think this would be beneficial?

    File chrome/browser/ui/passwords/passwords_model_delegate.h
    Line 134, Patchset 40: const password_manager::PasswordString& password) = 0;
    Viktor Semeniuk . unresolved

    Should we pass by value here? I know it's a bit more work, but let's be consistent

    Jeffrey Gour

    Could you elaborate on why you think passing by value would be better here? The caller for this is SaveUpdateBubbleController::OnSaveClicked() which populates the password parameter with GetPendingPassword().password_value. GetPendingPassword() returns a const PasswordForm&, and so we can't move the password_value out of it. Plus it looks to me like it's by design that this holds onto this PasswordForm object. As a result, passing by value here would mean creating a copy of The PasswordString. Then from SavePassword it's passed through a stack of calls, namely UpdatePasswordFormUsernameAndPassword -> PasswordFormManager::OnUpdatePasswordFromPrompt where it's assigned to the password_value of a different form. I would imagine we'd change all of these to pass by value (I'm not sure why we would to change just the first call of the stack). Now these could all be std::move to avoid the copy, but that's basically additional complexity for the same effect imho. With passing by const ref one copy is made when assigning to the new form at the end of the stack vs with by value one copy is made for the first call of the stack (assuming moves are used everywhere else).

    Am I missing something here?

    File chrome/browser/ui/views/passwords/manage_passwords_details_view.cc
    Line 630, Patchset 40: base::BindRepeating(&WriteToClipboard,
    password_form.password_value.value(),
    Viktor Semeniuk . resolved

    Please add a TODO to bind `PasswordString` instead of plain text password.

    Jeffrey Gour

    Acknowledged

    File chrome/browser/ui/views/passwords/password_save_update_view.cc
    Line 634, Patchset 40: if (password_dropdown_) {

    new_password = password_manager::PasswordString(
    std::u16string(password_dropdown_->GetText()));
    }
    Viktor Semeniuk . resolved

    Avoid copy-initializing new_password. Only create a PasswordString if `password_dropdown_` is present

    ```
    password_manager::PasswordString new_password =
    password_dropdown_
    ? password_manager::PasswordString(
    std::u16string(password_dropdown_->GetText()))
    : password_manager::PasswordString(
    controller_.pending_password().password_value.value());
    ```
    Jeffrey Gour

    Acknowledged

    File components/password_manager/core/browser/password_form.h
    Line 327, Patchset 40: PasswordString password_value;
    Viktor Semeniuk . resolved

    Could you please add explicit unit tests in `password_form_unittest.cc` verifying copy, move, and equality semantics of `PasswordForm` with `PasswordString` to guarantee that move-clearing and copy-re-encryption behave as expected

    Jeffrey Gour

    Acknowledged

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jeffrey Gour
    • Viktor Semeniuk
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • 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: Idc563eb26e42b7ee3864e738fd011783220e5cdc
    Gerrit-Change-Number: 7922632
    Gerrit-PatchSet: 46
    Gerrit-Owner: Jeffrey Gour <jeffr...@microsoft.com>
    Gerrit-Reviewer: Jeffrey Gour <jeffr...@microsoft.com>
    Gerrit-Reviewer: SLSA Policy Verification Service <devtools-gerritco...@google.com>
    Gerrit-Reviewer: Viktor Semeniuk <vsem...@google.com>
    Gerrit-Attention: Viktor Semeniuk <vsem...@google.com>
    Gerrit-Attention: Jeffrey Gour <jeffr...@microsoft.com>
    Gerrit-Comment-Date: Sat, 15 Aug 2026 01:17:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Viktor Semeniuk <vsem...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages