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:
Evan Rusackas
2026-08-24 08:52:45 -07:00
committed by GitHub
co-authored by Superset Dev Claude Sonnet 5
parent 8a32324184
commit 7f1b41444c
24 changed files with 1266 additions and 76 deletions
+17 -1
View File
@@ -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"