[go: nahoru, domu]

tree: 6ed5645dc483c98bc093e87fc8bf602d72805659 [path history] [tgz]
  1. DIR_METADATA
  2. mock_persistent_reporting_store.cc
  3. mock_persistent_reporting_store.h
  4. mock_persistent_reporting_store_unittest.cc
  5. OWNERS
  6. README.md
  7. reporting_browsing_data_remover.cc
  8. reporting_browsing_data_remover.h
  9. reporting_browsing_data_remover_unittest.cc
  10. reporting_cache.cc
  11. reporting_cache.h
  12. reporting_cache_impl.cc
  13. reporting_cache_impl.h
  14. reporting_cache_observer.cc
  15. reporting_cache_observer.h
  16. reporting_cache_unittest.cc
  17. reporting_context.cc
  18. reporting_context.h
  19. reporting_delegate.cc
  20. reporting_delegate.h
  21. reporting_delivery_agent.cc
  22. reporting_delivery_agent.h
  23. reporting_delivery_agent_unittest.cc
  24. reporting_endpoint.cc
  25. reporting_endpoint.h
  26. reporting_endpoint_manager.cc
  27. reporting_endpoint_manager.h
  28. reporting_endpoint_manager_unittest.cc
  29. reporting_garbage_collector.cc
  30. reporting_garbage_collector.h
  31. reporting_garbage_collector_unittest.cc
  32. reporting_header_parser.cc
  33. reporting_header_parser.h
  34. reporting_header_parser_fuzzer.cc
  35. reporting_header_parser_unittest.cc
  36. reporting_network_change_observer.cc
  37. reporting_network_change_observer.h
  38. reporting_network_change_observer_unittest.cc
  39. reporting_policy.cc
  40. reporting_policy.h
  41. reporting_policy.proto
  42. reporting_report.cc
  43. reporting_report.h
  44. reporting_service.cc
  45. reporting_service.h
  46. reporting_service_unittest.cc
  47. reporting_test_util.cc
  48. reporting_test_util.h
  49. reporting_uploader.cc
  50. reporting_uploader.h
  51. reporting_uploader_unittest.cc
net/reporting/README.md

Reporting

Reporting is a central mechanism for sending out-of-band error reports to origins from various other components (e.g. HTTP Public Key Pinning, Interventions, or Content Security Policy could potentially use it).

The parts of it that are exposed to the web platform are specified in the draft spec. This document assumes that you've read that one.

Reporting in Chromium

Reporting is implemented as part of the network stack in Chromium, such that it can be used by other parts of the network stack (e.g. HPKP) or by non-browser embedders as well as by Chromium.

Inside //net

  • The top-level class is the ReportingService. This lives in the URLRequestContext, and provides the high-level operations used by other parts of //net and other components: queueing reports, handling configuration headers, clearing browsing data, and so on.

    • A ReportingPolicy specifies a number of parameters for the Reporting API, such as the maximum number of reports and endpoints to queue, the time interval between delivery attempts, whether or not to persist reports and clients across network changes, etc. It is used to create a ReportingService obeying the specified parameters.

    • Within ReportingService lives ReportingContext, which in turn contains the inner workings of Reporting, spread across several classes:

      • The ReportingCache stores undelivered reports and endpoint configurations (aka “clients” in the spec).

      • The ReportingHeaderParser parses Report-To: headers and updates the cache accordingly.

      • The ReportingDeliveryAgent reads reports from the cache, decides which endpoints to deliver them to, and attempts to do so. It uses a couple of helper classes:

        • The ReportingUploader does the low-level work of delivering reports: accepts a URL and JSON from the DeliveryAgent, creates a URLRequest, and parses the result. It also handles sending CORS preflight requests for cross-origin report uploads.

        • The ReportingEndpointManager chooses an endpoint from the cache when one is requested by the ReportingDeliveryAgent, and manages exponential backoff (using BackoffEntry) for failing endpoints.

      • The ReportingGarbageCollector periodically examines the cache and removes reports that have remained undelivered for too long, or that have failed delivery too many times.

      • The ReportingBrowsingDataRemover examines the cache upon request and removes browsing data (reports and endpoints) of selected types and origins.

      • The ReportingDelegate calls upon the NetworkDelegate (see below) to check permissions for queueing/sending reports and setting/using clients.

  • The ReportingService is set up in a URLRequestContext by passing a ReportingPolicy to the URLRequestContextBuilder. This creates a ReportingService which is owned by the URLRequestContextStorage.

  • Report-To: headers are processed by an HttpNetworkTransaction when they are received, and passed on to the ReportingService to be added to the cache.

Outside //net

  • In the network service, a network::NetworkContext queues reports by getting the ReportingService from the URLRequestContext.

  • The JavaScript ReportingObserver interface lives in //third_party/blink/renderer/core/frame/.

    • It queues reports via the NetworkContext using a blink::mojom::ReportingServiceProxy (implemented in //content/browser/net/), which can queue Intervention, Deprecation, CSP Violation, and Permissions Policy Violation reports.
  • The ChromeNetworkDelegate in //chrome/browser/net/ checks permissions for queueing reports and setting/using clients based on whether cookie access is allowed, and checks permissions for sending reports using a ReportingPermissionsChecker, which checks whether the user has allowed report uploading via the BACKGROUND_SYNC permission.

  • Cronet can configure “preloaded” Report-To: headers (as well as Network Error Logging headers) when initializing a CronetURLRequestContext, to allow embedders to collect and send reports before having received a header in an actual response.