fix(preview): harden sandbox and transformation
This commit is contained in:
+17
-1
@@ -514,9 +514,25 @@ def test_asking_for_a_preview_language_or_pointer_interaction_offers_the_tool():
|
||||
assert tools.wants_render_preview(prompt), prompt
|
||||
|
||||
# Still narrow: ordinary chat must not pay for a tool turn.
|
||||
for prompt in ("what's the weather vibe today", "summarise this email thread"):
|
||||
for prompt in (
|
||||
"what's the weather vibe today",
|
||||
"summarise this email thread",
|
||||
"write a concise paragraph about caching",
|
||||
):
|
||||
assert not tools.wants_render_preview(prompt), prompt
|
||||
|
||||
assert tools.wants_render_preview("compare these graphs")
|
||||
|
||||
|
||||
def test_external_preview_resources_are_rejected_in_attributes_and_css():
|
||||
for markup in (
|
||||
'<img src=https://example.com/chart.png alt="chart">',
|
||||
'<style>.chart { background: url("https://example.com/chart.png"); }</style>',
|
||||
'<style>@import "https://example.com/chart.css";</style>',
|
||||
):
|
||||
issues = tools._critique_shared(markup)
|
||||
assert any("external http(s)" in issue for issue in issues), markup
|
||||
|
||||
|
||||
def test_every_preview_language_hints_for_itself():
|
||||
for lang in tools.PREVIEW_LANGS:
|
||||
|
||||
Reference in New Issue
Block a user