New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow HTML tags/attributes to be whitelisted during Markdown processing #843
Comments
Great catch. I hadn't seen this in my testing (and haven't seen it on GitHub either, which is strange as I look at a lot of package READMEs!) Markdown processors should leave raw HTML unprocessed and just take it wholesale into the output, but it looks like the one we're using is replacing it and stripping raw HTML. We should look if that's an option we can set, or a patch we can make to that parser as I'm not sure there's much we can do to fix this if it's not an option. |
This looks like it's the relevant part: So it seems like it might be in some sort of safe mode? |
Aye according to cmark docs:
this is what we currently have enabled, as it's the default. |
So I suppose it's a question of whether or not we're happy to drop it into unsafe mode - and if we do that whether or not we want to strip <script> tags etc ourselves? |
Apologues for the delay responding to this, and thanks for investigating @Sherlouk! Is there a tag/attribute whitelist option for unsafe mode in the GFM library? If there is, that's ideal and we'll just whitelist our standard tags and any raw HTML exceptions we find. If not, we're in a relatively tricky situation as stripping unsafe HTML tags/attributes is almost impossible to get right. There's so much to do! I have my fingers crossed for a whitelist |
From what I understand, it's not a whitelist. You can either support no HTML, or all HTML. (or we need to fork the GFM library and add support for all the tags we want...) |
Sven and I chatted about this today and we're not going to let this problem stop the README rollout, in fact, it's done (#855) I'll retitle this bug as relating to the HTML whitelist, but the amount of READMEs that this breaks is not worth the trouble of all the potential security issues that unsafe mode brings. |
Example: https://staging.swiftpackageindex.com/guykogus/CodableJSON (See 'Installation' section)
A relatively common feature on READMEs is the use of the 'details' HTML tag in order to make collapsible sections of documentation.
These are currently completely ignored by our rendering of READMEs.
Title
Contents with a predetermined titleFollow-on from #410
The text was updated successfully, but these errors were encountered: