nyx/tests/dynamic_fixtures/python/xss_negative.py

13 lines
344 B
Python
Raw Permalink Normal View History

2026-06-05 10:16:30 -05:00
"""XSS — negative fixture.
Safe function: uses html.escape() before rendering.
Expected verdict: NotConfirmed (script tag escaped to <script>).
"""
import html
def render_comment(user_input):
"""Safe: HTML-escapes user input before rendering."""
safe = html.escape(user_input)
print(f"<div class='comment'>{safe}</div>")