Skip to content

Commit 2067442

Browse files
authored
Update "Use helmet" section (#1790)
1 parent f669c5f commit 2067442

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

en/advanced/best-practice-security.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,28 @@ app.use((req, res) => {
8080

8181
[Helmet][helmet] can help protect your app from some well-known web vulnerabilities by setting HTTP headers appropriately.
8282

83-
Helmet is a collection of several smaller middleware functions that set security-related HTTP response headers. Some examples include:
84-
85-
* `helmet.contentSecurityPolicy` which sets the `Content-Security-Policy` header. This helps prevent cross-site scripting attacks among many other things.
86-
* `helmet.hsts` which sets the `Strict-Transport-Security` header. This helps enforce secure (HTTPS) connections to the server.
87-
* `helmet.frameguard` which sets the `X-Frame-Options` header. This provides [clickjacking](https://www.owasp.org/index.php/Clickjacking) protection.
88-
89-
Helmet includes several other middleware functions which you can read about [at its documentation website][helmet].
83+
Helmet is a middleware function that sets security-related HTTP response headers. Helmet sets the following headers by default:
84+
85+
- `Content-Security-Policy`: A powerful allow-list of what can happen on your page which mitigates many attacks
86+
- `Cross-Origin-Opener-Policy`: Helps process-isolate your page
87+
- `Cross-Origin-Resource-Policy`: Blocks others from loading your resources cross-origin
88+
- `Origin-Agent-Cluster`: Changes process isolation to be origin-based
89+
- `Referrer-Policy`: Controls the [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer) header
90+
- `Strict-Transport-Security`: Tells browsers to prefer HTTPS
91+
- `X-Content-Type-Options`: Avoids [MIME sniffing](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#mime_sniffing)
92+
- `X-DNS-Prefetch-Control`: Controls DNS prefetching
93+
- `X-Download-Options`: Forces downloads to be saved (Internet Explorer only)
94+
- `X-Frame-Options`: Legacy header that mitigates [Clickjacking](https://en.wikipedia.org/wiki/Clickjacking) attacks
95+
- `X-Permitted-Cross-Domain-Policies`: Controls cross-domain behavior for Adobe products, like Acrobat
96+
- `X-Powered-By`: Info about the web server. Removed because it could be used in simple attacks
97+
- `X-XSS-Protection`: Legacy header that tries to mitigate [XSS attacks](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting), but makes things worse, so Helmet disables it
98+
99+
Each header can be configured or disabled. To read more about it please go to [its documentation website][helmet].
90100

91101
Install Helmet like any other module:
92102

93103
```bash
94-
$ npm install --save helmet
104+
$ npm install helmet
95105
```
96106

97107
Then to use it in your code:

0 commit comments

Comments
 (0)