profiler icon indicating copy to clipboard operation
profiler copied to clipboard

URLs are not stripped from markers using MS::Format::Url

Open acreskeyMoz opened this issue 3 years ago • 1 comments

If a new marker type is added, using Url format, e.g. schema.AddKeyFormat("url", MS::Format::Url); the expectation is that the Url would be stripped on profile upload if the user did not want to share URLs.

A sample patch that demonstrates the issue: https://d2mfgivbiy2fiw.cloudfront.net/file/data/erc7qrzdy7u2744sqyvr/PHID-FILE-6swpjsvyhachgkko5fvq/D149992.diff

And the marker definition:

struct UrlMarker {
  static constexpr Span<const char> MarkerTypeName() {
    return MakeStringSpan("url");
  }
  static void StreamJSONMarkerData(
      mozilla::baseprofiler::SpliceableJSONWriter& aWriter,
      const mozilla::ProfilerString8View& aURL) {
    if (aURL.Length() != 0) {
      aWriter.StringProperty("url", aURL);
    }
  }
  static MarkerSchema MarkerTypeDisplay() {
    using MS = MarkerSchema;
    MS schema(MS::Location::MarkerChart, MS::Location::MarkerTable);
    schema.SetTableLabel("{marker.name} - {marker.data.url}");
    schema.AddKeyFormat("url", MS::Format::Url);
    return schema;
  }
};

Possibly the same as https://github.com/firefox-devtools/profiler/issues/2757

acreskeyMoz avatar Jun 22 '22 19:06 acreskeyMoz

This profile has been produced with the mentioned patch, and will make it easier to test a patch: https://share.firefox.dev/3boTb9P

julienw avatar Jun 22 '22 20:06 julienw

Just pinging on this one. We would like to land the marker that records speculative connections, but my understanding is that I can't until this bug is fixed because of the url leakage.

acreskeyMoz avatar Dec 08 '22 14:12 acreskeyMoz

Thanks for the ping Andrew, it wasn't clear to me you were blocked on this. We can look at this soon, hopefully that shouldn't be too hard.

julienw avatar Dec 08 '22 19:12 julienw

Thank you!

acreskeyMoz avatar Dec 08 '22 20:12 acreskeyMoz