Skip to content

Commit

Permalink
Add metrics for https upgrades omnibox escape hatch
Browse files Browse the repository at this point in the history
This adds a new bucket to NavigationRequestSecurityLevel that is logged
when a navigation is opted out from upgrades due to the URL including
an explicit http:// scheme.

Bug: 1447921
Change-Id: I985fdf0e6bba12ce224906149723fac47e0798b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4568799
Auto-Submit: Carlos IL <carlosil@chromium.org>
Reviewed-by: Chris Thompson <cthomp@chromium.org>
Commit-Queue: Carlos IL <carlosil@chromium.org>
Commit-Queue: Chris Thompson <cthomp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1149472}
  • Loading branch information
carlosjoan91 authored and Chromium LUCI CQ committed May 26, 2023
1 parent bbb6806 commit 9e60488
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions chrome/browser/ssl/https_upgrades_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,10 @@ IN_PROC_BROWSER_TEST_P(HttpsUpgradesBrowserTest,
// Typed http URLs don't opt out of upgrades in HFM.
EXPECT_EQ(https_url, contents->GetLastCommittedURL());
} else {
histograms()->ExpectTotalCount(kNavigationRequestSecurityLevelHistogram, 1);
histograms()->ExpectBucketCount(
kNavigationRequestSecurityLevelHistogram,
NavigationRequestSecurityLevel::kExplicitHttpScheme, 1);
EXPECT_EQ(http_url, contents->GetLastCommittedURL());
}
}
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/ssl/https_upgrades_interceptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ void HttpsUpgradesInterceptor::MaybeCreateLoader(
state->AllowHttpForHost(tentative_resource_request.url.host(),
storage_partition);
}
RecordNavigationRequestSecurityLevel(
NavigationRequestSecurityLevel::kExplicitHttpScheme);
std::move(callback).Run({});
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ enum class NavigationRequestSecurityLevel {
// This bucket is recorded IN ADDITION to kInsecure/kAllowlisted.
kNonUniqueHostname = 8,

kMaxValue = kNonUniqueHostname,
// Request was insecure (HTTP), but was to a URL that was fully typed (as
// opposed to autocompleted) that included an explicit http scheme.
kExplicitHttpScheme = 9,

kMaxValue = kExplicitHttpScheme,
};

// Recorded by the Site Engagement Heuristic logic, recording whether HFM should
Expand Down
2 changes: 2 additions & 0 deletions tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71657,6 +71657,8 @@ Called by update_use_counter_css.py.-->
label="HTTP allowed by content/enterprise setting (NOT by failing
auto-upgrade or clicking through warning)."/>
<int value="8" label="HTTP request to non-unique host."/>
<int value="9"
label="HTTP request to a fully typed URL with explicit HTTP scheme."/>
</enum>

<enum name="NavigationRequiresDedicatedProcess">
Expand Down

0 comments on commit 9e60488

Please sign in to comment.