diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-24 11:40:17 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-24 12:42:11 +0000 |
commit | 5d87695f37678f96492b258bbab36486c59866b4 (patch) | |
tree | be9783bbaf04fb930c4d74ca9c00b5e7954c8bc6 /chromium/net/reporting | |
parent | 6c11fb357ec39bf087b8b632e2b1e375aef1b38b (diff) | |
download | qtwebengine-chromium-5d87695f37678f96492b258bbab36486c59866b4.tar.gz |
BASELINE: Update Chromium to 75.0.3770.56
Change-Id: I86d2007fd27a45d5797eee06f4c9369b8b50ac4f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/net/reporting')
-rw-r--r-- | chromium/net/reporting/README.md | 114 | ||||
-rw-r--r-- | chromium/net/reporting/reporting_cache.h | 17 | ||||
-rw-r--r-- | chromium/net/reporting/reporting_uploader.cc | 2 |
3 files changed, 88 insertions, 45 deletions
diff --git a/chromium/net/reporting/README.md b/chromium/net/reporting/README.md index 82d663a25cf..4d14951a188 100644 --- a/chromium/net/reporting/README.md +++ b/chromium/net/reporting/README.md @@ -4,9 +4,9 @@ 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](http://wicg.github.io/reporting/). This document -assumes that you've read that one. +The parts of it that are exposed to the web platform are specified in the [draft +spec](https://w3c.github.io/reporting/). This document assumes that you've read +that one. ## Reporting in Chromium @@ -14,11 +14,6 @@ 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. -Almost all of Reporting lives in `//net/reporting`; there is a small -amount of code in `//chrome/browser/net` to set up Reporting in -profiles and provide a persistent store for reports and endpoints -across browser restarts. - ### Inside `//net` * The top-level class is the *`ReportingService`*. This lives in the @@ -26,52 +21,83 @@ across browser restarts. other parts of `//net` and other components: queueing reports, handling configuration headers, clearing browsing data, and so on. - * Within `ReportingService` lives *`ReportingContext`*, which in turn - contains the inner workings of Reporting, spread across several - classes: + * 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 *`ReportingCache`* stores undelivered reports and unexpired - endpoint configurations. + * 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 *`ReportingHeaderParser`* parses `Report-To:` headers and - updates the `Cache` accordingly. + * 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 *`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 *`ReportingEndpointManager`* chooses an endpoint from the + cache when one is requested by the `ReportingDeliveryAgent`, and + manages exponential backoff (using `BackoffEntry`) for failing + endpoints. - * 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. + * 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 *`ReportingEndpointManager`* keeps track of which endpoints - are in use, and manages exponential backoff (using - `BackoffEntry`) for failing endpoints. + * The *`ReportingBrowsingDataRemover`* examines the cache upon request + and removes browsing data (reports and endpoints) of selected types + and origins. - * 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 *`ReportingDelegate`* calls upon the `NetworkDelegate` (see below) + to check permissions for queueing/sending reports and setting/using + clients. - * The *`ReportingSerializer`* reads the `Cache` and serializes it - into a `base::Value` for persistent storage (in Chromium, as a - pref); it can also deserialize a serialized `Value` back into the - `Cache`. +* 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`. - * The *`ReportingBrowsingDataRemover`* examines the `Cache` upon - request and removes browsing data (reports and endpoints) of - selected types and origins. +* `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 `*ProfileImplIOData*::InitializeInternal`, the `ReportingService` - is created and set in the `URLRequestContext`, where the net stack - can use it. +* In the network service, a `network::NetworkContext` queues reports by getting + the `ReportingService` from the `URLRequestContext`. + +* The JavaScript [ReportingObserver](https://w3c.github.io/reporting/#observers) + interface lives [in `//third_party/blink/renderer/core/frame/`][1]. + + * It queues reports via the `NetworkContext` using a + `blink::mojom::ReportingServiceProxy` (implemented [in + `//content/browser/net/`][2]), which can queue Intervention, Deprecation, + CSP Violation, and Feature Policy Violation reports. + +* The `ChromeNetworkDelegate` [in `//chrome/browser/net/`][3] 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. - (There is currently no interface to Reporting besides "hop over to - the IO thread and poke the `ReportingService` in your favorite - `URLRequestContext`", but that should change as various components - need to queue reports.) + * This functionality is tested on Android by way of sending Network Error + Logging reports [in the Cronet Java tests][4]. -* *`ChromeReportingDelegate`* implements `ReportingDelegate` and plumbs - the persistent data interface into prefs. It lives in - `//chrome/browser/net`. +[1]: https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/renderer/core/frame/reporting_observer.h +[2]: https://chromium.googlesource.com/chromium/src/+/HEAD/content/browser/net/reporting_service_proxy.cc +[3]: https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/browser/net/chrome_network_delegate.h +[4]: https://chromium.googlesource.com/chromium/src/+/HEAD/components/cronet/android/test/javatests/src/org/chromium/net/NetworkErrorLoggingTest.java diff --git a/chromium/net/reporting/reporting_cache.h b/chromium/net/reporting/reporting_cache.h index 18ed8391448..fc610a1ed26 100644 --- a/chromium/net/reporting/reporting_cache.h +++ b/chromium/net/reporting/reporting_cache.h @@ -35,6 +35,8 @@ class ReportingContext; // "doomed", which will cause it to be deallocated once it is no longer pending. class NET_EXPORT ReportingCache { public: + class PersistentReportingStore; + // Information about the number of deliveries that we've attempted for each // origin and endpoint. struct ClientStatistics { @@ -216,6 +218,21 @@ class NET_EXPORT ReportingCache { const ReportingReport* report) const = 0; }; +// Persistent storage for Reporting reports and clients. +class NET_EXPORT ReportingCache::PersistentReportingStore { + public: + PersistentReportingStore() = default; + virtual ~PersistentReportingStore() = default; + + // TODO(chlily): methods to load, add, update, delete, etc. will be added. + + // Flushes the store. + virtual void Flush() = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(PersistentReportingStore); +}; + } // namespace net #endif // NET_REPORTING_REPORTING_CACHE_H_ diff --git a/chromium/net/reporting/reporting_uploader.cc b/chromium/net/reporting/reporting_uploader.cc index 5e5848b77e1..1f7bfa7e182 100644 --- a/chromium/net/reporting/reporting_uploader.cc +++ b/chromium/net/reporting/reporting_uploader.cc @@ -234,7 +234,7 @@ class ReportingUploaderImpl : public ReportingUploader, URLRequest::Delegate { } void OnAuthRequired(URLRequest* request, - AuthChallengeInfo* auth_info) override { + const AuthChallengeInfo& auth_info) override { request->Cancel(); } |