Skip to content
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
3 changes: 3 additions & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,16 @@ function registerSecurityNitroPlugins(nuxt: Nuxt, securityOptions: ModuleOptions
)

// Register nitro plugin to enable CSP Headers presets for SSG
// TEMPORARILY DISABLED AS NUXT 3.9.3 PREVENTS IMPORTING @NUXT/KIT IN NITRO PLUGINS
/*
config.plugins.push(
normalize(
fileURLToPath(
new URL('./runtime/nitro/plugins/05-cspSsgPresets', import.meta.url)
)
)
)
*/

// Nitro plugin to enable CSP Nonce for SSR
config.plugins.push(
Expand Down
6 changes: 6 additions & 0 deletions test/perRoute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,10 +832,13 @@ describe('[nuxt-security] Per-route Configuration', async () => {

it('does not inject CSP hashes on a deeply-disabled route', async () => {
const res = await fetch('/csp-hash/deep/disabled')
// DISABLING THIS PART OF THE TEST AFTER PATCH #348 THAT REMOVES CSP SSG PRESETS
/*
const cspHeaderValue = res.headers.get('content-security-policy')
expect(cspHeaderValue).toBeDefined()
const headerHashes = cspHeaderValue!.match(/'sha256-(.*?)'/)
expect(headerHashes).toBeNull()
*/

const text = await res.text()
const head = text.match(/<head>(.*?)<\/head>/s)?.[1]
Expand All @@ -849,10 +852,13 @@ describe('[nuxt-security] Per-route Configuration', async () => {

it('injects CSP hashes on a deeply-enabled route', async () => {
const res = await fetch('/csp-hash/deep/enabled')
// DISABLING THIS PART OF THE TEST AFTER PATCH #348 THAT REMOVES CSP SSG PRESETS
/*
const cspHeaderValue = res.headers.get('content-security-policy')
expect(cspHeaderValue).toBeDefined()
const headerHashes = cspHeaderValue!.match(/'sha256-(.*?)'/)
expect(headerHashes).toHaveLength(2)
*/

const text = await res.text()
const head = text.match(/<head>(.*?)<\/head>/s)?.[1]
Expand Down