-
Notifications
You must be signed in to change notification settings - Fork 696
feat: use nh3 for HTML sanitization #10264
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
Open
nouralmaa
wants to merge
22
commits into
ietf-tools:main
Choose a base branch
from
nouralmaa:replace-bleach-nh3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+174
−129
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
0330e40
feat: use nh3 for html sanitizing
806448b
chore: comments
91e3410
chore: stray whitespace
bb4b6d3
chore: add tel protocol and xmp tag
2c7704b
chore: fix typo
a0665ac
tests: add tag removal tests
356cedb
feat: rel noopener noreferrer
6042400
feat: markdown linker extention
1aeb662
chore: refractor and add email validation
31c4153
chore: add linkable protocols
9f0a249
chore: remove bleach
4136809
fix: don't use default nh3 protocols
c39659b
refractor: use django's urilizer inside templates
f2de311
fix: adjust template linker
153b742
tests: remove bleach tests
90c47a7
fix: templat fixes
fedd691
chore: code cleanup
bf72278
fix: adjust migration
9736b74
chore: iesg email bracket
cbbd096
fix: adjust migration
9cc2773
tests: add mailman tests
426cbaa
revert: revert migration commit
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| {% extends "base.html" %} | ||
| {# Copyright The IETF Trust 2015, All Rights Reserved #} | ||
| {% load origin %} | ||
| {% load ietf_filters %} | ||
| {% load textfilters htmlfilters %} | ||
| {% load ietf_filters static textfilters htmlfilters %} | ||
| {% block title %}Document Shepherd Write-Up{% if type == "group" %} for Group Documents{% elif type == "individual" %} for Individual Documents{% endif %}{% endblock %} | ||
| {% block content %} | ||
| {% origin %} | ||
| {{ writeup|urlize_ietf_docs|linkify }} | ||
| {{ writeup|urlize_ietf_docs }} | ||
| {% endblock %} |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,12 +51,16 @@ def test_linkify(self): | |
| ) | ||
| self.assertEqual( | ||
| linkify("https://www.ietf.org"), | ||
| '<a href="https://www.ietf.org">https://www.ietf.org</a>', | ||
| '<a href="https://www.ietf.org" rel="nofollow">https://www.ietf.org</a>', | ||
| ) | ||
| self.assertEqual( | ||
| linkify("https://mailman3.ietf.org/mailman3/lists/tls@ietf.org/"), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixes #10120
|
||
| '<a href="https://mailman3.ietf.org/mailman3/lists/tls@ietf.org/" rel="nofollow">https://mailman3.ietf.org/mailman3/lists/tls@ietf.org/</a>', | ||
| ) | ||
| self.assertEqual( | ||
| linkify('<a href="https://www.ietf.org">IETF</a>'), | ||
| ( | ||
| '<a href="<a href="https://www.ietf.org">https://www.ietf.org</a>">IETF</a>' | ||
| '<a href="<a href="https://www.ietf.org" rel="nofollow">https://www.ietf.org</a>">IETF</a>' | ||
| ), | ||
| ) | ||
| self.assertEqual( | ||
|
|
@@ -83,22 +87,21 @@ def test_linkify(self): | |
| ) | ||
| self.assertEqual( | ||
| linkify("https://www.ietf.org", autoescape=False), | ||
| '<a href="https://www.ietf.org">https://www.ietf.org</a>', | ||
| 'https://www.ietf.org', | ||
| ) | ||
| self.assertEqual( | ||
| linkify('<a href="https://www.ietf.org">IETF</a>', autoescape=False), | ||
| '<a href="https://www.ietf.org">IETF</a>', | ||
| ) | ||
| self.assertEqual( | ||
| linkify("somebody@example.com", autoescape=False), | ||
| '<a href="mailto:somebody@example.com">somebody@example.com</a>', | ||
| 'somebody@example.com', | ||
| ) | ||
| # bleach.Linkifier translates the < -> < and > -> > on this one | ||
| self.assertEqual( | ||
| linkify("Some Body <somebody@example.com>", autoescape=False), | ||
| ( | ||
| 'Some Body <<a href="mailto:somebody@example.com">' | ||
| 'somebody@example.com</a>>' | ||
| 'Some Body <somebody@example.com>' | ||
| ), | ||
| ) | ||
| self.assertEqual( | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to audit invocations of this function.