Skip to content

Conversation

@kkthxbye-code
Copy link
Contributor

Fixes: #9108 and #8944

This PR removes the stripping of all HTML tags and the workarounds for sanitizing markdown links. Instead the HTML output of python-markdown is sanitized using bleach. The result is a more correct handling of markdown (HTML is explicitly allowed in the markdown spec) while still preventing user defined HTML that might result in XSS, by sanitizing with a whitelist approach.

From a little unscientific testing of a journal page with extreme markdown usage, the performance penalty is very slight (2-5% of total page load time).

I targeted this at the feature branch as a new dependency is added, not sure if that is correct. If it's not I'll change the target branch.

@kkthxbye-code
Copy link
Contributor Author

Should also fix #8230 which was auto closed.

@jeremystretch
Copy link
Member

jeremystretch commented Jun 17, 2022

Thanks for digging into this @kkthxbye-code! I had a feeling the eventual fallback to bleach was inevitable.

I targeted this at the feature branch as a new dependency is added, not sure if that is correct. If it's not I'll change the target branch.

IMO it's fine to push this in the next patch release, since it's not a breaking change.

@jeremystretch jeremystretch changed the base branch from feature to develop June 17, 2022 17:26
@jeremystretch jeremystretch changed the base branch from develop to feature June 17, 2022 17:27
@kkthxbye-code kkthxbye-code changed the base branch from feature to develop June 17, 2022 17:28
@kkthxbye-code
Copy link
Contributor Author

I think it should be good now @jeremystretch - I'll never learn rebasing properly, always seems like a huge mess.

@jeremystretch
Copy link
Member

git

@jeremystretch jeremystretch merged commit 872c115 into netbox-community:develop Jun 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown syntax not working correctly within comment fields

2 participants