• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

OWNERSH A D16-Feb-202168 42

README.mdH A D16-Feb-20215 KiB10477

mock_persistent_reporting_store.ccH A D16-Feb-202111.2 KiB296252

mock_persistent_reporting_store.hH A D16-Feb-20216.3 KiB16888

mock_persistent_reporting_store_unittest.ccH A D16-Feb-20218.5 KiB222171

reporting_browsing_data_remover.ccH A D16-Feb-20211.7 KiB5943

reporting_browsing_data_remover.hH A D16-Feb-20211.7 KiB5125

reporting_browsing_data_remover_unittest.ccH A D16-Feb-20215.1 KiB167130

reporting_cache.ccH A D16-Feb-2021545 2110

reporting_cache.hH A D16-Feb-202112.6 KiB294120

reporting_cache_impl.ccH A D16-Feb-202149.3 KiB1,3531,034

reporting_cache_impl.hH A D16-Feb-202114.9 KiB337188

reporting_cache_observer.ccH A D16-Feb-2021483 187

reporting_cache_observer.hH A D16-Feb-2021835 3316

reporting_cache_unittest.ccH A D16-Feb-202168.6 KiB1,6601,330

reporting_context.ccH A D16-Feb-20213.6 KiB11187

reporting_context.hH A D16-Feb-20213.6 KiB11272

reporting_delegate.ccH A D16-Feb-20212 KiB7150

reporting_delegate.hH A D16-Feb-20211.6 KiB5429

reporting_delivery_agent.ccH A D16-Feb-202113.3 KiB366255

reporting_delivery_agent.hH A D16-Feb-20212.3 KiB6522

reporting_delivery_agent_unittest.ccH A D16-Feb-202123.5 KiB633454

reporting_endpoint.ccH A D16-Feb-20214.1 KiB11786

reporting_endpoint.hH A D16-Feb-20216.1 KiB17786

reporting_endpoint_manager.ccH A D16-Feb-20216.1 KiB177127

reporting_endpoint_manager.hH A D16-Feb-20212.5 KiB7237

reporting_endpoint_manager_unittest.ccH A D16-Feb-202122.4 KiB607468

reporting_garbage_collector.ccH A D16-Feb-20213 KiB9565

reporting_garbage_collector.hH A D16-Feb-20211.2 KiB4119

reporting_garbage_collector_unittest.ccH A D16-Feb-20212.9 KiB9366

reporting_header_parser.ccH A D16-Feb-20217 KiB218158

reporting_header_parser.hH A D16-Feb-2021916 3723

reporting_header_parser_fuzzer.ccH A D16-Feb-20213.7 KiB9271

reporting_header_parser_unittest.ccH A D16-Feb-202177 KiB1,7051,443

reporting_network_change_observer.ccH A D16-Feb-20212.1 KiB6640

reporting_network_change_observer.hH A D16-Feb-2021851 3014

reporting_network_change_observer_unittest.ccH A D16-Feb-20214.5 KiB135104

reporting_policy.ccH A D16-Feb-20212 KiB6143

reporting_policy.hH A D16-Feb-20212.8 KiB8330

reporting_policy.protoH A D16-Feb-20211.4 KiB3730

reporting_report.ccH A D16-Feb-20211.8 KiB7151

reporting_report.hH A D16-Feb-20213.8 KiB12663

reporting_service.ccH A D16-Feb-20219.1 KiB281211

reporting_service.hH A D16-Feb-20213.6 KiB10351

reporting_service_unittest.ccH A D16-Feb-202116.5 KiB402319

reporting_test_util.ccH A D16-Feb-202111.2 KiB360293

reporting_test_util.hH A D16-Feb-202110.9 KiB350231

reporting_uploader.ccH A D16-Feb-202111.7 KiB324249

reporting_uploader.hH A D16-Feb-20211.7 KiB6031

reporting_uploader_unittest.ccH A D16-Feb-202123.9 KiB657535

README.md

