From 3bebe74a6efd1bea2fa7e182d08de87605c70c7e Mon Sep 17 00:00:00 2001 From: Gautam Sharma Date: Tue, 18 Apr 2023 20:41:22 +0530 Subject: [PATCH 1/5] added warning for html.script --- src/reactpy/html.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/reactpy/html.py b/src/reactpy/html.py index fa4953cda..d2c44e66a 100644 --- a/src/reactpy/html.py +++ b/src/reactpy/html.py @@ -1,4 +1,7 @@ """ + +**Disclaimer** : Do not use raw user inputs from untrusted data sources in scripts. Doing so can lead to security vulnerabilities such as cross-site scripting (XSS) attacks. + **Fragment** - :func:`_` From 926e96134fad343546dd9a1fe6d3b44660c1aaea Mon Sep 17 00:00:00 2001 From: Gautam Sharma Date: Tue, 18 Apr 2023 23:33:00 +0530 Subject: [PATCH 2/5] updated Disclaimer to warning --- src/reactpy/html.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/reactpy/html.py b/src/reactpy/html.py index d2c44e66a..6b70b270d 100644 --- a/src/reactpy/html.py +++ b/src/reactpy/html.py @@ -1,6 +1,7 @@ """ -**Disclaimer** : Do not use raw user inputs from untrusted data sources in scripts. Doing so can lead to security vulnerabilities such as cross-site scripting (XSS) attacks. +.. 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. **Fragment** From 161f31786ce15c6b63459389eef9ac45673e96e5 Mon Sep 17 00:00:00 2001 From: Gautam Sharma Date: Wed, 19 Apr 2023 07:56:32 +0530 Subject: [PATCH 3/5] warning added under scripting section --- src/reactpy/html.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/reactpy/html.py b/src/reactpy/html.py index 6b70b270d..9fc530eb8 100644 --- a/src/reactpy/html.py +++ b/src/reactpy/html.py @@ -1,8 +1,5 @@ """ -.. 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. - **Fragment** - :func:`_` @@ -415,6 +412,9 @@ def _script( ) -> VdomDict: """Create a new `<{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 From f4fe834551795231c9a0de1611ef1f217cbbfc23 Mon Sep 17 00:00:00 2001 From: Ryan Morshead Date: Sat, 22 Apr 2023 22:16:22 -0700 Subject: [PATCH 4/5] improve warning description --- src/reactpy/html.py | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/src/reactpy/html.py b/src/reactpy/html.py index 9fc530eb8..55e3dc748 100644 --- a/src/reactpy/html.py +++ b/src/reactpy/html.py @@ -410,11 +410,49 @@ def _script( key: Key | None, event_handlers: EventHandlerDict, ) -> VdomDict: - """Create a new `<{script}> `__ element. + """Create a new `