Skip to content

Commit

Permalink
Update xss_templates.yaml (#120)
Browse files Browse the repository at this point in the history
* Update xss_templates.yaml

Update description for rule handlebars_safestring

* Update xss_templates.yaml
  • Loading branch information
sebasrevuelta authored Oct 23, 2024
1 parent d231083 commit 337d0be
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions njsscan/rules/semantic_grep/xss/xss_templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ rules:
- pattern: $X.SafeString(...)
- pattern: new Handlebars.SafeString(...)
message: >-
Handlebars SafeString will not escape the data passed through it.
Untrusted user input passing through SafeString can cause XSS.
When you use SafeString or triple curly braces ({{{ }}}), Handlebars does not escape the content, allowing raw HTML to be rendered in the browser. This is useful if you want to insert valid HTML content into your template, like bold text (<strong>) or links (<a>), but it becomes dangerous if you are dealing with untrusted or user-generated content, as it can cause a Cross-site scripting attack (XSS). You should only use SafeString when the content is trusted. For example, if the content is generated by the server and does not come from user input or an untrusted source. If you are dealing with user-generated content, make sure to sanitize it to remove any malicious scripts before marking it as "safe".
languages:
- javascript
severity: ERROR
Expand Down

0 comments on commit 337d0be

Please sign in to comment.