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.
Yes, I'm sure that's correct, but from a privacy perspective it seems like if you have unpartitioned cookies, even if limited to SameSite=None, this is no worse?j
(BTW, was this a public matrix channel? Is that a place I should/could join?)
Hm, maybe my comment in https://github.com/w3c-fedid/FedCM/pull/787#issuecomment-3755636126 was wrong, I think what you are saying is that if the client is set up correctly then we would only trigger the IDP's service worker?
Would introducing a new specification definition be sufficient to justify the design choices made for FedCM Service Worker Interception - Google Docs ? Additionally, should these amendments be incorporated into the Fetch spec or the Service Worker spec?
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/service-worker-discuss/4db26385-84ba-4dce-8f55-c78701647671n%40chromium.org.
Hi folks,
I apologize for the late response, as this thread has been quiet for nearly a month. However, the topic recently came up during our Service Worker editors' weekly sync, and I wanted to share my current perspective.
I should also clarify that when the FedCM team consulted me internally on this issue, I initially stated that I didn't see any serious concerns. At that time, I hadn't fully realized the proposal involved reusing the existing fetch handler for these specific requests. It was only after reading Ben Kelly's questions that I recognized the potential architectural issues I had overlooked. I apologize for not catching this sooner, and I’d like to provide my updated opinion on this point.
Having revisited the proposal and the concerns raised about partitioning and potential SOP violations, I believe we should carefully consider whether forcing this integration into the existing fetch handler is the right path. Manufacturing a first-party storage key for cross-origin requests — even if constrained — would likely require a "rigorous privacy and security review" and risks introducing behavior that "smells like a SOP violation".
From a Service Worker architecture standpoint, I’m concerned that the disadvantages of using the fetch handler for this use case may outweigh the benefits:
Ultimately, I believe providing a clear, explicit interface for FedCM is better for long-term maintainability than performing "spec gymnastics" to warp the fetch algorithm. Moreover, I suggest using the "Fire Functional Event" algorithm, as the Payment Handler API does.
Best regards,
Yoshisato
> This is tricky to spec correctly in a world where third-party cookies are disabled, I don't believe there is a way to say "send unpartitioned SameSite=None/Lax cookies for these requests". That was the intent here and is what Chrome implements.Is there a spec bug filed for this? It seems pretty bad if Chromium and the spec significantly differ here.Yes, I'm sure that's correct, but from a privacy perspective it seems like if you have unpartitioned cookies, even if limited to SameSite=None, this is no worse?jProbably. That sounds reasonable to me. It's a shame the spec does not use unpartitioned cookies though? Maybe we need to piggy-back on some kind of requestStorageAccess infra? Not sure.(BTW, was this a public matrix channel? Is that a place I should/could join?)Check out https://whatwg.org/chat. It's the public WHATWG chat.Hm, maybe my comment in https://github.com/w3c-fedid/FedCM/pull/787#issuecomment-3755636126 was wrong, I think what you are saying is that if the client is set up correctly then we would only trigger the IDP's service worker?I'm saying what Ben said above. By default, the RP's SW gets triggered, unless extensive spec gymnastics are made to warp the request into one that's simultaneously cross-origin (fetched from the RP's origin) and finds the IDP's (target origin's) SW. I added a little bit more in https://github.com/w3c-fedid/FedCM/pull/787#issuecomment-3770036628.Would introducing a new specification definition be sufficient to justify the design choices made for FedCM Service Worker Interception - Google Docs ? Additionally, should these amendments be incorporated into the Fetch spec or the Service Worker spec?See my above comment on the spec. It would be good to read all of the relevant spec algorithms, and add a spec design section to the design document. But I think we really don't want to make this decision in a vacuum. I strongly suggest getting feedback on this from Chrome platform Privacy/Security folks, other browsers, and probably the TAG. I am happy to help review any public summaries of the feature / requests for comment.
To unsubscribe from this group and stop receiving emails from it, send an email to service-worker-discuss+unsub...@chromium.org.
Hi,
I've incorporated your feedback and created alternative approaches, including the PaymentHandler API (Approach B).
Could you review Approaches B and C and let me know your thoughts as well as the suggested next steps?
Link: Enabling IDP Interception in FedCM Request - Extended - Google Docs
Thanks,
Suresh
Hi folks,
I apologize for the late response, as this thread has been quiet for nearly a month. However, the topic recently came up during our Service Worker editors' weekly sync, and I wanted to share my current perspective.
I should also clarify that when the FedCM team consulted me internally on this issue, I initially stated that I didn't see any serious concerns. At that time, I hadn't fully realized the proposal involved reusing the existing fetch handler for these specific requests. It was only after reading Ben Kelly's questions that I recognized the potential architectural issues I had overlooked. I apologize for not catching this sooner, and I’d like to provide my updated opinion on this point.
Having revisited the proposal and the concerns raised about partitioning and potential SOP violations, I believe we should carefully consider whether forcing this integration into the existing fetch handler is the right path. Manufacturing a first-party storage key for cross-origin requests — even if constrained — would likely require a "rigorous privacy and security review" and risks introducing behavior that "smells like a SOP violation".
From a Service Worker architecture standpoint, I’m concerned that the disadvantages of using the fetch handler for this use case may outweigh the benefits:
- Complexity and Misalignment: The fetch handler has a well-established philosophy. Attempting to warp it to handle these specific browser-initiated, cross-origin requests results in "spec gymnastics" that makes long-term maintainability more difficult.
- Developer Confusion: Reusing the existing handler requires developers to manually distinguish FedCM-intercepted requests from ordinary fetches. I share the concern that these "minor differences could lead to confusion among developers".
- A Dedicated Entry Point: A "separated entry point for this specific use case seems preferable". Introducing a dedicated functional event — similar to how the Payment Handler API functions — would likely be the "path of least resistance".
Ultimately, I believe providing a clear, explicit interface for FedCM is better for long-term maintainability than performing "spec gymnastics" to warp the fetch algorithm. Moreover, I suggest using the "Fire Functional Event" algorithm, as the Payment Handler API does.
Best regards,
Yoshisato
On Tuesday, January 20, 2026 at 11:03:07 PM UTC+9 Dominic Farolino wrote:> This is tricky to spec correctly in a world where third-party cookies are disabled, I don't believe there is a way to say "send unpartitioned SameSite=None/Lax cookies for these requests". That was the intent here and is what Chrome implements.Is there a spec bug filed for this? It seems pretty bad if Chromium and the spec significantly differ here.Yes, I'm sure that's correct, but from a privacy perspective it seems like if you have unpartitioned cookies, even if limited to SameSite=None, this is no worse?jProbably. That sounds reasonable to me. It's a shame the spec does not use unpartitioned cookies though? Maybe we need to piggy-back on some kind of requestStorageAccess infra? Not sure.(BTW, was this a public matrix channel? Is that a place I should/could join?)Check out https://whatwg.org/chat. It's the public WHATWG chat.Hm, maybe my comment in https://github.com/w3c-fedid/FedCM/pull/787#issuecomment-3755636126 was wrong, I think what you are saying is that if the client is set up correctly then we would only trigger the IDP's service worker?I'm saying what Ben said above. By default, the RP's SW gets triggered, unless extensive spec gymnastics are made to warp the request into one that's simultaneously cross-origin (fetched from the RP's origin) and finds the IDP's (target origin's) SW. I added a little bit more in https://github.com/w3c-fedid/FedCM/pull/787#issuecomment-3770036628.Would introducing a new specification definition be sufficient to justify the design choices made for FedCM Service Worker Interception - Google Docs ? Additionally, should these amendments be incorporated into the Fetch spec or the Service Worker spec?See my above comment on the spec. It would be good to read all of the relevant spec algorithms, and add a spec design section to the design document. But I think we really don't want to make this decision in a vacuum. I strongly suggest getting feedback on this from Chrome platform Privacy/Security folks, other browsers, and probably the TAG. I am happy to help review any public summaries of the feature / requests for comment.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/service-worker-discuss/8ae1cd48-971f-4bac-8834-d19b41355cdcn%40chromium.org.