Sanitize torrent description in markdown #158
Merged
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.
Details
The sanitize function:
["png", "PNG", "jpg", "JPG", "jpeg", "JPEG"]
. The backend is supposed to support only PNG and JPG images.<embed>
are removed.The sanitize function is being tested with this sample torrent description:
Todo
<video>
I think these are the HTML tags that can contain sources linking to external resources:
<a>
: The href attribute can contain an external URL.<img>
: The src attribute can point to an external image URL.<script>
: The src attribute can point to an external JavaScript file.<link>
: Used for linking CSS files, favicons, etc., the href attribute can contain an external URL.<iframe>
: The src attribute can contain an external URL to embed content from another site.<object>
and<embed>
: These tags are used to embed multimedia content like Flash or PDFs, and their data and src attributes respectively can contain external URLs.<audio>
and<video>
: The src attribute can contain an external URL to a media file.<source>
: This tag, used inside ,<form>
: The action attribute can contain an external URL where the form data is sent when submitted.<meta http-equiv="refresh" content="0; url=http://example.com/" />
: This meta tag can be used to redirect to an external URL.The dompurifier only removes unsafe code, but we also want to remove external links to avoid tracking the users.