You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This triggers for Angular templates with unquoted attributes, but Angular actually behaves correctly and replaces the attribute value, instead of doing string replace.
$ semgrep -c 'r/generic.html-templates.security.unquoted-attribute-var.unquoted-attribute-var' example.html
example.html
generic.html-templates.security.unquoted-attribute-var.unquoted-attribute-var
Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could
inject custom JavaScript handlers. To fix this, add quotes around the template expression,
like this: "{{ expr }}".
Details: https://sg.run/weNX
▶▶┆ Autofix ▶ s/{{(.*?)}}/"{{\1}}"/g
1┆ <h2 class="title" title={{name}}>Hello {{name}}</h2>
The text was updated successfully, but these errors were encountered:
Fixing this for Ember would be a matter of considering @attributename={{ ... }} acceptable, unless I'm forgetting some edge case. Fixing this for Angular seems like it might not be possible unless the project can be detected as Angular.
Describe the bug
semgrep-rules/generic/html-templates/security/unquoted-attribute-var.yaml at develop · returntocorp/semgrep-rules
This triggers for Angular templates with unquoted attributes, but Angular actually behaves correctly and replaces the attribute value, instead of doing string replace.
example.html:
The text was updated successfully, but these errors were encountered: