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

fix(config): typo in unsafeInlineCompatibility name #6583

Merged
merged 4 commits into from Oct 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/config/src/options.js
Expand Up @@ -241,7 +241,7 @@ export function getNuxtConfig (_options) {
allowedSources: undefined,
policies: undefined,
addMeta: Boolean(options._generate),
unsafeInlineCompatiblity: false,
unsafeInlineCompatibility: false,
reportOnly: options.debug
})
}
Expand Down
2 changes: 1 addition & 1 deletion packages/config/test/options.test.js
Expand Up @@ -102,7 +102,7 @@ describe('config: options', () => {
expect(csp).toEqual({
hashAlgorithm: 'sha256',
addMeta: false,
unsafeInlineCompatiblity: false,
unsafeInlineCompatibility: false,
allowedSources: true,
policies: undefined,
reportOnly: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-renderer/src/renderers/ssr.js
Expand Up @@ -138,7 +138,7 @@ export default class SSRRenderer extends BaseRenderer {
if (csp) {
// Only add the hash if 'unsafe-inline' rule isn't present to avoid conflicts (#5387)
const containsUnsafeInlineScriptSrc = csp.policies && csp.policies['script-src'] && csp.policies['script-src'].includes(`'unsafe-inline'`)
if (csp.unsafeInlineCompatiblity || !containsUnsafeInlineScriptSrc) {
if (csp.unsafeInlineCompatibility || !containsUnsafeInlineScriptSrc) {
const hash = crypto.createHash(csp.hashAlgorithm)
hash.update(serializedSession)
cspScriptSrcHashes.push(`'${csp.hashAlgorithm}-${hash.digest('base64')}'`)
Expand Down
8 changes: 4 additions & 4 deletions test/unit/basic.ssr.csp.test.js
Expand Up @@ -198,14 +198,14 @@ describe('basic ssr csp', () => {
)

test(
'Contain hash and \'unsafe-inline\' when unsafeInlineCompatiblity is enabled',
'Contain hash and \'unsafe-inline\' when unsafeInlineCompatibility is enabled',
async () => {
const policies = {
'script-src': [`'unsafe-inline'`]
}

nuxt = await startCspServer({
unsafeInlineCompatiblity: true,
unsafeInlineCompatibility: true,
policies
})

Expand Down Expand Up @@ -419,14 +419,14 @@ describe('basic ssr csp', () => {
)

test(
'Contain hash and \'unsafe-inline\' when unsafeInlineCompatiblity is enabled',
'Contain hash and \'unsafe-inline\' when unsafeInlineCompatibility is enabled',
async () => {
const policies = {
'script-src': [`'unsafe-inline'`]
}

nuxt = await startCspServer({
unsafeInlineCompatiblity: true,
unsafeInlineCompatibility: true,
policies
})

Expand Down