Skip to content

Commit c17e643

Browse files
authored
Merge branch 'webpack:master' into feat/overlay-ui
2 parents 99f723c + 6afffac commit c17e643

File tree

6 files changed

+393
-3283
lines changed

6 files changed

+393
-3283
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [5.2.2](https://github.com/webpack/webpack-dev-server/compare/v5.2.1...v5.2.2) (2025-06-03)
6+
7+
8+
### Bug Fixes
9+
10+
* "Overlay enabled" false positive ([18e72ee](https://github.com/webpack/webpack-dev-server/commit/18e72ee3e57a6e7598a6c068c0ff7c7bb6a857f1))
11+
* do not crush when error is null for runtime errors ([#5447](https://github.com/webpack/webpack-dev-server/issues/5447)) ([309991f](https://github.com/webpack/webpack-dev-server/commit/309991f947baa0354140b9930a9654ac792e20c4))
12+
* remove unnecessary header `X_TEST` ([#5451](https://github.com/webpack/webpack-dev-server/issues/5451)) ([64a6124](https://github.com/webpack/webpack-dev-server/commit/64a6124bf1b4d158bb42a4341dd03121ae3759fa))
13+
* respect the `allowedHosts` option for cross-origin header check ([#5510](https://github.com/webpack/webpack-dev-server/issues/5510)) ([03d1214](https://github.com/webpack/webpack-dev-server/commit/03d12141bf7be09dfb14e91e5c834ee63bd9a9a2))
14+
515
## [5.2.1](https://github.com/webpack/webpack-dev-server/compare/v5.2.0...v6.0.0) (2025-03-26)
616

717
### Security

lib/Server.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,6 +1986,13 @@ class Server {
19861986
const headers =
19871987
/** @type {{ [key: string]: string | undefined }} */
19881988
(req.headers);
1989+
const headerName = headers[":authority"] ? ":authority" : "host";
1990+
1991+
if (this.isValidHost(headers, headerName, false)) {
1992+
next();
1993+
return;
1994+
}
1995+
19891996
if (
19901997
headers["sec-fetch-mode"] === "no-cors" &&
19911998
headers["sec-fetch-site"] === "cross-site"
@@ -3166,9 +3173,10 @@ class Server {
31663173
* @private
31673174
* @param {{ [key: string]: string | undefined }} headers
31683175
* @param {string} headerToCheck
3176+
* @param {boolean} validateHost
31693177
* @returns {boolean}
31703178
*/
3171-
isValidHost(headers, headerToCheck) {
3179+
isValidHost(headers, headerToCheck, validateHost = true) {
31723180
if (this.options.allowedHosts === "all") {
31733181
return true;
31743182
}
@@ -3210,12 +3218,13 @@ class Server {
32103218
// For convenience, always allow localhost (hostname === 'localhost')
32113219
// and its subdomains (hostname.endsWith(".localhost")).
32123220
// allow hostname of listening address (hostname === this.options.host)
3213-
const isValidHostname =
3214-
ipaddr.IPv4.isValid(hostname) ||
3215-
ipaddr.IPv6.isValid(hostname) ||
3216-
hostname === "localhost" ||
3217-
hostname.endsWith(".localhost") ||
3218-
hostname === this.options.host;
3221+
const isValidHostname = validateHost
3222+
? ipaddr.IPv4.isValid(hostname) ||
3223+
ipaddr.IPv6.isValid(hostname) ||
3224+
hostname === "localhost" ||
3225+
hostname.endsWith(".localhost") ||
3226+
hostname === this.options.host
3227+
: false;
32193228

32203229
return isValidHostname;
32213230
}

0 commit comments

Comments
 (0)