File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,35 @@ need special tags in the String for the data binding code to work
19
19
There are also many performance gains in HTMLBars' approach to building
20
20
DOM vs the HTML-unaware string building approach of Handlebars.
21
21
22
+ # Security
23
+
24
+ HTMLBars aims to not only ease interacting with data-bound templates,
25
+ but also to provide it in a secure-by-default way. Thanks to the design
26
+ of HTMLBars it has both handlebars and HTML awareness, this allows for
27
+ best practices by default. For example:
28
+
29
+ ``` hbs
30
+ <div>{{fullName}}</div>
31
+ ```
32
+
33
+ ultimately becomes:
34
+
35
+ ```
36
+ var div = document.createElement('div');
37
+ div.textContent = fullName; // when fullName changes
38
+ ```
39
+
40
+ In this example, HTMLBars is aware that values set to ` textContent ` on a ` div `
41
+ is treated by the browser as inert text. In other words, in this scenario HTMLBars
42
+ knows the content is safe, and no escaping is required.
43
+
44
+ HTML has many interesting contexts, in each HTMLBars aims to do the right thing.
45
+ This may be, using the correct browser API, sanatizing, or disabling a feature
46
+ entirely.
47
+
48
+ Needless to say, we take security very seriously. If there is something we missed,
49
+ please report via the [ Ember.js responsible security disclosure system] ( http://emberjs.com/security/ ) .
50
+
22
51
# Usage
23
52
24
53
TODO: much change. This section will be updated shortly.
You can’t perform that action at this time.
0 commit comments