Skip to content

Commit 46a01e8

Browse files
committed
Disable host check if you don't use proxy
1 parent 4e886f7 commit 46a01e8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/react-scripts/config/webpackDevServer.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ const host = process.env.HOST || '0.0.0.0';
1919

2020
module.exports = function(proxy, allowedHost) {
2121
return {
22+
// WebpackDevServer 2.4.3 introduced a security fix that prevents remote
23+
// websites from potentially accessing local content through DNS rebinding:
24+
// https://github.com/webpack/webpack-dev-server/issues/887
25+
// https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
26+
// However, it made several existing use cases such as development in cloud
27+
// environment or subdomains in development significantly more complicated:
28+
// https://github.com/facebookincubator/create-react-app/issues/2271
29+
// https://github.com/facebookincubator/create-react-app/issues/2233
30+
// While we're investigating better solutions, for now we will take a
31+
// compromise. Since our WDS configuration only serves files in the `public`
32+
// folder we won't consider accessing them a vulnerability. However, if you
33+
// use the `proxy` feature, it gets more dangerous because it can expose
34+
// remote code execution vulnerabilities in backends like Django and Rails.
35+
// So we will disable the host check normally, but enable it if you have
36+
// specified the `proxy` setting.
37+
disableHostCheck: !proxy,
2238
// Enable gzip compression of generated files.
2339
compress: true,
2440
// Silence WebpackDevServer's own logs since they're generally not useful.

0 commit comments

Comments
 (0)