Skip to content

Commit 9800176

Browse files
committed
Merge pull request tildeio#436 from tildeio/security-blurb
Update README.md (security blurb)
2 parents 8ed41d5 + c90527e commit 9800176

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,35 @@ need special tags in the String for the data binding code to work
1919
There are also many performance gains in HTMLBars' approach to building
2020
DOM vs the HTML-unaware string building approach of Handlebars.
2121

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+
2251
# Usage
2352

2453
TODO: much change. This section will be updated shortly.

0 commit comments

Comments
 (0)