@nuxt/webpack-builder-nightly 5.0.0-29641879.626da0d7 → 5.0.0-29641938.f8dede9b

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.
Files changed (2) hide show
  1. package/dist/index.mjs +15 -1
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -1406,7 +1406,7 @@ async function createDevMiddleware(compiler) {
1406
1406
  function wdmToH3Handler(devMiddleware) {
1407
1407
  return defineEventHandler(async (event) => {
1408
1408
  const { req, res } = "runtime" in event ? event.runtime.node : event.node;
1409
- if (req.headers["sec-fetch-mode"] === "no-cors" && req.headers["sec-fetch-site"] === "cross-site") {
1409
+ if (!isSameOriginRequest(req)) {
1410
1410
  res.statusCode = 403;
1411
1411
  res.end("Forbidden");
1412
1412
  return;
@@ -1428,6 +1428,20 @@ function wdmToH3Handler(devMiddleware) {
1428
1428
  });
1429
1429
  });
1430
1430
  }
1431
+ function isSameOriginRequest(req) {
1432
+ const site = firstHeader(req.headers["sec-fetch-site"]);
1433
+ if (site !== void 0) return site === "same-origin" || site === "none";
1434
+ const initiator = firstHeader(req.headers.origin) || firstHeader(req.headers.referer);
1435
+ if (!initiator) return true;
1436
+ try {
1437
+ return new URL(initiator).host === firstHeader(req.headers.host);
1438
+ } catch {
1439
+ return false;
1440
+ }
1441
+ }
1442
+ function firstHeader(value) {
1443
+ return Array.isArray(value) ? value[0] : value;
1444
+ }
1431
1445
  async function compile(compiler) {
1432
1446
  const nuxt = useNuxt();
1433
1447
  await nuxt.callHook(`${builder}:compile`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder-nightly",
3
- "version": "5.0.0-29641879.626da0d7",
3
+ "version": "5.0.0-29641938.f8dede9b",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
28
- "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29641879.626da0d7",
28
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29641938.f8dede9b",
29
29
  "@vue/compiler-sfc": "3.5.34",
30
30
  "autoprefixer": "^10.5.0",
31
31
  "css-loader": "^7.1.4",
@@ -68,7 +68,7 @@
68
68
  "webpackbar": "^7.0.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29641879.626da0d7",
71
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29641938.f8dede9b",
72
72
  "@rspack/core": "2.0.2",
73
73
  "@types/webpack-bundle-analyzer": "4.7.0",
74
74
  "@types/webpack-hot-middleware": "2.25.12",
@@ -79,7 +79,7 @@
79
79
  "vue": "3.5.34"
80
80
  },
81
81
  "peerDependencies": {
82
- "nuxt": "npm:nuxt-nightly@5.0.0-29641879.626da0d7",
82
+ "nuxt": "npm:nuxt-nightly@5.0.0-29641938.f8dede9b",
83
83
  "vue": "^3.3.4"
84
84
  },
85
85
  "engines": {