-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request from GHSA-vv2x-vrpj-qqpq
Fix ghsa vv2x vrpj qqpq
- Loading branch information
Showing
7 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 |
---|---|---|
|
@@ -739,6 +739,53 @@ def test_namespace_rc_data_element_strip_false( | |
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"namespace_tag, end_tag, data, expected", | ||
[ | ||
( | ||
"math", | ||
"p", | ||
"<math></p><style><!--</style><img src/onerror=alert(1)>", | ||
"<math><p></p><style><!--</style><img src/onerror=alert(1)>--></style></math>", | ||
), | ||
( | ||
"math", | ||
"br", | ||
"<math></br><style><!--</style><img src/onerror=alert(1)>", | ||
"<math><br><style><!--</style><img src/onerror=alert(1)>--></style></math>", | ||
), | ||
( | ||
"svg", | ||
"p", | ||
"<svg></p><style><!--</style><img src/onerror=alert(1)>", | ||
"<svg><p></p><style><!--</style><img src/onerror=alert(1)>--></style></svg>", | ||
), | ||
( | ||
"svg", | ||
"br", | ||
"<svg></br><style><!--</style><img src/onerror=alert(1)>", | ||
"<svg><br><style><!--</style><img src/onerror=alert(1)>--></style></svg>", | ||
), | ||
], | ||
) | ||
def test_html_comments_escaped(namespace_tag, end_tag, data, expected): | ||
# refs: bug 1689399 / GHSA-vv2x-vrpj-qqpq | ||
# | ||
# p and br can be just an end tag (e.g. </p> == <p></p>) | ||
# | ||
# In browsers: | ||
# | ||
# * img and other tags break out of the svg or math namespace (e.g. <svg><img></svg> == <svg><img></svg>) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
g-k
via email
Author
Collaborator
|
||
# * style does not (e.g. <svg><style></svg> == <svg><style></style></svg>) | ||
# * the breaking tag ejects trailing elements (e.g. <svg><img><style></style></svg> == <svg></svg><img><style></style>) | ||
# | ||
# the ejected elements can trigger XSS | ||
assert ( | ||
clean(data, tags=[namespace_tag, end_tag, "style"], strip_comments=False) | ||
== expected | ||
) | ||
|
||
|
||
def get_ids_and_tests(): | ||
"""Retrieves regression tests from data/ directory | ||
|
This file contains 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
Should this be: