Commit ecac50b4 authored by Lily Chen's avatar Lily Chen Committed by Commit Bot

Add histogram for SameParty cookies to log usage correctness

This adds a histogram to log, for SameParty cookies, whether the
attribute was applied correctly (i.e. whether the cookie both had Secure
and did not have SameSite=Strict).

Bug: 1142606
Change-Id: I512f0dd83896d917022ece0da2e85ac6f0d7392c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2510195Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarMaksim Orlovich <morlovich@chromium.org>
Reviewed-by: default avatarWeilun Shi <sweilun@chromium.org>
Commit-Queue: Lily Chen <chlily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824009}
parent d3437840
......@@ -50,6 +50,7 @@
#include "base/feature_list.h"
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
......@@ -416,6 +417,10 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
CookieInclusionStatus::EXCLUDE_INVALID_SAMEPARTY);
}
// Collect metrics on whether usage of SameParty attribute is correct.
if (parsed_cookie.IsSameParty())
base::UmaHistogramBoolean("Cookie.IsSamePartyValid", is_same_party_valid);
// TODO(chlily): Log metrics.
if (!status->IsInclude())
return nullptr;
......
......@@ -162,6 +162,18 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>
<histogram name="Cookie.IsSamePartyValid" enum="BooleanValid"
expires_after="2021-11-01">
<owner>chlily@chromium.org</owner>
<owner>kaustubhag@chromium.org</owner>
<summary>
If a cookie had the SameParty attribute, this histogram logs whether it was
used correctly (i.e., also had Secure and did not have SameSite=Strict).
Logged every time a cookie with SameParty is created from a string (i.e.
when it is set via Set-Cookie or document.cookie write).
</summary>
</histogram>
<histogram name="Cookie.KillDatabaseResult" enum="BooleanSuccess"
expires_after="2020-11-08">
<owner>morlovich@chromium.org</owner>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment