-
Notifications
You must be signed in to change notification settings - Fork 281
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
Support for HTML media type #189
Conversation
Nice one I had this on my todo list. But needs @crzypatchwork to give it a green light. Because this is Pandora's box open 😂🙌🏻❤️ |
Pandora's box indeed! |
Give me some time until Brazil wakes up and I'll ask if I can merge this. It seems a better option that SVG embeds. |
Thanks!! 🙏 I don't think there are any new security concerns, more just a usability thing really. |
I was worried yesterday that people were able to embed other websites inside SVGs. Security-wise, I'm now more confident about supporting |
Also, I don't think this is too different from what SVGs |
Related: what do we want to do about permissions that require https://developer.mozilla.org/en-US/docs/Web/HTTP/Feature_Policy (e.g. Camera, Orientation, XR)? Edit: more concretely, i think that if those were allowed, they should probably be disabled on the main feed and only allowed in the objkt page. |
@spite One step at a time? 😁 |
@mrdoob of course. but i don't think ignoring the overall security is the right call if it can be considered at the same time. specially if one thing doesn't exclude the other. better to be safe than sorry |
As far as I understand... |
Together with security we should consider also the immutability aspect. What if you call an external script in the HTML page that's later modified? |
@spite @mrdoob Yup it does block the features by default, so they'd have to be selectively enabled with My wishlist 😅
Would love to just see basic HTML working first though! |
@nickdima The iframe only has |
Yeah what I was thinking is that the responsibility is given to whoever loads that HTML NFT and mistakes might be made. Imagine a new marketplace loads this NFTs and they "forget" to sandbox the iframe. |
@nickdima @mrdoob Hm just tested and it looks like I'm not convinced that external resources should be prevented though... If someone opens the direct link, they are at the same risk as visiting any webpage, no? If we really need it to be standalone, a few possible solutions:
These would happen on the frontend though so not sure how secure they really are... With regard to this PR though, the SVG element works the same as this, so it's not introducing a new vulnerability. |
Fair point! |
Testing this out, the CSP meta tag feels like the best solution. Simply injecting this into <meta http-equiv="Content-Security-Policy" content="default-src 'self';"> Thoughts? |
@pichiste Is it possible to remove the meta tag afterwards with JS? 😬 |
Is so... maybe double iframe would be the easiest/safest... |
@mrdoob Good call! I just tested and it looks like fortunately the CSP policy takes effect on load, so it doesn't matter if it gets removed in the js. Another thing about the double iframes is that things like the feature policy mentioned above would potentially need to be baked into the inner iframe, though maybe its safer in some ways? |
…ent external sources
Ok, I've gone ahead and implemented the CSP meta tag solution. Basically these utility functions are used to inject the following meta tag into both the HTML preview and uploaded HTML file: <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'unsafe-inline'; style-src 'unsafe-inline'"> I think that covers external sources concern. Anything else? |
This comment has been minimized.
This comment has been minimized.
merged this to develop. but will not release just yet. need to double check with @crzypatchwork |
Awesome thanks!! I guess one last thing before releasing would be to make sure the author/creator query param name matches between the templates and vector/html iframe embeds. Excited to see this live! |
Hi there,
This adds support for individual HTML files as a media type, and is aimed at the use case of interactive artworks. Currently artists are using/hijacking the SVG component to embed interactive pieces. Having an HTML media type would simplify the process and make it clearer to the user. It's a close copy of the SVG component by @andrevenancio.