[Security Settings] Implement ABH settings bundle backend [chromium/src : main]

0 views
Skip to first unread message

Awad Osman (Gerrit)

unread,
May 12, 2026, 3:25:09 PMMay 12
to Zack Han, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Zack Han

Awad Osman added 1 comment

File chrome/browser/ssl/https_upgrades_util.cc
Line 125, Patchset 3 (Latest): safe_browsing::kBundledSecuritySettingsAskBeforeHttp);
Awad Osman . unresolved

Should this be added here or in a separate function? Balanced mode can exist without BundledSecuritySettings (BSS) right?

I'm wondering because this function is used elsewhere so if the BSS flag is true and the BalancedMode flag is false we would end up affecting those functions.

Open in Gerrit

Related details

Attention is currently required from:
  • Zack Han
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: I9d898d478c4e141050587faa9ea84e9b6a1c5b8e
Gerrit-Change-Number: 7837858
Gerrit-PatchSet: 3
Gerrit-Owner: Zack Han <zac...@chromium.org>
Gerrit-Reviewer: Awad Osman <aw...@google.com>
Gerrit-Reviewer: Zack Han <zac...@chromium.org>
Gerrit-Attention: Zack Han <zac...@chromium.org>
Gerrit-Comment-Date: Tue, 12 May 2026 19:25:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Zack Han (Gerrit)

unread,
May 21, 2026, 12:46:13 PM (7 days ago) May 21
to android-bu...@system.gserviceaccount.com, Javier Castro, Awad Osman, Chromium LUCI CQ, chromium...@chromium.org, nwoked...@chromium.org, andysjl...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org, vakh+safe_br...@chromium.org
Attention needed from Awad Osman

Zack Han added 2 comments

Patchset-level comments
File-level comment, Patchset 6 (Latest):
Zack Han . resolved

Thanks Awad, I decouple the logic, and added some new stuff to address the design doc change. Can you PTAL again?

File chrome/browser/ssl/https_upgrades_util.cc
Line 125, Patchset 3: safe_browsing::kBundledSecuritySettingsAskBeforeHttp);
Awad Osman . resolved

Should this be added here or in a separate function? Balanced mode can exist without BundledSecuritySettings (BSS) right?

I'm wondering because this function is used elsewhere so if the BSS flag is true and the BalancedMode flag is false we would end up affecting those functions.

Zack Han

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Awad Osman
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: I9d898d478c4e141050587faa9ea84e9b6a1c5b8e
    Gerrit-Change-Number: 7837858
    Gerrit-PatchSet: 6
    Gerrit-Owner: Zack Han <zac...@chromium.org>
    Gerrit-Reviewer: Awad Osman <aw...@google.com>
    Gerrit-Reviewer: Zack Han <zac...@chromium.org>
    Gerrit-CC: Javier Castro <jaca...@chromium.org>
    Gerrit-Attention: Awad Osman <aw...@google.com>
    Gerrit-Comment-Date: Thu, 21 May 2026 16:46:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Awad Osman <aw...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Awad Osman (Gerrit)

    unread,
    May 22, 2026, 4:33:28 PM (6 days ago) May 22
    to Zack Han, android-bu...@system.gserviceaccount.com, Javier Castro, Chromium LUCI CQ, chromium...@chromium.org, nwoked...@chromium.org, andysjl...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org, vakh+safe_br...@chromium.org
    Attention needed from Zack Han

    Awad Osman voted and added 2 comments

    Votes added by Awad Osman

    Code-Review+1

    2 comments

    Patchset-level comments
    File chrome/browser/ssl/https_upgrades_util.cc
    Line 19, Patchset 7:#include "components/safe_browsing/core/common/features.h"
    Awad Osman . unresolved

    Is this import used anywhere?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Zack Han
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not 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: I9d898d478c4e141050587faa9ea84e9b6a1c5b8e
      Gerrit-Change-Number: 7837858
      Gerrit-PatchSet: 11
      Gerrit-Owner: Zack Han <zac...@chromium.org>
      Gerrit-Reviewer: Awad Osman <aw...@google.com>
      Gerrit-Reviewer: Zack Han <zac...@chromium.org>
      Gerrit-CC: Javier Castro <jaca...@chromium.org>
      Gerrit-Attention: Zack Han <zac...@chromium.org>
      Gerrit-Comment-Date: Fri, 22 May 2026 20:33:23 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Zack Han (Gerrit)

      unread,
      May 27, 2026, 3:54:23 PM (yesterday) May 27
      to Javier Castro, Chris Thompson, Awad Osman, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, nwoked...@chromium.org, andysjl...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org, vakh+safe_br...@chromium.org
      Attention needed from Chris Thompson and Javier Castro

      Zack Han added 1 comment

      Patchset-level comments
      Zack Han . resolved

      Hi jacastro@ can you please take a look at the chrome/browser/safe_browsing/metrics/... related changes? Thanks

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Chris Thompson
      • Javier Castro
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not 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: I9d898d478c4e141050587faa9ea84e9b6a1c5b8e
      Gerrit-Change-Number: 7837858
      Gerrit-PatchSet: 11
      Gerrit-Owner: Zack Han <zac...@chromium.org>
      Gerrit-Reviewer: Awad Osman <aw...@google.com>
      Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
      Gerrit-Reviewer: Javier Castro <jaca...@chromium.org>
      Gerrit-Reviewer: Zack Han <zac...@chromium.org>
      Gerrit-Attention: Javier Castro <jaca...@chromium.org>
      Gerrit-Attention: Chris Thompson <cth...@chromium.org>
      Gerrit-Comment-Date: Wed, 27 May 2026 19:54:12 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Chris Thompson (Gerrit)

      unread,
      3:02 PM (2 hours ago) 3:02 PM
      to Zack Han, Javier Castro, Awad Osman, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, nwoked...@chromium.org, andysjl...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org, vakh+safe_br...@chromium.org
      Attention needed from Javier Castro and Zack Han

      Chris Thompson added 3 comments

      Commit Message
      Line 28, Patchset 11 (Latest):
      Change-Id: I9d898d478c4e141050587faa9ea84e9b6a1c5b8e
      Chris Thompson . unresolved

      Add bug link here

      ```suggestion

      Bug: 515782410
      Change-Id: I9d898d478c4e141050587faa9ea84e9b6a1c5b8e
      ```

      File chrome/browser/ssl/generated_https_first_mode_pref.cc
      Line 234, Patchset 11 (Latest):void GeneratedHttpsFirstModePref::OnSettingsBundleChanged() {
      if (!base::FeatureList::IsEnabled(
      safe_browsing::kBundledSecuritySettingsAskBeforeHttp)) {
      return;
      }
      auto bundle = safe_browsing::GetSecurityBundleSetting(*profile_->GetPrefs());
      switch (bundle) {
      case safe_browsing::SecuritySettingsBundleSetting::STANDARD:
      SetPref(std::make_unique<base::Value>(
      static_cast<int>(HttpsFirstModeSetting::kDisabled))
      .get());
      break;
      case safe_browsing::SecuritySettingsBundleSetting::ENHANCED:
      SetPref(std::make_unique<base::Value>(
      static_cast<int>(IsBalancedModeAvailable()
      ? HttpsFirstModeSetting::kEnabledBalanced
      : HttpsFirstModeSetting::kDisabled))
      .get());
      break;
      }
      }
      Chris Thompson . unresolved

      If this can trigger for cases other than "user clicked on the bundle in settings", then this might be setting the pref too aggressively. I'm checking on this now.

      File chrome/browser/ssl/https_first_mode_settings_tracker.cc
      Line 260, Patchset 11 (Latest): // If the Toast has already been shown or HFM features are not enabled, abort.
      if (prefs->GetBoolean(prefs::kHttpsFirstModeBundleToastShown) ||
      !base::FeatureList::IsEnabled(
      safe_browsing::kBundledSecuritySettingsAskBeforeHttp) ||
      !IsBalancedModeAvailable()) {
      return;
      }
      Chris Thompson . unresolved

      One case where we want to make sure we don't set the underlying prefs: if the user is in the Enhanced bundle because of Advanced Protection Program. (This has caused issues where Android Device Protection, which should be device scoped, escaped containment and caused the ABH pref to get synced across profiles.)

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Javier Castro
      • Zack Han
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not 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: I9d898d478c4e141050587faa9ea84e9b6a1c5b8e
      Gerrit-Change-Number: 7837858
      Gerrit-PatchSet: 11
      Gerrit-Owner: Zack Han <zac...@chromium.org>
      Gerrit-Reviewer: Awad Osman <aw...@google.com>
      Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
      Gerrit-Reviewer: Javier Castro <jaca...@chromium.org>
      Gerrit-Reviewer: Zack Han <zac...@chromium.org>
      Gerrit-Attention: Javier Castro <jaca...@chromium.org>
      Gerrit-Attention: Zack Han <zac...@chromium.org>
      Gerrit-Comment-Date: Thu, 28 May 2026 19:02:32 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Chris Thompson (Gerrit)

      unread,
      3:32 PM (1 hour ago) 3:32 PM
      to Zack Han, Javier Castro, Awad Osman, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, nwoked...@chromium.org, andysjl...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org, vakh+safe_br...@chromium.org
      Attention needed from Javier Castro and Zack Han

      Chris Thompson added 2 comments

      File chrome/browser/ssl/generated_https_first_mode_pref.cc
      Line 234, Patchset 11 (Latest):void GeneratedHttpsFirstModePref::OnSettingsBundleChanged() {
      if (!base::FeatureList::IsEnabled(
      safe_browsing::kBundledSecuritySettingsAskBeforeHttp)) {
      return;
      }
      auto bundle = safe_browsing::GetSecurityBundleSetting(*profile_->GetPrefs());
      switch (bundle) {
      case safe_browsing::SecuritySettingsBundleSetting::STANDARD:
      SetPref(std::make_unique<base::Value>(
      static_cast<int>(HttpsFirstModeSetting::kDisabled))
      .get());
      break;
      case safe_browsing::SecuritySettingsBundleSetting::ENHANCED:
      SetPref(std::make_unique<base::Value>(
      static_cast<int>(IsBalancedModeAvailable()
      ? HttpsFirstModeSetting::kEnabledBalanced
      : HttpsFirstModeSetting::kDisabled))
      .get());
      break;
      }
      }
      Chris Thompson . unresolved

      If this can trigger for cases other than "user clicked on the bundle in settings", then this might be setting the pref too aggressively. I'm checking on this now.

      Chris Thompson

      This calls SetPref() which early returns if the user is in APP, so I think this will be okay.

      File chrome/browser/ssl/https_first_mode_settings_tracker.cc
      Line 260, Patchset 11 (Latest): // If the Toast has already been shown or HFM features are not enabled, abort.
      if (prefs->GetBoolean(prefs::kHttpsFirstModeBundleToastShown) ||
      !base::FeatureList::IsEnabled(
      safe_browsing::kBundledSecuritySettingsAskBeforeHttp) ||
      !IsBalancedModeAvailable()) {
      return;
      }
      Chris Thompson . unresolved

      One case where we want to make sure we don't set the underlying prefs: if the user is in the Enhanced bundle because of Advanced Protection Program. (This has caused issues where Android Device Protection, which should be device scoped, escaped containment and caused the ABH pref to get synced across profiles.)

      Chris Thompson

      Checking with ackermanb@ on this, it sounds like APP users would have the enhanced bundle set by default, and that this migration path would include users who had previously chosen ESB in settings. In cases where the user _didn't_ explicitly choose the bundle in settings, can we early return before setting the underlying prefs?

      (For comparison in generated_https_first_mode_pref.cc: in SetPref() if the user is APP mode we treat it as "force enabled" and don't actually route through to setting the underlying pref values. I think similarly skipping this for APP users here would be sufficient.)

      Gerrit-Comment-Date: Thu, 28 May 2026 19:32:13 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Chris Thompson <cth...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Javier Castro (Gerrit)

      unread,
      3:40 PM (1 hour ago) 3:40 PM
      to Zack Han, Chris Thompson, Awad Osman, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, nwoked...@chromium.org, andysjl...@chromium.org, xinghui...@chromium.org, zackha...@chromium.org, vakh+safe_br...@chromium.org
      Attention needed from Zack Han

      Javier Castro added 4 comments

      File chrome/browser/ssl/https_first_mode_settings_tracker.cc
      Line 262, Patchset 11 (Latest): !base::FeatureList::IsEnabled(
      safe_browsing::kBundledSecuritySettingsAskBeforeHttp) ||
      Javier Castro . unresolved

      I think you'd want this check to be last in this OR clause so that a user is only marked as active in the study if they can actually enable balanced mode.

      Line 280, Patchset 11 (Latest): prefs->SetBoolean(prefs::kHttpsFirstModeBundleToastShown, true);
      Javier Castro . unresolved

      Wouldn't we only want to record that the toast was shown if it was shown? Otherwise, it seems that this preference is being overloaded into tracking the state of whether the migration is complete (so maybe it needs a different name).

      Line 290, Patchset 11 (Latest): prefs->SetBoolean(prefs::kHttpsFirstModeBundleToastShown, true);
      Javier Castro . unresolved

      If we set this here, and the migration toast doesn't end up getting shown to the user, then this boolean is not representing that the toast was shown. Maybe we just need a better name for the preference, like HttpsFirstModeBundleToastQueued?

      Line 291, Patchset 11 (Latest): prefs->SetInteger(
      prefs::kSecuritySettingsBundleMigrationToastState,
      static_cast<int>(
      safe_browsing::SecuritySettingsBundleToastState::kPending));
      Javier Castro . unresolved

      Where does the ToastController's MaybeShowToast(ToastParams(ToastId::kEnhancedBundledSecuritySettings)) end up getting triggered?

      For the overall ESB to enhanced bundle migration we trigger it over here:

      https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/safe_browsing/safe_browsing_service.cc;l=190-194;drc=2e070bfa61f747388fddaafd8eaf9519f89e80de

      I think if this code doesn't ask the toast controller to run, then the toast may get shown on the next run of Chrome. Ideally the user would see the toast on this current run of Chrome though (since this would be when we update the preference value).

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Zack Han
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not 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: I9d898d478c4e141050587faa9ea84e9b6a1c5b8e
      Gerrit-Change-Number: 7837858
      Gerrit-PatchSet: 11
      Gerrit-Owner: Zack Han <zac...@chromium.org>
      Gerrit-Reviewer: Awad Osman <aw...@google.com>
      Gerrit-Reviewer: Chris Thompson <cth...@chromium.org>
      Gerrit-Reviewer: Javier Castro <jaca...@chromium.org>
      Gerrit-Reviewer: Zack Han <zac...@chromium.org>
      Gerrit-Attention: Zack Han <zac...@chromium.org>
      Gerrit-Comment-Date: Thu, 28 May 2026 19:40:35 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages