Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
zurfyx
left a comment
There was a problem hiding this comment.
Have we considered sanitization rules at a plugin level? This is seamless when using the default but there's repetition every time you want to toggle a link. Additionally, I think that this function is doing too much, it's a setter and a toggle, perhaps we should revisit this in the future.
| if (url !== null) { | ||
| let sanitizedUrl: string | null = url; | ||
| if (sanitizeUrl !== null) { | ||
| const sanitize = sanitizeUrl ? sanitizeUrl : _sanitizeUrl; |
There was a problem hiding this comment.
0.10? This is a breaking change isn't it? Some URLs will stop working unless you pass an explicit null.
Yes, that means no protection for non-React users. If React can do this in the core, so can we.
Sure, good thinking
Sure |
|
Having reviewed the internal context around the criticality of having this by default, I can extend my review to say:
I believe that the best solution is a curated platform-specific solution around Shimming. However, I also agree that React's link validation (ban So I'd suggest something like this
And this can work in 2 different ways. 1) URL overwritten 2) Overwritting click handler. Preferably the first. |
This won't work for non-React users. Also doesn't address all the other ways a LinkNode can get into the editor (Markdown, setEditorState, custom plugin etc, etc)
This is a solution for a different problem, I think. It doesn't make sense to ask every user to implement shimming just to avoid this vulnerability. |
|
We can consider either putting this in LinkNode.createDOM or in the reconciler. |
|
Closed in favor of #4342 |
This makes the link library more secure by default by sanitizing links using default library logic. Users can provider their own sanitizer overrider or pass explicit null to disable sanitization altogether.