Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: Add guidelines for external specs about CORS, cross-origin isolation and TAO #1806

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

noamr
Copy link
Contributor

@noamr noamr commented Jan 28, 2025

Add a section to "using fetch elsewhere" that describes in a nutshell what new standards that invoke fetch should take
into the consideration when integrating with the same-origin policy protections enforced in the Fetch standard.

  • At least two implementers are interested (and none opposed):
    • Prose only, but would be good to have some cross-implementor eyes on it.
  • Tests are written and can be reviewed and commented upon at:
    • N/A: prose only
  • Implementation bugs are filed:
    • N/A: prose only
  • MDN issue is filed: …
    • N/A: prose only
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)

@noamr noamr requested a review from domfarolino January 28, 2025 10:58
@whatwg whatwg deleted a comment from Shikho18 Jan 28, 2025
@whatwg whatwg deleted a comment from Shikho18 Jan 28, 2025
Copy link
Member

@domfarolino domfarolino left a comment

Choose a reason for hiding this comment

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

Looks great, thanks so much!

fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Show resolved Hide resolved
noamr and others added 3 commits January 28, 2025 20:11
Co-authored-by: Dominic Farolino <[email protected]>
Co-authored-by: Dominic Farolino <[email protected]>
Co-authored-by: Dominic Farolino <[email protected]>
Copy link
Member

@jyasskin jyasskin left a comment

Choose a reason for hiding this comment

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

Thanks for writing this!

Comment on lines +9071 to +9074
<p>In a nutshell, when a user accesses a certain origin using their browser or other user agent,
they don't expect that the user agent implicitly grants that <a for=/>origin</a> full access to
their network, which could, for example, be an intranet, despite the user agent itself having that
access.
Copy link
Member

Choose a reason for hiding this comment

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

This paragraph may be too focused on users. What are specs using Fetch supposed to do to help with the SOP? It seems like their job is to ensure that resources are fetched with one of the request modes, which will ensure that one origin can't get illegitimate access to resources protected by credentials or network identity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was actually important for me to be focused on users! But point taken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

fetch.bs Outdated
Comment on lines 9076 to 9078
<p>In addition, the user agent may include footprint that identifies the user to the origin,
explicitly using cookies or client certificates, or implicitly using, for example, the user-agent's
IP address.
Copy link
Member

Choose a reason for hiding this comment

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

How is this connected to the same-origin policy? A site that wants to leak this kind of information can always embed an <iframe>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Imagine any domain had read access to corp-intranet.com/about-my-computer.json and it gave you all kinds of information about yourself, identifying you by your IP address.

Comment on lines +9086 to +9087
<p>The main way to access cross-origin data is via the <a>cors protocol</a>, described in detail in
this standard. CORS (Cross Origin Resource Sharing) is built on the principle that origins that want
Copy link
Member

Choose a reason for hiding this comment

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

Mention that this is selected by setting the request mode to "cors".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

fetch.bs Outdated
to be done in a way that's opaque to the embedding origin. Only the user should have access to the
resource, not the embedder.

<p>This mechanism of fetching should not be used in new specs. However, specs should be written with
Copy link
Member

Choose a reason for hiding this comment

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

Mention that it's the default request mode, and so every new spec should set a request mode explicitly.

Comment on lines +9121 to +9122
<p>Due to the leaky nature of no-CORS requests, resources can further protect themselves by
providing a `<a http-header><code>Cross-Origin-Resource-Policy</code></a>` header (CORP). By
Copy link
Member

Choose a reason for hiding this comment

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

What spec language should consuming specs use to opt into or cooperate with this protection?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is already mentioned in detail in one of the previous sections about populating the request object, I'll refer back to that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

<h4 id=fetch-elsewhere-TAO>Accessing timing information (TAO)</h4>

<p>Beside the protections for the resource's data itself, the Fetch standard enforces restrictions
on accessing timing information associated with the <a for=/>fetch</a>. This timing information
Copy link
Member

Choose a reason for hiding this comment

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

Similarly, what do specs need to write in order to mark some information as "timing information"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added something

@noamr noamr changed the title Editorial: Add prose about CORS, cross-origin isolation and TAO Editorial: Add guidelines for external specs about CORS, cross-origin isolation and TAO Jan 29, 2025
@noamr noamr marked this pull request as ready for review January 29, 2025 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants