-
Notifications
You must be signed in to change notification settings - Fork 60
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
How do you allow EPUBs in CORS / CSP / iframe origin policy? #1843
Comments
Related, as discussed in today's face-to-face: |
The issue was discussed in a meeting on 2021-10-29 List of resolutions:
View the transcript2.3. "IRI of the Package Document": what is this exactly? (issue epub-specs#1374)See github issue epub-specs#1374.
Romain Deltour: I may summarize.
Romain Deltour: for using this algorith we have to now the base URL (https://example.org).
Romain Deltour: I'm going to show other examples.
Romain Deltour: in this case I'm going outside of the EPUB.
Romain Deltour: that's why I think we should define which is the base URL, also for security issues. Ivan Herman: I remember that one solution may be to consider an EPUB as a localhost (with a unique port). Romain Deltour: yes, there are different approches. One is to use domains, another is to use a custom protocol scheme:.
Romain Deltour: I don't know which one is better. Ivan Herman: I think defining a URI scheme for that is not a good idea. Romain Deltour: I don't think we'll come with a solution that will be used by the end user. Brady Duga: I think there are 4 cases: local URLs, online URLs, jar URLs. Romain Deltour: yes, but also referencing to resources outside the package. Brady Duga: do we need to tell people how to display URLs inside on EPUBs (using fragments)?.
Hadrien Gardeur: referencing everything outside the archive is problematic specially for the content document. Romain Deltour: removing that paragraph about the URL of the package document won't work. Romain Deltour: at a minimium, we should base everything on the assumption that there is a url for the root of the container. See github issue epub-specs#1843. Dan Lazin: there is another issue: #1843. Romain Deltour: this might not answer entirely. Dan Lazin: is it a predicable url?. Romain Deltour: this scripting mechanism is only about an origin--could be an opaque origin, doesn't have to be a url. Ivan Herman: where do we go from here?. Dave Cramer: do we ask for help?. Ivan Herman: we have tried and failed before. Romain Deltour: I was supposed to come up with a proposal. Ivan Herman: we can't go to CR with this stuff open. Dave Cramer: could we talk to ping?. Romain Deltour: could we liase with Anne at WhatWG?. Ivan Herman: I worry about that. Tzviya Siegman: talking to Tess would be good. Ivan Herman: if we have a proposal that romain can put together. Romain Deltour: I can summarize the problem statement. Laurent Le Meur: tests will take time.
Laurence Zaysser: could we have a fifth objective, easy to move to web publication?. Romain Deltour: it's about any relative urls. Just dealing with path-relative won't solve the issue. See github pull request epub-specs#1725. Matt Garrish: we have 1725 PR, which forbids path-absolute URLs. Is there any reason we shouldn't merge that?. Wendy Reid: have we exhausted this?. Ivan Herman: to answer matt, that one can go in.
Ivan Herman: using root-relative IRIs is a bad idea for something like epub, where the root url is unclear.
|
I will write a note for the Security sections of the specs. |
The issue was discussed in a meeting on 2022-02-25
View the transcript3. How do you allow EPUBs in CORS / CSP / iframe origin policy? (issue epub-specs#1843)See github issue epub-specs#1843. Dave Cramer: this is issue about external iframe resources, and CORS headers about having this in epub. Dan Lazin: we were talking a few months ago about whether external resources are good idea, and how there are legit cases for them.. Ivan Herman: i played with this URL area in the spec in Nov, and your supposition is correct. Dan Lazin: might be okay for us not to implement it, but it might not be our call whether we implement it or not. Matt Garrish: it's not that it's not supported, but as you say, you can't rely on it or it might work. Brady Duga: the way you describe CORS is almost like a DRM mechanism, but it's more like, a script is only allow to request resources from a place that would allow that origin.
Dan Lazin: so I would have to allow my server to be iframed by anyone, can't limit to only my own books. Ivan Herman: only change I can see is to explicitly add this to the security document somewhere. Dan Lazin: duga's point about wildcards means there might be a solution. Ivan Herman: we'd have to define the protocol, and no current RS uses it. Dan Lazin: at a future point, if we could create some limits on the epub origin that are easily wildcardable, we could make CORS/CSP work in epub. Ivan Herman: we can think about this in epub 4. Dave Cramer: not sure what solution we can implement in 3.3. Dan Lazin: i propose that we add something about this in the security note. Ivan Herman: dlazin, you should.... Dave Cramer: okay, good bye for now, thank you for all the interesting discussion!. |
In the WG discussion for #1061, I mentioned that one consideration is how the developer maintaining an external iframed resource could specify a CORS header that lets EPUBs (or one specific EPUB, or one specific reading system) to load the resource, while blocking some other origins.
The same basic question applies to Content Security Policy and the obsolete X-Frame-Options header: since an EPUB isn't a real webpage, it doesn't have an URL, so how does the developer maintaining an external service specify an EPUB "address" (origin) in a CORS/CSP/X-Frame-Origins directive?
Links on the topic:
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
The text was updated successfully, but these errors were encountered: