Skip to content

Commit 094f564

Browse files
authored
Merge pull request #673 from Baroshem/chore/2.5.1
Chore/2.5.1
2 parents d4d2afd + 77b140e commit 094f564

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nuxt-security",
3-
"version": "2.5.0",
3+
"version": "2.5.1",
44
"license": "MIT",
55
"type": "module",
66
"engines": {

src/module.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineNuxtModule, addServerHandler, installModule, addVitePlugin, addServerPlugin, createResolver, addImportsDir, useNitro, addServerImports, addTypeTemplate } from '@nuxt/kit'
1+
import { defineNuxtModule, addServerHandler, installModule, addVitePlugin, addServerPlugin, createResolver, addImportsDir, useNitro, addServerImports, addTypeTemplate, hasNuxtModule } from '@nuxt/kit'
22
import { existsSync } from 'node:fs'
33
import { readFile, readdir } from 'node:fs/promises'
44
import { join, isAbsolute } from 'pathe'
@@ -313,6 +313,13 @@ export {}
313313
nuxt.hooks.callHook('nuxt-security:prerenderedHeaders', prerenderedHeaders)
314314
})
315315
})
316+
317+
// Adjust route rules for Nuxt Hints compatibility
318+
if (hasNuxtModule('@nuxt/hints') && nuxt.options.dev) {
319+
nuxt.options.routeRules = defu(nuxt.options.routeRules, {
320+
'/__nuxt_hydration': { xssValidator: false }
321+
})
322+
}
316323
}
317324
})
318325

src/runtime/nitro/plugins/40-cspSsrNonce.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const LINK_RE = /<link\b([^>]*?>)/gi
66
const NONCE_RE = /nonce="[^"]+"/i
77
const SCRIPT_RE = /<script\b([^>]*?>)/gi
88
const STYLE_RE = /<style\b([^>]*?>)/gi
9-
const QUOTE_MASK_RE = /"([^"]*)"/g
9+
const QUOTE_MASK_RE = /"((?:[^"\\]|\\.)*)"/g
1010
const QUOTE_RESTORE_RE = /__QUOTE_PLACEHOLDER_(\d+)__/g
1111

1212
function injectNonceToTags(element: string, nonce: string) {

0 commit comments

Comments
 (0)