WICG / private-network-access

https://wicg.github.io/private-network-access/
Other
52 stars 21 forks source link

Service worker doesn't work, what's next? #130

Open iVanlIsh opened 4 months ago

iVanlIsh commented 4 months ago

We would like to propose that websites needs fetch() to unlock mixed content fetches in local/private address space.

Once fetch() is sent with targetAddressSpace for a certain domain. It will cached for the current document context and it will be used to enable preflights to the same domain in other contexts, e.g. <iframe> or <img>.

DanielBaulig commented 4 months ago

I don't currently have a strong opinion on this, but would like to share some general thoughts / questions that might need consideration.

I think one way to resolve many (but not all) issues would be to provide an API to "unlock" an origin for PNA requests without having to actually send a request. Bonus points if that API can be used from static HTML. I think an earlier proposed CSP would have done exactly that. Was that idea discarded? If so, why?

Edit: The title of the post seems to imply that this proposed change is related to the current ServiceWorker limitations. It's unclear to me how those two things are related. Some elaboration would be greatly appreciated :)

iVanlIsh commented 4 months ago

Why we cannot use service worker: The mixed content check is triggered before the requests go into service worker, so that the changes adding inside service worker, like adding targetAddressSpace, cannot be seen by the mixed content checker.

The word "unlock" might be not that much accurate. Our current idea is when one "fetch()" has been triggered with targetAddressSpace private/local for a certain host. This targetAddressSpace will be cached and applied to requests ( e.g. for HTML or