File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
3
- function isChromiumBased ( userAgentHeader ) {
4
- return Boolean ( userAgentHeader && userAgentHeader . includes ( 'Chrome' ) ) ;
3
+ function isTrustedClient ( req ) {
4
+ // Only allow injection if client explicitly identifies itself
5
+ return req . headers [ "webpack-dev-server-client" ] === "true" ;
5
6
}
6
7
7
8
const os = require ( "os" ) ;
@@ -2108,8 +2109,9 @@ class Server {
2108
2109
( middleware ) . waitUntilValid ( ( stats ) => {
2109
2110
res . setHeader ( "Content-Type" , "text/html" ) ;
2110
2111
2111
- if ( ! isChromiumBased ( req . headers [ 'user-agent' ] ) ) {
2112
- res . end ( '<!DOCTYPE html><html><body><h2>Access blocked: Please use a Chromium-based browser (Chrome, Edge, etc.).</h2></body></html>' ) ;
2112
+ if ( ! isTrustedClient ( req ) ) {
2113
+ res . statusCode = 403 ;
2114
+ res . end ( "Access denied: Missing required dev server client header." ) ;
2113
2115
return ;
2114
2116
}
2115
2117
You can’t perform that action at this time.
0 commit comments