mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 03:24:26 +00:00
Bug 1898171 - Add SanitizedString profiler marker format r=acreskey,profiler-reviewers,aabh
The sanitization function for URL and FilePath cannot currently sanitize an arbitrary string in the profiler data. The expectation is that the URL starts with a scheme like http:// and that a file path contains a /, so none of them are sanitized if the contents are a domain name. This commit introduces a new 'sanitized-string' format, that the profiler can make sure to completely blank out. Differential Revision: https://phabricator.services.mozilla.com/D211171
This commit is contained in:
parent
6e4d33524e
commit
7ebb860b81
@ -320,6 +320,8 @@ Span<const char> MarkerSchema::FormatToStringSpan(
|
||||
return mozilla::MakeStringSpan("url");
|
||||
case Format::FilePath:
|
||||
return mozilla::MakeStringSpan("file-path");
|
||||
case Format::SanitizedString:
|
||||
return mozilla::MakeStringSpan("sanitized-string");
|
||||
case Format::String:
|
||||
return mozilla::MakeStringSpan("string");
|
||||
case Format::UniqueString:
|
||||
|
@ -24,7 +24,7 @@ namespace mozilla {
|
||||
class ProfileBufferChunkManagerWithLocalLimit;
|
||||
|
||||
// Centrally defines the version of the gecko profiler JSON format.
|
||||
const int GECKO_PROFILER_FORMAT_VERSION = 29;
|
||||
const int GECKO_PROFILER_FORMAT_VERSION = 30;
|
||||
|
||||
namespace baseprofiler::detail {
|
||||
|
||||
|
@ -736,6 +736,8 @@ class MarkerSchema {
|
||||
Url,
|
||||
// Show the file path, and handle PII sanitization.
|
||||
FilePath,
|
||||
// Show arbitrary string and handle PII sanitization
|
||||
SanitizedString,
|
||||
// Important, do not put URL or file path information here, as it will not
|
||||
// be sanitized. Please be careful with including other types of PII here as
|
||||
// well.
|
||||
|
@ -2430,6 +2430,9 @@ TEST(GeckoProfiler, Markers)
|
||||
schema.AddKeyFormat("key with decimal", MS::Format::Decimal);
|
||||
schema.AddStaticLabelValue("static label", "static value");
|
||||
schema.AddKeyFormat("key with unique string", MS::Format::UniqueString);
|
||||
schema.AddKeyFormatSearchable("key with sanitized string",
|
||||
MS::Format::SanitizedString,
|
||||
MS::Searchable::Searchable);
|
||||
return schema;
|
||||
}
|
||||
};
|
||||
@ -3358,7 +3361,7 @@ TEST(GeckoProfiler, Markers)
|
||||
EXPECT_EQ_JSON(schema["tooltipLabel"], String, "tooltip label");
|
||||
EXPECT_EQ_JSON(schema["tableLabel"], String, "table label");
|
||||
|
||||
ASSERT_EQ(data.size(), 15u);
|
||||
ASSERT_EQ(data.size(), 16u);
|
||||
|
||||
ASSERT_TRUE(data[0u].isObject());
|
||||
EXPECT_EQ_JSON(data[0u]["key"], String, "key with url");
|
||||
@ -3450,6 +3453,12 @@ TEST(GeckoProfiler, Markers)
|
||||
EXPECT_EQ_JSON(data[14u]["format"], String, "unique-string");
|
||||
EXPECT_TRUE(data[14u]["searchable"].isNull());
|
||||
|
||||
ASSERT_TRUE(data[15u].isObject());
|
||||
EXPECT_EQ_JSON(data[15u]["key"], String,
|
||||
"key with sanitized string");
|
||||
EXPECT_TRUE(data[15u]["label"].isNull());
|
||||
EXPECT_EQ_JSON(data[15u]["format"], String, "sanitized-string");
|
||||
EXPECT_EQ_JSON(data[15u]["searchable"], Bool, true);
|
||||
} else if (nameString == "markers-gtest-special") {
|
||||
EXPECT_EQ(display.size(), 0u);
|
||||
ASSERT_EQ(data.size(), 0u);
|
||||
|
Loading…
x
Reference in New Issue
Block a user