[Connection-Allowlist] Enforce for PaymentRequest API: service worker registration [chromium/src : main]

0 views
Skip to first unread message

Xiaochen Zhou (Gerrit)

unread,
Jul 8, 2026, 12:05:32 PM (yesterday) Jul 8
to Shivani Sharma, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Hiroki Nakagawa, prerendering-reviews, blink-revie...@chromium.org, blink-...@chromium.org, apaselti...@chromium.org, blink-work...@chromium.org, chromium-a...@chromium.org, dullweb...@chromium.org, extension...@chromium.org, gavin...@chromium.org, horo+...@chromium.org, kinuko+ser...@chromium.org, kinuko...@chromium.org, lingqi...@chromium.org, loading...@chromium.org, msrame...@chromium.org, servicewor...@chromium.org, shimazu+se...@chromium.org, sloboda...@chromium.org, tburkar...@chromium.org
Attention needed from Shivani Sharma

Xiaochen Zhou added 1 comment

Patchset-level comments
File-level comment, Patchset 19 (Latest):
Xiaochen Zhou . resolved

+shivanisha@ for code review, thank you.

Open in Gerrit

Related details

Attention is currently required from:
  • Shivani Sharma
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id91a03dd5f19b1920b000f10395431065e9a1c66
Gerrit-Change-Number: 7927268
Gerrit-PatchSet: 19
Gerrit-Owner: Xiaochen Zhou <xiaoc...@chromium.org>
Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
Gerrit-Reviewer: Xiaochen Zhou <xiaoc...@chromium.org>
Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
Gerrit-Attention: Shivani Sharma <shiva...@chromium.org>
Gerrit-Comment-Date: Wed, 08 Jul 2026 16:05:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Shivani Sharma (Gerrit)

unread,
11:27 AM (6 hours ago) 11:27 AM
to Xiaochen Zhou, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Hiroki Nakagawa, prerendering-reviews, blink-revie...@chromium.org, blink-...@chromium.org, apaselti...@chromium.org, blink-work...@chromium.org, chromium-a...@chromium.org, dullweb...@chromium.org, extension...@chromium.org, gavin...@chromium.org, horo+...@chromium.org, kinuko+ser...@chromium.org, kinuko...@chromium.org, lingqi...@chromium.org, loading...@chromium.org, msrame...@chromium.org, servicewor...@chromium.org, shimazu+se...@chromium.org, sloboda...@chromium.org, tburkar...@chromium.org
Attention needed from Xiaochen Zhou

Shivani Sharma added 1 comment

File content/browser/service_worker/service_worker_context_wrapper.cc
Line 609, Patchset 19 (Latest): GlobalRenderFrameHostId requesting_frame_id,
Shivani Sharma . unresolved

Does it not go through ServiceWorkerRegisterJob()? PTAL at https://source.chromium.org/chromium/chromium/src/+/main:content/browser/service_worker/service_worker_register_job.cc;drc=0bedfcc1f8e786bfd905e2d16909da4504df025f;l=82
for how that path creates a new creator_NRID so that even if the creator dies, its CA can be checked. If it doesn't use that path which would have been ideal, we could do something similar or error out if the Frame I'd is valid but the RFH is not.

Open in Gerrit

Related details

