Skip to content

How to safely render TipTap content #8127

Answered by atareversei
MartinMuzatko asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! I've used the RTE in my project maybe a year ago, so I don't remember all the details but in this project I used the JSON output because it was easier to reason about it in the backend (checking for scripts and other modifications), and when I was receiving it back in my client I would use generateHTML from the tiptap library to produce DOM nodes and render it on the screen. Your client should trust the data receiving from the authentic backend, so the checks should happen in the backend not the client. ...And as far as I remember you can't actually render scripts, Tiptap itself strips it away, ⚠️ but check it for yourself.

const html = '<p>Example <strong>Text</strong><script>alert("…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@MartinMuzatko
Comment options

@atareversei
Comment options

@MartinMuzatko
Comment options

Answer selected by MartinMuzatko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants