Skip to content

Commit

Permalink
build(deps)!: bump helmet from 4.6.0 to 5.0.1 (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Jan 9, 2022
1 parent f6dd255 commit f752e6c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
strategy:
matrix:
node-version:
- 10
- 12
- 14
- 16
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FastifyPluginCallback } from "fastify";
import helmet = require("helmet");
import helmet from "helmet";

declare module 'fastify' {
interface FastifyReply {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
},
"dependencies": {
"fastify-plugin": "^3.0.0",
"helmet": "^4.0.0"
"helmet": "^5.0.1"
}
}
12 changes: 6 additions & 6 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ test('default CSP directives can be accessed through plugin export', (t) => {
}, (err, res) => {
t.error(err)

const expected = { 'content-security-policy': 'default-src \'self\';base-uri \'self\';block-all-mixed-content;font-src \'self\' https: data:;frame-ancestors \'self\';img-src \'self\' data:;object-src \'none\';script-src \'self\';script-src-attr \'none\';style-src \'self\' https: \'unsafe-inline\';upgrade-insecure-requests' }
const expected = { 'content-security-policy': 'default-src \'self\';base-uri \'self\';block-all-mixed-content;font-src \'self\' https: data:;form-action \'self\';frame-ancestors \'self\';img-src \'self\' data:;object-src \'none\';script-src \'self\';script-src-attr \'none\';style-src \'self\' https: \'unsafe-inline\';upgrade-insecure-requests' }

t.include(res.headers, expected)
t.end()
Expand Down Expand Up @@ -187,7 +187,7 @@ test('allow merging options for enableCSPNonces', async (t) => {
t.ok(cspCache.script)
t.ok(cspCache.style)
t.includes(res.headers, {
'content-security-policy': `default-src 'self';script-src 'self' 'nonce-${cspCache.script}';style-src 'self' 'nonce-${cspCache.style}'`
'content-security-policy': `default-src 'self';script-src 'self' 'nonce-${cspCache.script}';style-src 'self' 'nonce-${cspCache.style}';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src-attr 'none';upgrade-insecure-requests`
})
})

Expand Down Expand Up @@ -216,15 +216,15 @@ test('nonce array is not stacked in csp header', async (t) => {
t.ok(cspCache.script)
t.ok(cspCache.style)
t.includes(res.headers, {
'content-security-policy': `default-src 'self';script-src 'self' 'nonce-${cspCache.script}';style-src 'self' 'nonce-${cspCache.style}'`
'content-security-policy': `default-src 'self';script-src 'self' 'nonce-${cspCache.script}';style-src 'self' 'nonce-${cspCache.style}';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src-attr 'none';upgrade-insecure-requests`
})

res = await fastify.inject({ method: 'GET', url: '/' })
cspCache = res.json()
t.ok(cspCache.script)
t.ok(cspCache.style)
t.includes(res.headers, {
'content-security-policy': `default-src 'self';script-src 'self' 'nonce-${cspCache.script}';style-src 'self' 'nonce-${cspCache.style}'`
'content-security-policy': `default-src 'self';script-src 'self' 'nonce-${cspCache.script}';style-src 'self' 'nonce-${cspCache.style}';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src-attr 'none';upgrade-insecure-requests`
})
})

Expand Down Expand Up @@ -253,7 +253,7 @@ test('access the correct options property', async (t) => {
t.ok(cspCache.script)
t.ok(cspCache.style)
t.includes(res.headers, {
'content-security-policy': `default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self' 'unsafe-eval' 'unsafe-inline' 'nonce-${cspCache.script}';script-src-attr 'none';style-src 'self' 'unsafe-inline' 'nonce-${cspCache.style}';upgrade-insecure-requests`
'content-security-policy': `default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self' 'unsafe-eval' 'unsafe-inline' 'nonce-${cspCache.script}';script-src-attr 'none';style-src 'self' 'unsafe-inline' 'nonce-${cspCache.style}';upgrade-insecure-requests`
})
})

Expand All @@ -280,6 +280,6 @@ test('do not set script-src or style-src', async (t) => {
t.ok(cspCache.script)
t.ok(cspCache.style)
t.includes(res.headers, {
'content-security-policy': `default-src 'self';script-src 'nonce-${cspCache.script}';style-src 'nonce-${cspCache.style}'`
'content-security-policy': `default-src 'self';script-src 'nonce-${cspCache.script}';style-src 'nonce-${cspCache.style}';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src-attr 'none';upgrade-insecure-requests`
})
})

0 comments on commit f752e6c

Please sign in to comment.