Attention is currently required from:
  • Xiaochen Zhou
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id91a03dd5f19b1920b000f10395431065e9a1c66
    Gerrit-Change-Number: 7927268
    Gerrit-PatchSet: 19
    Gerrit-Owner: Xiaochen Zhou <xiaoc...@chromium.org>
    Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
    Gerrit-Reviewer: Xiaochen Zhou <xiaoc...@chromium.org>
    Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Xiaochen Zhou <xiaoc...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jul 2026 15:27:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Xiaochen Zhou (Gerrit)

    unread,
    12:36 PM (5 hours ago) 12:36 PM
    to Stephen McGruer, Shivani Sharma, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Hiroki Nakagawa, prerendering-reviews, blink-revie...@chromium.org, blink-...@chromium.org, apaselti...@chromium.org, blink-work...@chromium.org, chromium-a...@chromium.org, dullweb...@chromium.org, extension...@chromium.org, gavin...@chromium.org, horo+...@chromium.org, kinuko+ser...@chromium.org, kinuko...@chromium.org, lingqi...@chromium.org, loading...@chromium.org, msrame...@chromium.org, servicewor...@chromium.org, shimazu+se...@chromium.org, sloboda...@chromium.org, tburkar...@chromium.org
    Attention needed from Shivani Sharma and Stephen McGruer

    Xiaochen Zhou added 2 comments

    Patchset-level comments
    Xiaochen Zhou . resolved

    +Payment API owner smcgruer@ for a question, please see the comment below. Thank you.

    File content/browser/service_worker/service_worker_context_wrapper.cc
    Line 609, Patchset 19 (Latest): GlobalRenderFrameHostId requesting_frame_id,
    Shivani Sharma . unresolved

    Does it not go through ServiceWorkerRegisterJob()? PTAL at https://source.chromium.org/chromium/chromium/src/+/main:content/browser/service_worker/service_worker_register_job.cc;drc=0bedfcc1f8e786bfd905e2d16909da4504df025f;l=82
    for how that path creates a new creator_NRID so that even if the creator dies, its CA can be checked. If it doesn't use that path which would have been ideal, we could do something similar or error out if the Frame I'd is valid but the RFH is not.

    Xiaochen Zhou

    Does it not go through ServiceWorkerRegisterJob()?

    Yes, it does. The ServiceWorkerRegisterJob will receive the policies from `GetPoliciesForRegistration`.

    For cases that the RFH has gone at the time of this function call, we have two approaches:

    • **Fail-open:** allow the registration to continue with the fallback policies (same as the one constructed by the pre-existing code). The SW registration has no CA to check since the CA is stored in the RFH's policies. A request can go through even though it would have been blocked by CA. But this keeps the pre-existing behavior.
    • **Fail-closed:** abort the registration if the RFH has gone.

    Fail-closed avoids the risk of data exfiltration of the other option. For reference, for FedCM API, we also agreed to fail-closed: if RFH is gone at the time the CA needs to be retrieved from the RFH, the FedCM API's network requests will not be made.

    @smcg...@chromium.org for opinions from Payment API owners, thank you.

    Note: neither will affect the behavior of Extension's usage of `ServiceWorkerContextWrapper::RegisterServiceWorker`. Because it passes an invalid frame ID and it will not check whether RFH is alive or not, so it always falls back to the pre-existing behavior. Extension is the only other client of this function.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Shivani Sharma
    • Stephen McGruer
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id91a03dd5f19b1920b000f10395431065e9a1c66
    Gerrit-Change-Number: 7927268
    Gerrit-PatchSet: 19
    Gerrit-Owner: Xiaochen Zhou <xiaoc...@chromium.org>
    Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
    Gerrit-Reviewer: Stephen McGruer <smcg...@chromium.org>
    Gerrit-Reviewer: Xiaochen Zhou <xiaoc...@chromium.org>
    Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Shivani Sharma <shiva...@chromium.org>
    Gerrit-Attention: Stephen McGruer <smcg...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jul 2026 16:36:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Shivani Sharma <shiva...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Stephen McGruer (Gerrit)

    unread,
    2:50 PM (3 hours ago) 2:50 PM
    to Xiaochen Zhou, Stephen McGruer, Shivani Sharma, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Hiroki Nakagawa, prerendering-reviews, blink-revie...@chromium.org, blink-...@chromium.org, apaselti...@chromium.org, blink-work...@chromium.org, chromium-a...@chromium.org, dullweb...@chromium.org, extension...@chromium.org, gavin...@chromium.org, horo+...@chromium.org, kinuko+ser...@chromium.org, kinuko...@chromium.org, lingqi...@chromium.org, loading...@chromium.org, msrame...@chromium.org, servicewor...@chromium.org, shimazu+se...@chromium.org, sloboda...@chromium.org, tburkar...@chromium.org
    Attention needed from Xiaochen Zhou

    Stephen McGruer added 2 comments

    File components/payments/content/service_worker_payment_app.cc
    Line 40, Patchset 19 (Latest): content::GlobalRenderFrameHostId requesting_frame_id,
    Stephen McGruer . unresolved

    This shouldn't be needed in this path, since needs_installation_ is false and thus the code will never attempt to install a service worker.

    File content/browser/service_worker/service_worker_context_wrapper.cc
    Line 609, Patchset 19 (Latest): GlobalRenderFrameHostId requesting_frame_id,
    Shivani Sharma . unresolved

    Does it not go through ServiceWorkerRegisterJob()? PTAL at https://source.chromium.org/chromium/chromium/src/+/main:content/browser/service_worker/service_worker_register_job.cc;drc=0bedfcc1f8e786bfd905e2d16909da4504df025f;l=82
    for how that path creates a new creator_NRID so that even if the creator dies, its CA can be checked. If it doesn't use that path which would have been ideal, we could do something similar or error out if the Frame I'd is valid but the RFH is not.

    Xiaochen Zhou

    Does it not go through ServiceWorkerRegisterJob()?

    Yes, it does. The ServiceWorkerRegisterJob will receive the policies from `GetPoliciesForRegistration`.

    For cases that the RFH has gone at the time of this function call, we have two approaches:

    • **Fail-open:** allow the registration to continue with the fallback policies (same as the one constructed by the pre-existing code). The SW registration has no CA to check since the CA is stored in the RFH's policies. A request can go through even though it would have been blocked by CA. But this keeps the pre-existing behavior.
    • **Fail-closed:** abort the registration if the RFH has gone.

    Fail-closed avoids the risk of data exfiltration of the other option. For reference, for FedCM API, we also agreed to fail-closed: if RFH is gone at the time the CA needs to be retrieved from the RFH, the FedCM API's network requests will not be made.

    @smcg...@chromium.org for opinions from Payment API owners, thank you.

    Note: neither will affect the behavior of Extension's usage of `ServiceWorkerContextWrapper::RegisterServiceWorker`. Because it passes an invalid frame ID and it will not check whether RFH is alive or not, so it always falls back to the pre-existing behavior. Extension is the only other client of this function.

    Stephen McGruer

    IIUC, for PaymentRequest this scenario would mean that:

    1. Website created new PaymentRequest([{supportedMethods: 'https://paymentapp.example', ..}], ...);
    2. `https://paymentapp.example` does not yet have a Payment Handler service worker installed
    3. Website calls PaymentRequest.show(), which triggers install via ServiceWorkerPaymentApp::InvokePaymentApp
    4. Sometime in-between the website calling that and the service worker actually being installed, the website goes away (e.g. via the tab being closed)
    5. We hit this point, and have to decide if we continue to install the service worker or not.

    Is that accurate?

    Assuming so, I think we're fine to fail closed here. The payment app will just be installed when the next website that wants to invoke it creates a PaymentRequest and calls show(). I don't think there's any harm to cancelling the install (and if there was, then that would be a bug anyway since anything could interrupt it, e.g. a power cut 😄).

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Xiaochen Zhou
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id91a03dd5f19b1920b000f10395431065e9a1c66
    Gerrit-Change-Number: 7927268
    Gerrit-PatchSet: 19
    Gerrit-Owner: Xiaochen Zhou <xiaoc...@chromium.org>
    Gerrit-Reviewer: Shivani Sharma <shiva...@chromium.org>
    Gerrit-Reviewer: Stephen McGruer <smcg...@chromium.org>
    Gerrit-Reviewer: Xiaochen Zhou <xiaoc...@chromium.org>
    Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Xiaochen Zhou <xiaoc...@chromium.org>
    Gerrit-Comment-Date: Thu, 09 Jul 2026 18:49:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Shivani Sharma <shiva...@chromium.org>
    Comment-In-Reply-To: Xiaochen Zhou <xiaoc...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages