Skip to content

Commit

Permalink
Merge pull request #43 from venables/expect-ct-readme
Browse files Browse the repository at this point in the history
Add Expect-CT, Feature-Policy, and Cross-Domain from helmet
  • Loading branch information
venables committed Mar 19, 2019
2 parents 8f8daf8 + 2d02be2 commit c17bbce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ Helmet offers 11 security middleware functions:
| Module | Default? |
|---|---|
| [contentSecurityPolicy](https://helmetjs.github.io/docs/csp/) for setting Content Security Policy | |
| [permittedCrossDomainPolicies](https://helmetjs.github.io/docs/crossdomain/) for handling Adobe products' crossdomain requests | |
| [dnsPrefetchControl](https://helmetjs.github.io/docs/dns-prefetch-control) controls browser DNS prefetching ||
| [expectCt](https://helmetjs.github.io/docs/expect-ct/) for handling Certificate Transparency | |
| [featurePolicy](https://helmetjs.github.io/docs/feature-policy/) to limit your site's features | |
| [frameguard](https://helmetjs.github.io/docs/frameguard/) to prevent clickjacking ||
| [hidePoweredBy](https://helmetjs.github.io/docs/hide-powered-by) to remove the X-Powered-By header ||
| [hpkp](https://helmetjs.github.io/docs/hpkp/) for HTTP Public Key Pinning | |
Expand Down
18 changes: 18 additions & 0 deletions test/koa-helmet.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ test('it sets individual headers properly', t => {
app.use(helmet.xssFilter());
app.use(helmet.frameguard('deny'));
app.use(helmet.noSniff());
app.use(helmet.permittedCrossDomainPolicies());
app.use(helmet.expectCt());
app.use(helmet.featurePolicy({
features: {
fullscreen: ['\'self\''],
notifications: ['\'none\''],
vibrate: ['\'none\'']
}
}));
app.use(
helmet.hpkp({
maxAge: 1000,
Expand Down Expand Up @@ -89,6 +98,15 @@ test('it sets individual headers properly', t => {
// noSniff
.expect('X-Content-Type-Options', 'nosniff')

// permittedCrossDomainPolicies
.expect('X-Permitted-Cross-Domain-Policies', 'none')

// expectCt
.expect('Expect-CT', 'max-age=0')

// featurePolicy
.expect('Feature-Policy', 'fullscreen \'self\';notifications \'none\';vibrate \'none\'')

// hpkp
.expect(
'Public-Key-Pins',
Expand Down

0 comments on commit c17bbce

Please sign in to comment.