1# Reporting
2
3Reporting is a central mechanism for sending out-of-band error reports
4to origins from various other components (e.g. HTTP Public Key Pinning,
5Interventions, or Content Security Policy could potentially use it).
6
7The parts of it that are exposed to the web platform are specified in the [draft
8spec](https://w3c.github.io/reporting/). This document assumes that you've read
9that one.
10
11## Reporting in Chromium
12
13Reporting is implemented as part of the network stack in Chromium, such
14that it can be used by other parts of the network stack (e.g. HPKP) or
15by non-browser embedders as well as by Chromium.
16
17### Inside `//net`
18
19* The top-level class is the *`ReportingService`*. This lives in the
20  `URLRequestContext`, and provides the high-level operations used by
21  other parts of `//net` and other components: queueing reports,
22  handling configuration headers, clearing browsing data, and so on.
23
24    * A *`ReportingPolicy`* specifies a number of parameters for the Reporting
25      API, such as the maximum number of reports and endpoints to queue, the
26      time interval between delivery attempts, whether or not to persist reports
27      and clients across network changes, etc. It is used to create a
28      `ReportingService` obeying the specified parameters.
29
30    * Within `ReportingService` lives *`ReportingContext`*, which in turn
31      contains the inner workings of Reporting, spread across several classes:
32
33        * The *`ReportingCache`* stores undelivered reports and endpoint
34          configurations (aka "clients" in the spec).
35
36        * The *`ReportingHeaderParser`* parses `Report-To:` headers and updates
37          the cache accordingly.
38
39        * The *`ReportingDeliveryAgent`* reads reports from the cache, decides
40          which endpoints to deliver them to, and attempts to do so. It uses a
41          couple of helper classes:
42
43            * The *`ReportingUploader`* does the low-level work of delivering
44              reports: accepts a URL and JSON from the `DeliveryAgent`, creates
45              a `URLRequest`, and parses the result. It also handles sending
46              CORS preflight requests for cross-origin report uploads.
47
48            * The *`ReportingEndpointManager`* chooses an endpoint from the
49              cache when one is requested by the `ReportingDeliveryAgent`, and
50              manages exponential backoff (using `BackoffEntry`) for failing
51              endpoints.
52
53        * The *`ReportingGarbageCollector`* periodically examines the cache
54          and removes reports that have remained undelivered for too long, or
55          that have failed delivery too many times.
56
57        * The *`ReportingBrowsingDataRemover`* examines the cache upon request
58          and removes browsing data (reports and endpoints) of selected types
59          and origins.
60
61        * The *`ReportingDelegate`* calls upon the `NetworkDelegate` (see below)
62          to check permissions for queueing/sending reports and setting/using
63          clients.
64
65* The `ReportingService` is set up in a `URLRequestContext` by passing a
66  `ReportingPolicy` to the `URLRequestContextBuilder`. This creates a
67  `ReportingService` which is owned by the `URLRequestContextStorage`.
68
69* `Report-To:` headers are processed by an `HttpNetworkTransaction` when they
70  are received, and passed on to the `ReportingService` to be added to the
71  cache.
72
73### Outside `//net`
74
75* In the network service, a `network::NetworkContext` queues reports by getting
76  the `ReportingService` from the `URLRequestContext`.
77
78* The JavaScript [ReportingObserver](https://w3c.github.io/reporting/#observers)
79  interface lives [in `//third_party/blink/renderer/core/frame/`][1].
80
81    * It queues reports via the `NetworkContext` using a
82      `blink::mojom::ReportingServiceProxy` (implemented [in
83      `//content/browser/net/`][2]), which can queue Intervention, Deprecation,
84      CSP Violation, and Feature Policy Violation reports.
85
86* The `ChromeNetworkDelegate` [in `//chrome/browser/net/`][3] checks permissions
87  for queueing reports and setting/using clients based on whether cookie access
88  is allowed, and checks permissions for sending reports using a
89  `ReportingPermissionsChecker`, which checks whether the user has allowed
90  report uploading via the BACKGROUND_SYNC permission.
91
92* Cronet can configure "preloaded" `Report-To:` headers (as well as Network
93  Error Logging headers) when initializing a `CronetURLRequestContext`, to allow
94  embedders to collect and send reports before having received a header in an
95  actual response.
96
97    * This functionality is tested on Android by way of sending Network Error
98      Logging reports [in the Cronet Java tests][4].
99
100[1]: https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/renderer/core/frame/reporting_observer.h
101[2]: https://chromium.googlesource.com/chromium/src/+/HEAD/content/browser/net/reporting_service_proxy.cc
102[3]: https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/browser/net/chrome_network_delegate.h
103[4]: https://chromium.googlesource.com/chromium/src/+/HEAD/components/cronet/android/test/javatests/src/org/chromium/net/NetworkErrorLoggingTest.java
104