Skip to content

Latest commit

 

History

History
46 lines (39 loc) · 4.75 KB

background_fetch.md

File metadata and controls

46 lines (39 loc) · 4.75 KB

Component: Background Fetch API

1. Component Focus

  • Functionality: Implements the Background Fetch API (Spec), allowing service workers to initiate and manage large downloads (and potentially uploads) that persist even if the initiating page/tab is closed. Provides UI for tracking progress.
  • Key Logic: Registering fetches (BackgroundFetchManager), managing download/upload jobs (BackgroundFetchJobController), interacting with the download system and service workers, handling permissions and quotas, updating UI.
  • Core Files:
    • content/browser/background_fetch/: Core browser-side implementation (e.g., background_fetch_manager.cc, background_fetch_job_controller.cc).
    • third_party/blink/renderer/modules/background_fetch/: Renderer-side API implementation (BackgroundFetchManager).
    • components/background_fetch/: Shared components.
    • Interaction with content/browser/download/download_manager_impl.cc and content/browser/service_worker/.

2. Potential Logic Flaws & VRP Relevance

  • Policy Bypass (SameSite): Using Background Fetch registration or completion events to initiate requests that bypass SameSite cookie restrictions.
    • VRP Pattern (SameSite Bypass): Background Fetch could be used to bypass SameSite=Lax cookie protections, potentially by having the completion event trigger a cross-site request. (VRP: 1244289, VRP2.txt#10929). See privacy.md.
  • Information Leaks (Resource Size): Leaking information about the size of cross-origin resources via the API's behavior or error reporting.
    • VRP Pattern (Resource Size Leak): Differences in behavior or progress reporting when fetching cross-origin resources of different sizes could leak size information. (VRP: 1247376, 1260649, 1267311; VRP2.txt#10920, #10690, #10871). See privacy.md.
  • Quota/Resource Exhaustion (DoS): Exploiting the API to consume excessive bandwidth, storage, or processing power without proper limits or cleanup.
  • Permission/Scope Issues: Incorrectly handling permissions or allowing fetches outside the registered service worker's scope.
  • Interaction with Downloads/Service Workers: Flaws in how Background Fetch interacts with the standard download manager or service worker lifecycle.

3. Further Analysis and Potential Issues

  • SameSite Cookie Handling: Analyze how requests initiated by Background Fetch (both the fetch itself and any subsequent requests triggered by events like backgroundfetchsuccess) handle SameSite cookies. Ensure they are treated appropriately based on the context. (VRP: 1244289).
  • Resource Size Leak Mitigation: Review how fetch progress and completion are handled, especially for cross-origin requests, to prevent leaking size information through timing or distinct behaviors. (VRP: 1247376, etc.).
  • Quota Management: How are storage and bandwidth quotas enforced for Background Fetch operations? Can these be bypassed or exhausted?
  • Job Management (BackgroundFetchJobController): Analyze state management for fetch jobs. Look for race conditions or error handling flaws during download/upload processing, pausing, resuming, or aborting.
  • UI Security: Can the Background Fetch UI (progress notifications/bar) be spoofed or used to mislead the user?

4. Code Analysis

  • BackgroundFetchManager (Blink): Renderer-side API entry point (fetch).
  • BackgroundFetchManager (Browser): Browser-side manager (StartFetch). Handles registration and coordination.
  • BackgroundFetchJobController: Manages the lifecycle of a single Background Fetch job (downloads, uploads, events).
  • BackgroundFetchDataManger: Handles storage/persistence of fetch metadata.
  • Interaction points with DownloadService / DownloadManager.
  • Interaction points with ServiceWorkerContext.

5. Areas Requiring Further Investigation

  • SameSite Bypass: Test scenarios where Background Fetch events trigger navigations or subresource requests to ensure SameSite cookies are correctly handled.
  • Resource Size Leaks: Design tests to probe timing differences or distinct behaviors based on resource size for cross-origin Background Fetches.
  • Quota Enforcement: Test the effectiveness of storage and network quota limits.
  • Error Handling: Analyze how failures during downloads/uploads within a Background Fetch job are handled and reported.

6. Related VRP Reports

  • SameSite Bypass: VRP: 1244289 / VRP2.txt#10929
  • Resource Size Leak: VRP: 1247376, 1260649, 1267311; VRP2.txt#10920, #10690, #10871

(See also privacy.md, downloads.md, service_workers.md)