Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump helmet from 5.1.1 to 6.0.0 #201

Merged
merged 3 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
"devDependencies": {
"@fastify/pre-commit": "^2.0.2",
"@types/node": "^18.0.0",
"fastify": "^4.0.0-rc.2",
"fastify": "^4.5.3",
"snazzy": "^9.0.0",
"standard": "^17.0.0",
"tap": "^16.0.0",
"tsd": "^0.22.0"
},
"dependencies": {
"fastify-plugin": "^4.0.0",
"helmet": "^5.0.1"
"fastify-plugin": "^4.2.1",
"helmet": "^6.0.0"
},
"tsd": {
"directory": "test/types"
Expand Down
12 changes: 6 additions & 6 deletions test/global.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ test('It should be able to access default CSP directives through plugin export',
path: '/'
})

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' }
const expected = { 'content-security-policy': 'default-src \'self\';base-uri \'self\';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.has(response.headers, expected)
})
Expand Down Expand Up @@ -238,7 +238,7 @@ test('It should allow merging options for enableCSPNonces', async (t) => {
t.ok(cspCache.script)
t.ok(cspCache.style)
t.has(response.headers, {
'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`
'content-security-policy': `default-src 'self';script-src 'self' 'nonce-${cspCache.script}';style-src 'self' 'nonce-${cspCache.style}';base-uri 'self';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 @@ -299,7 +299,7 @@ test('It should not stack nonce array in csp header', async (t) => {
t.ok(cspCache.script)
t.ok(cspCache.style)
t.has(response.headers, {
'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`
'content-security-policy': `default-src 'self';script-src 'self' 'nonce-${cspCache.script}';style-src 'self' 'nonce-${cspCache.style}';base-uri 'self';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`
})

response = await fastify.inject({ method: 'GET', path: '/' })
Expand All @@ -308,7 +308,7 @@ test('It should not stack nonce array in csp header', async (t) => {
t.ok(cspCache.script)
t.ok(cspCache.style)
t.has(response.headers, {
'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`
'content-security-policy': `default-src 'self';script-src 'self' 'nonce-${cspCache.script}';style-src 'self' 'nonce-${cspCache.style}';base-uri 'self';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 @@ -337,7 +337,7 @@ test('It should access the correct options property', async (t) => {
t.ok(cspCache.script)
t.ok(cspCache.style)
t.has(response.headers, {
'content-security-policy': `script-src 'self' 'unsafe-eval' 'unsafe-inline' 'nonce-${cspCache.script}';style-src 'self' 'unsafe-inline' 'nonce-${cspCache.style}';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-attr 'none';upgrade-insecure-requests`
'content-security-policy': `script-src 'self' 'unsafe-eval' 'unsafe-inline' 'nonce-${cspCache.script}';style-src 'self' 'unsafe-inline' 'nonce-${cspCache.style}';default-src 'self';base-uri 'self';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 @@ -365,7 +365,7 @@ test('It should not set script-src or style-src', async (t) => {
t.ok(cspCache.script)
t.ok(cspCache.style)
t.has(response.headers, {
'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`
'content-security-policy': `default-src 'self';script-src 'nonce-${cspCache.script}';style-src 'nonce-${cspCache.style}';base-uri 'self';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
2 changes: 1 addition & 1 deletion test/routes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ test('It should add CSPNonce decorator and hooks when route `enableCSPNonces` op
t.ok(cspCache.script)
t.ok(cspCache.style)
t.has(response.headers, {
'content-security-policy': `script-src 'self' 'unsafe-eval' 'unsafe-inline' 'nonce-${cspCache.script}';style-src 'self' 'unsafe-inline' 'nonce-${cspCache.style}';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-attr 'none';upgrade-insecure-requests`
'content-security-policy': `script-src 'self' 'unsafe-eval' 'unsafe-inline' 'nonce-${cspCache.script}';style-src 'self' 'unsafe-inline' 'nonce-${cspCache.style}';default-src 'self';base-uri 'self';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
12 changes: 6 additions & 6 deletions types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ appFour.register(fastifyHelmet, {
reportUri: 'foo'
},
frameguard: {
action: 'foo'
action: 'deny'
},
hsts: {
maxAge: 1,
includeSubDomains: true,
preload: true
},
permittedCrossDomainPolicies: {
permittedPolicies: 'foo'
permittedPolicies: 'master-only'
},
referrerPolicy: {
policy: 'foo'
policy: 'no-referrer'
}
// these options are false or never
// hidePoweredBy: false
Expand Down Expand Up @@ -144,18 +144,18 @@ const routeHelmetOptions = {
reportUri: 'foo'
},
frameguard: {
action: 'foo'
action: 'deny' as const
},
hsts: {
maxAge: 1,
includeSubDomains: true,
preload: true
},
permittedCrossDomainPolicies: {
permittedPolicies: 'foo'
permittedPolicies: 'all' as const
},
referrerPolicy: {
policy: 'foo'
policy: 'no-referrer' as const
}
}
};
Expand Down