mirror of
https://github.com/apache/superset.git
synced 2026-09-09 00:34:49 +00:00
fix: add missing access checks to semantic-layer and theme endpoints (#43389)
Co-authored-by: Superset Dev <dev@superset.apache.org> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Superset Dev
Claude Sonnet 5
parent
8a32324184
commit
7f1b41444c
@@ -1942,13 +1942,29 @@ def test_sanitize_svg_content_safe():
|
||||
|
||||
|
||||
def test_sanitize_svg_content_removes_scripts():
|
||||
"""Test that nh3 removes dangerous script content."""
|
||||
"""Test that dangerous script content is removed."""
|
||||
malicious_svg = '<svg><script>alert("xss")</script><rect/></svg>'
|
||||
result = sanitize_svg_content(malicious_svg)
|
||||
assert "script" not in result.lower()
|
||||
assert "alert" not in result
|
||||
|
||||
|
||||
def test_sanitize_svg_content_removes_script_with_attributes_on_closer():
|
||||
"""A closing </script foo> tag is still a valid closer to browsers."""
|
||||
malicious_svg = "<svg><script>fetch('/api/v1/me/')</script foo></svg>"
|
||||
result = sanitize_svg_content(malicious_svg)
|
||||
assert "script" not in result.lower()
|
||||
assert "fetch" not in result
|
||||
|
||||
|
||||
def test_sanitize_svg_content_removes_unterminated_script():
|
||||
"""An unterminated <script> opener with no closing tag is still stripped."""
|
||||
malicious_svg = "<svg><script>alert('xss')"
|
||||
result = sanitize_svg_content(malicious_svg)
|
||||
assert "script" not in result.lower()
|
||||
assert "alert" not in result
|
||||
|
||||
|
||||
def test_sanitize_url_relative():
|
||||
"""Test that relative URLs are allowed."""
|
||||
assert sanitize_url("/static/spinner.gif") == "/static/spinner.gif"
|
||||
|
||||
Reference in New Issue
Block a user