Properly sanitize HTML#8809
Merged
FreeTubeBot merged 3 commits intoFreeTubeApp:developmentfrom Mar 17, 2026
Merged
Conversation
PikachuEXE
previously approved these changes
Mar 16, 2026
absidue
commented
Mar 17, 2026
Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
PikachuEXE
approved these changes
Mar 17, 2026
ChunkyProgrammer
approved these changes
Mar 17, 2026
Member
i did
Doesnt seem to look correct VirtualBoxVM_9brDMQ1gpb.mp4
Same here VirtualBoxVM_pqfXE9eBOz.mp4 |
Member
Author
|
Fixed the test steps, you need to remove the dompurify override in the renderer webpack config (see second file in the diff view of this pull request). |
efb4f5ff-1298-471a-8973-3d47447115dc
approved these changes
Mar 17, 2026
Pillowytuba
pushed a commit
to Pillowytuba/FreeTube
that referenced
this pull request
Mar 19, 2026
* Properly sanitize HTML * Fix typo Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> * Keep title on img tags for Invidious comment emojis Co-authored-by: absidue <48293849+absidue@users.noreply.github.com> --------- Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Description
Currently we have a mix of different ways of handling raw HTML, none of them are bulletproof. This pull request removes all uses of
v-htmland replaces them with a customv-safer-htmldirective that uses the brand new HTML Sanitizer API which we can use with the Electron 41 upgrade and falls back to the DOMPurify library outside of Electron when the HTML Sanitizer API is not available. I went with two different sanitizing configurations a default one that is very strict that only allows the<br>,<b>,<i>,<s>,<a>,<img>elements, which is used in most places and a lenient one that uses the default Sanitizer/DOMpurify configurations that only strip dangerours things (e.g.<script>tags and inline event handlers) that is used for the changelog display.Testing
USE_NATIVE_SANITIZERtofalseand remove the dompurify alias in the renderer webpack config, then repeat steps 1-3If you are unsure about what videos to use for 2 and 3, the LinusTechTips WAN show ones usually have timestamps in both the description and comments, as well as formatting in the comments.
Desktop