Hey folks,
In the current FedCM implementation, all network requests are initiated within
the browser process, which prevents them from being intercepted by the Service
Worker. We have recently received a request to enable Service Worker
interception for a subset of these calls, specifically for the /token, /accounts,
and /disconnect endpoints.
I would appreciate your input and feedback on the proposed design choice.
Doc:https://docs.google.com/document/d/1BwqnN_dsOCU9styAN5k1TwKHDWKFcNOQt_pOLgA3zQQ/edit?tab=t.0
CL:https://chromium-review.googlesource.com/c/chromium/src/+/7206662
Thanks,
Suresh
--
You received this message because you are subscribed to the Google Groups "service-worker-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to service-worker-di...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/service-worker-discuss/e35b42ee-0300-47b5-8534-543a4df4419fn%40chromium.org.
The first thing that worries me is the assumption that the identity assertion request (/tokens, in your doc) should be eligible for IDP service worker interception. The request has a null client practically as an implementation detail, but to make its web-exposed privacy/security characteristics the same as ordinary requests fetched by the RP, it's origin is the RP's origin, and the mode is explicitly CORS. So this is a cross-origin CORS request from the RP to the IDP. Generally a request from A.com to B.com is only interceptible by A.com's service workers, as I understand, but in this case you're making it eligible for interception by B.com's (IDP's) service worker, which seems bad. Maybe I'm missing some critical context on why this is OK, but since the origin and request mode were very carefully selected, this smells like a SOP violation.(In your CL's `fedcm_service_worker_url_loader_factory.cc`, this appears to be done in FedCmServiceWorkerURLLoaderFactory::CreateLoaderAndStart(), which immediately generates a storage key for SW look-up based on the request's destination URL, not its origin.On Thu, Jan 8, 2026 at 5:43 PM Nicolás Peña Moreno <n...@google.com> wrote:We currently set the client to null, which likely won't work for service workers. +Dominic Farolino, any thoughts on how we could address this? I remember we previously discussed how the client should be set for FedCM requests.
The confusion stems from the request's initiator vs destination:
Request initiator: Set to RP origin (rp.com) for browser CORS enforcement
Request destination: IDP endpoint (https://idp.example/token)
Service Worker routing: Based on destination URL, not initiator
Why this is correct:
1. Service Workers intercept requests sent to their origin, regardless of who initiated them
2. A fetch to https://idp.example/token should be intercepted by idp.example's SW, not rp.com's SW
3. This is standard SW behavior—same as cross-origin iframe or image requests
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/service-worker-discuss/3d0e6149-8bdf-490d-a9e2-fb85f76db7can%40chromium.org.
This is not a SOP violation—it's the correct behavior.
The confusion stems from the request's initiator vs destination:
Request initiator: Set to RP origin (rp.com) for browser CORS enforcement
Request destination: IDP endpoint (https://idp.example/token)
Service Worker routing: Based on destination URL, not initiator
Why this is correct:
1. Service Workers intercept requests sent to their origin, regardless of who initiated them
2. A fetch to https://idp.example/token should be intercepted by idp.example's SW, not rp.com's SW
3. This is standard SW behavior—same as cross-origin iframe or image requests
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/service-worker-discuss/3f3128ea-032f-4039-8a3e-b96a6dc6278en%40chromium.org.
a) these requests are credentialed
this is not really an issue, since the IDP could just return this data from the regular HTTPS request without a service worker. Also note that ID assertion requests are only made after user confirmation.
IDP’s Service Worker can:
Why This Is Acceptable:
Spec Compliance – “Client” Requirement
To align with the specification, the request must include a valid client to correspond with a service worker.
Current Behavior:
We currently pass empty client_id and resulting_client_id to ServiceWorkerFetchDispatcher.
Spec-Compliant Approach:
Instead, provide the RP’s client UUID as client_id to ensure proper compliance.
I understood that foreign fetch was ripped out in part because of security, hence my SOP concern. I could be wrong, it was before my time. One reason it got removed was due to keying complexity. If two sites A.com and B.com both make requests for Destination.com, in a double-key-cached world we'd need to store and execute two different Destination.com service workers: one under A.com's partition, and one under B.com's. See https://github.com/w3c/ServiceWorker/issues/1188.The proposal here worries me because we're explicitly undoing any natural partitioning the keying would do, by always manufacturing a first-party storage key for SW look-up. The identity assertion request is a legitimate cross-origin request (impl), so why should it access anything behind a first-party key? I think it'd make more sense if the ID assertion request was just a genuine same-origin request to the IDP—but then I guess the IDP couldn't identify the RP from the request, is that bad?
a) these requests are credentialedHow true is this? The request is cross-origin, so it doesn't send any first-party cookies, right? I think it'd only send IDP cookies that are partitioned under the RP's storage partition. Either way, how is that relevant for first-party service worker lookup?
this is not really an issue, since the IDP could just return this data from the regular HTTPS request without a service worker. Also note that ID assertion requests are only made after user confirmation.Very true. Anne pointed out on Matrix that now though, the IDP's service worker could execute script and access first-party storage when another origin makes this request to the IDP, which is novel. All of these cross-origin requests would end up in the same service worker, which might have privacy implications.
I honestly don't feel strongly about any of this, it's just a very peculiar carve-out that feels super special-case-y. Spec-wise though, I think you'd need to give the request a proper "client" to match a service worker, I think, because of how https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-active-service-worker is used in https://fetch.spec.whatwg.org/#ref-for-handle-fetch%E2%91%A0.
Question 3: Privacy Implications - IDP SW Accessing First-Party StorageIDP’s Service Worker can:
- Execute JavaScript when the RP makes requests
- Access the IDP’s first-party storage
- Observe all requests from different RPs within a single SW instance
Spec-Compliant Approach:
Instead, provide the RP’s client UUID as client_id to ensure proper compliance.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/service-worker-discuss/8a185d05-7815-46f5-a5e0-b3752b12a9f0n%40chromium.org.
On Fri, Jan 16, 2026 at 4:24 AM 'suresh potti' via service-worker-discuss <service-wor...@chromium.org> wrote:Question 3: Privacy Implications - IDP SW Accessing First-Party StorageIDP’s Service Worker can:
- Execute JavaScript when the RP makes requests
- Access the IDP’s first-party storage
- Observe all requests from different RPs within a single SW instance
Spec-Compliant Approach:
Instead, provide the RP’s client UUID as client_id to ensure proper compliance.You are suggesting to use the IDP origin's service worker, but say its controlling an RP origin's client? This would be very strange and nothing like what service worker currently does.Regarding the questions about foreign fetch and SOP violations:Foreign fetch did not violate SOP, but it did strongly break "block or partition 3P cookies" semantics. Foreign fetch type behavior was like unpartitioned 3P cookies that also let the 3P run javascript potentially in the background.It seems like this proposal has the same issue? Do we give FedCM an exception on 3P cookie blocking/partitioning without the service worker involved? If so, then I guess this kind of makes sense, but it needs a new spec definition as it's not something done currently.