Skip to content

Commit fa39857

Browse files
mheveryIgorMinar
authored andcommitted
docs(compile/nodomevents): description for compile/nodomevents error
Closes angular#3459
1 parent 78a445f commit fa39857

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/content/error/compile/nodomevents.ngdoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,19 @@
22
@name $compile:nodomevents
33
@fullName Interpolated Event Attributes
44
@description
5+
6+
This error occurs when one tries to create a binding for event handler attributes like `onclick`, `onload`, `onsubmit`, etc.
7+
8+
There is no practical value in binding to these attributes and doing so only exposes your application to security vulnerabilities like XSS.
9+
For these reasons binding to event handler attributes (all attributes that start with `on` and `formaction` attribute) is not supported.
10+
11+
12+
An example code that would allow XSS vulnerability by evaluating user input in the window context could look like this:
13+
```
14+
<input ng-mode="username">
15+
<div onclick="{{username}}">click me</div>
16+
```
17+
18+
Since the `onclick` evaluates the value as JavaScript code in the window context, setting the `username` model to a value like `javascript:alert('PWND')` would result in script injection when the `div` is clicked.
19+
20+

0 commit comments

Comments
 (0)