✨(frontend) new custom block "embed" - #2513
Conversation
|
Size Change: +905 B (+0.02%) Total Size: 4.38 MB 📦 View Changed
|
87f3ee2 to
4d71fbd
Compare
4d71fbd to
7765b81
Compare
We introduce a new custom block called "embed" that allows users to embed external content into their documents. This block can be used to include videos, interactive widgets, or other web content directly within the document editor. It is a powerfull custom block that can make your document much more interactive.
We added 2 settings for the embed block: - FRONTEND_EMBED_BLOCK_ENABLED: to enable or disable the embed block in the editor - FRONTEND_EMBED_BLOCK_ALLOWED_ORIGINS: to define a list of allowed origins for the embed block, and the associated sandbox attributes (allow-scripts, allow-same-origin, etc.) This will allow to control the usage of the embed block in the editor, and to restrict the origins that can be embedded.
7765b81 to
76dd9c1
Compare
|
🚀 Preview will be available at https://2513-docs.ppr-docs.beta.numerique.gouv.fr/ You can use the existing account with these credentials:
You can also create a new account if you want to. Once this Pull Request is merged, the preview will be destroyed. |
| * every member's machine, so it is treated as untrusted content. | ||
| * | ||
| * ⚠️ To keep it secure, the block enforces three invariants: | ||
| * 1. The URL must be safe (https, no javascript: or data:). |
| "*": ( | ||
| "allow-scripts allow-same-origin allow-popups " | ||
| "allow-popups-to-escape-sandbox allow-forms" | ||
| ) |
There was a problem hiding this comment.
That's too much permissive for a wildcard WDYT?
I'll allow the minimum and add required rights to specific domains.
| default=False, environ_name="FRONTEND_SILENT_LOGIN_ENABLED", environ_prefix=None | ||
| ) | ||
| FRONTEND_EMBED_BLOCK_ENABLED = values.BooleanValue( | ||
| default=True, environ_name="FRONTEND_EMBED_BLOCK_ENABLED", environ_prefix=None |
| <Box | ||
| as="iframe" | ||
| className="bn-visual-media" | ||
| role="presentation" |
There was a problem hiding this comment.
Sure about role=presentation ? The content of this iframe aims to be only decorative ?
|
Hi, I will list some points I see as potential risks that would need to be discussed (live thoughts, so not tested), but of course in most cases everything will go fine, it depends if a critical public document is being modified by a malicious user and what is the audience...
Otherwise just to note that there are some settings in place already, and they help this iframe feature:
Just note I attempted to upload a The risk I see here is if for some reasons due to the tool being open source, someone deploy another proxy without the rule Available to talk about that, maybe to evaluate if it would make sense:
Talking about the proxy I saw the project https://github.com/itteco/iframely . Don't know if it would help you, but it seems helpful to embed specific services without managing a lot of "Yjs blocks" or have a less quality experience with "iframe that is agnostic" (but then I don't think it helps with target URLs that need to be authenticated on their service). Sorry for this huge reply 🙃! EDIT: je confirme que le isSafeUrl n'est pas 100% secure, genre avec un serveur malicieux qui redirigerait sur le produit https://httpbin.org/redirect-to?url=https%3A%2F%2F2513-docs.ppr-docs.beta.numerique.gouv.fr%2Fmedia%2F99570511-7e32-4e31-96f9-7c038912e5e7%2Fattachments%2F40608b82-2a9f-4e72-88ab-05ed669c9c88-unsafe.html&status_code=302 Là en l'occurence j'affiche le HTML qui a été uploadé via la pièce jointe
|
|
Thank you for the review and for your time :) |

Purpose
We introduce a new custom block called "embed" that allows users to embed external content into their documents. This block can be used to include interactive widgets or other web content directly within the document editor.
It is a powerful custom block that can make your document much more interactive.
Proposal
Includes directly your favorite tools in Docs.
If the tool is collaborative like Grist or TLDraw, you will be able to collaborate in it directly from Docs.
Enregistrement.2026-07-08.171352.mp4
Settings
2 new settings are included to control this feature, ex: