Skip to content

Commit 657a2e5

Browse files
author
Carlos Requena López
committed
disallow automatic validation of ALL IP's. fixes webpack#1618
for both Host checking and Origin checking
1 parent 178e6cc commit 657a2e5

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

lib/Server.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,10 @@ Server.prototype.setContentHeaders = function (req, res, next) {
647647
};
648648

649649
Server.prototype.checkHost = function (headers, headerToCheck) {
650+
/* This routine is also used to check the Origin header, whenever
651+
* headerToCheck says so
652+
*/
653+
650654
// allow user to opt-out this security check, at own risk
651655
if (this.disableHostCheck) {
652656
return true;
@@ -668,15 +672,6 @@ Server.prototype.checkHost = function (headers, headerToCheck) {
668672
false,
669673
true
670674
).hostname;
671-
// always allow requests with explicit IPv4 or IPv6-address.
672-
// A note on IPv6 addresses:
673-
// hostHeader will always contain the brackets denoting
674-
// an IPv6-address in URLs,
675-
// these are removed from the hostname in url.parse(),
676-
// so we have the pure IPv6-address in hostname.
677-
if (ip.isV4Format(hostname) || ip.isV6Format(hostname)) {
678-
return true;
679-
}
680675
// always allow localhost host, for convience
681676
if (hostname === 'localhost') {
682677
return true;

0 commit comments

Comments
 (0)