Skip to content

Add document origin to request context - #512

Open
marcoscaceres wants to merge 15 commits into
mainfrom
add-document-origin-to-request-context
Open

Add document origin to request context#512
marcoscaceres wants to merge 15 commits into
mainfrom
add-document-origin-to-request-context

Conversation

@marcoscaceres

@marcoscaceres marcoscaceres commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Fixes a spec bug where Digital Credentials requests from cross-origin iframes use the wrong origin. Credential Management already passes the calling document's origin to [[DiscoverFromExternalSource]], but the spec was re-deriving the top-level origin instead. This threads documentOrigin through prepare credential requests and initiate the credential request, storing it in the request context struct as document origin (replacing top-level origin).

Closes #333
Closes #504

  • Modified Web platform tests (link)

Implementation commitment:

  • WebKit
  • Chromium (link to issue)
  • Gecko (link to issue)

Documentation and checks:

  • Affects privacy
  • Affects security
  • Pinged MDN
  • Updated Explainer
  • Updated digitalcredentials.dev

Preview | Diff

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Digital Credentials specification to correctly thread the calling document’s origin through the request pipeline, so cross-origin iframe requests no longer (incorrectly) use only the top-level origin when constructing request context and presenting UI.

Changes:

  • Add a documentOrigin parameter to “prepare credential requests” and “initiate the credential request”, and store it as document origin in the request context struct.
  • Retain top-level origin in request context, clarifying it is for user presentation only, and add guidance on presenting one vs. two origins.
  • Add a SecurityError rejection when the top-level origin is opaque in [[DiscoverFromExternalSource]] and [[Create]].

Comment thread index.html
Comment thread index.html Outdated
Comment thread index.html Outdated
@marcoscaceres
marcoscaceres force-pushed the add-document-origin-to-request-context branch from 2f17374 to 557bda9 Compare July 14, 2026 09:06
Comment thread index.html Outdated
Comment thread index.html Outdated
Comment thread index.html Outdated
@hlflanagan

Copy link
Copy Markdown

Discussed on 27 July 2026. Group requested to review.

marcoscaceres and others added 12 commits July 30, 2026 18:08
Thread the `origin` parameter from Credential Management's
`[[DiscoverFromExternalSource]]` through to the request context as
`document origin`. This is the calling document's origin (i.e., the
iframe's origin in cross-origin scenarios), which is needed for request
validation.

The top-level origin remains for credential chooser UI display. Both
are now available in the request context for their respective purposes.

Closes #504
The request context now carries both the document origin, the origin in
which the request was made (the calling document's environment settings
object's origin, per Credential Management), and the top-level origin,
used only when presenting the request to the user. This lets the digital
credential chooser attribute a cross-origin request to the site the user
is visiting while leaving the document origin unchanged.

Adds guidance on presenting one origin versus both, keyed on whether the
two origins are same site, and an open issue on whether disclosing both
origins should be a MUST rather than a SHOULD for cross-origin requests.
Drops the WebAuthn and Storage Access analogies from the credential
chooser presentation note, and replaces the inline issue with a
reference to the filed issue on whether the disclosure should be a MUST
and whether to refuse the request when both origins cannot be conveyed.
Replaces the SHOULD-based prose with a switch, matching the style used
for error handling, stating which origins the credential chooser
presents: the top-level origin when it and the document origin are same
site, and both origins otherwise. Removes the inline issue marker.
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
@marcoscaceres
marcoscaceres force-pushed the add-document-origin-to-request-context branch from 94a9737 to 0152cb1 Compare July 30, 2026 12:16
Comment thread index.html Outdated
Comment thread index.html Outdated
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Comment thread index.html Outdated
and MUST NOT rely on an [=origin=] supplied by the content whose request
is being mediated, whether to validate or form the request or to present
the [=digital credential chooser=].
is being mediated, in determining whether to validate or form the request

@TallTed TallTed Aug 7, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is being mediated, in determining whether to validate or form the request
is being mediated, in determining whether to validate or form a request

Comment thread index.html Outdated
validate or form the request or to present the [=digital credential
chooser=].
supplied by the content whose request is being mediated, in determining
whether to validate or form the request or to present the [=digital

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
whether to validate or form the request or to present the [=digital
whether to validate or form a request or to present the [=digital

@hlflanagan

Copy link
Copy Markdown

Discussed on 10 August 2026 call. @timcappalli to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agenda+ Add to the weekly agenda

Projects

None yet

5 participants