wrec 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -162,6 +162,29 @@ Wrec looks for this automatically does the rest of the work.
|
|
|
162
162
|
static formAssociated = true;
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
## Security
|
|
166
|
+
|
|
167
|
+
Wrec uses the JavaScript `eval` function to evaluate JavaScript expressions
|
|
168
|
+
that are placed in attribute values and the text content of elements.
|
|
169
|
+
This has security implications if those expressions
|
|
170
|
+
can come from untrusted sources, so it is best avoid
|
|
171
|
+
creating web components that use untrusted content in those ways.
|
|
172
|
+
|
|
173
|
+
Perhaps the most dangerous thing the use of `eval` allows
|
|
174
|
+
is sending HTTP requests to other servers.
|
|
175
|
+
Such requests could contain data scraped from your web app
|
|
176
|
+
in order to share it with unscrupulous sites.
|
|
177
|
+
|
|
178
|
+
The easiest way to prevent this is to add a
|
|
179
|
+
Content Security Policy (CSP) to your web app.
|
|
180
|
+
Simply adding the following element as a child of the
|
|
181
|
+
`head` element in each page blocks sending HTTP requests
|
|
182
|
+
to any domain except that of your web app:
|
|
183
|
+
|
|
184
|
+
```html
|
|
185
|
+
<meta http-equiv="Content-Security-Policy" content="connect-src 'self'" />
|
|
186
|
+
```
|
|
187
|
+
|
|
165
188
|
## More Examples
|
|
166
189
|
|
|
167
190
|
Check out the web app in the `demo` directory.
|