@nuxt/nitro-server-nightly 4.4.0-29535027.34787e4f → 4.4.0-29535815.ada4e895

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -19,7 +19,7 @@ import { isWindows } from "std-env";
19
19
  import { ImpoundPlugin } from "impound";
20
20
  import { resolveModulePath } from "exsolve";
21
21
  import { runtimeDependencies } from "nitropack/runtime/meta";
22
- var version = "4.4.0-29535027.34787e4f";
22
+ var version = "4.4.0-29535815.ada4e895";
23
23
  function toArray(value) {
24
24
  return Array.isArray(value) ? value : [value];
25
25
  }
@@ -41,13 +41,22 @@ export function renderPayloadJsonScript(opts) {
41
41
  function encodeForwardSlashes(str) {
42
42
  return str.replaceAll("/", "\\u002F");
43
43
  }
44
+ /**
45
+ * Escape a string for safe interpolation inside a double-quoted JavaScript string literal.
46
+ * Prevents XSS when user-controlled URLs are embedded in inline `<script>` tags.
47
+ */
48
+ function escapeJsString(str) {
49
+ return str.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\n", "\\n").replaceAll("\r", "\\r").replaceAll("/", "\\u002F").replaceAll("<", "\\u003C");
50
+ }
44
51
  export function renderPayloadScript(opts) {
45
52
  opts.data.config = opts.ssrContext.config;
46
53
  const _PAYLOAD_EXTRACTION = !opts.ssrContext.noSSR && (import.meta.prerender && NUXT_PAYLOAD_EXTRACTION || NUXT_RUNTIME_PAYLOAD_EXTRACTION && (opts.routeOptions.isr || opts.routeOptions.cache));
47
54
  const nuxtData = devalue(opts.data);
48
55
  if (_PAYLOAD_EXTRACTION) {
49
- const singleAppPayload = `import p from "${opts.src}";window.__NUXT__={...p,...(${nuxtData})}`;
50
- const multiAppPayload = `import p from "${opts.src}";window.__NUXT__=window.__NUXT__||{};window.__NUXT__[${JSON.stringify(appId)}]={...p,...(${nuxtData})}`;
56
+ // Escape the URL to prevent XSS when interpolated into a JS string literal
57
+ const escapedSrc = escapeJsString(opts.src);
58
+ const singleAppPayload = `import p from "${escapedSrc}";window.__NUXT__={...p,...(${nuxtData})}`;
59
+ const multiAppPayload = `import p from "${escapedSrc}";window.__NUXT__=window.__NUXT__||{};window.__NUXT__[${JSON.stringify(appId)}]={...p,...(${nuxtData})}`;
51
60
  return [{
52
61
  type: "module",
53
62
  innerHTML: multiApp ? multiAppPayload : singleAppPayload
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/nitro-server-nightly",
3
- "version": "4.4.0-29535027.34787e4f",
3
+ "version": "4.4.0-29535815.ada4e895",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@nuxt/devalue": "^2.0.2",
30
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.4.0-29535027.34787e4f",
30
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.4.0-29535815.ada4e895",
31
31
  "@unhead/vue": "^2.1.4",
32
32
  "@vue/shared": "^3.5.28",
33
33
  "consola": "^3.4.2",
@@ -55,11 +55,11 @@
55
55
  "vue-devtools-stub": "^0.1.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "nuxt": "npm:nuxt-nightly@4.4.0-29535027.34787e4f"
58
+ "nuxt": "npm:nuxt-nightly@4.4.0-29535815.ada4e895"
59
59
  },
60
60
  "devDependencies": {
61
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.4.0-29535027.34787e4f",
62
- "nuxt": "npm:nuxt-nightly@4.4.0-29535027.34787e4f",
61
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.4.0-29535815.ada4e895",
62
+ "nuxt": "npm:nuxt-nightly@4.4.0-29535815.ada4e895",
63
63
  "obuild": "0.4.31",
64
64
  "vitest": "4.0.18"
65
65
  },