Skip to content

added warning for html.script #970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 23, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/reactpy/html.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""

**Fragment**

- :func:`_`
Expand Down Expand Up @@ -411,6 +412,9 @@ def _script(
) -> VdomDict:
"""Create a new `<{script}> <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script>`__ element.

.. warning:: Do not use raw user inputs from untrusted data sources in scripts. :newline:
Doing so can lead to security vulnerabilities such as cross-site scripting (XSS) attacks.

This behaves slightly differently than a normal script element in that it may be run
multiple times if its key changes (depending on specific browser behaviors). If no
key is given, the key is inferred to be the content of the script or, lastly its
Expand Down