forked from enderofwings/NexusOS
fix(preview): harden sandbox and transformation
This commit is contained in:
@@ -592,3 +592,17 @@ def test_render_hint_is_only_added_when_the_tool_is_offered():
|
||||
from synapse import tools as t
|
||||
assert t.wants_render_preview("draw me a chart")
|
||||
assert not t.wants_render_preview("Summarize what a thread-safe LRU cache needs")
|
||||
|
||||
|
||||
def test_preview_iframe_cannot_navigate_to_a_network_url():
|
||||
"""The child CSP blocks resource loads; the parent CSP must separately
|
||||
block a sandboxed frame from navigating its own browsing context."""
|
||||
index = (REPO_ROOT / "interface" / "web" / "index.html").read_text(encoding="utf-8")
|
||||
markdown = (REPO_ROOT / "interface" / "web" / "src" / "Markdown.jsx").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
assert "frame-src data:" in index
|
||||
assert 'sandbox="allow-scripts"' in markdown
|
||||
assert "encodeURIComponent(doc)" in markdown
|
||||
assert "src={frameUrl}" in markdown
|
||||
assert "srcDoc={doc}" not in markdown
|
||||
|
||||
Reference in New Issue
Block a user