Skip to content

Commit b4e94a7

Browse files
Add details to unsafeHTML docs (#1353)
* Add details to unsafeHTML docs * Update packages/lit-dev-content/site/docs/v3/templates/directives.md Co-authored-by: Augustine Kim <[email protected]> --------- Co-authored-by: Augustine Kim <[email protected]>
1 parent bafbf70 commit b4e94a7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/lit-dev-content/site/docs/v3/templates/directives.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,8 +1448,14 @@ parse such a string as HTML and render it in a Lit template.
14481448

14491449
Note, the string passed to `unsafeHTML` must be developer-controlled and not
14501450
include untrusted content. Examples of untrusted content include query string
1451-
parameters and values from user inputs. Untrusted content rendered with this
1452-
directive could lead to [cross-site scripting (XSS)](https://en.wikipedia.org/wiki/Cross-site_scripting) vulnerabilities.
1451+
parameters and values from user inputs.
1452+
1453+
Untrusted content rendered with this directive could lead to [cross-site
1454+
scripting (XSS)](https://en.wikipedia.org/wiki/Cross-site_scripting), CSS
1455+
injection, data exfiltration, etc. vulnerabilities. `unsafeHTML` uses
1456+
`innerHTML` to parse the HTML string, so the security implications are the same
1457+
as `innerHTML`, [as documented on
1458+
MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#security_considerations).
14531459

14541460
</div>
14551461

0 commit comments

Comments
 (0)