File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,7 +90,8 @@ export const register = async (
9090 // TODO: This does *NOT* work if you have a base path since to specify the
9191 // protocol we need to specify the whole path.
9292 if ( args . cert && ! ( req . connection as tls . TLSSocket ) . encrypted ) {
93- return res . redirect ( `https://${ req . headers . host } ${ req . originalUrl } ` )
93+ const host = String ( req . headers . host || "" ) . replace ( / [ ^ \w . \- : [ \] ] / g, "" )
94+ return res . redirect ( `https://${ host } ${ req . originalUrl } ` )
9495 }
9596 next ( )
9697 } )
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const getProxyTarget = (
1515 const base = ( req as any ) . base || ""
1616 // Cast since we only have one port param.
1717 const port = parseInt ( req . params . port as string , 10 )
18- if ( isNaN ( port ) ) {
18+ if ( isNaN ( port ) || port < 1024 || port > 65535 ) {
1919 throw new HttpError ( "Invalid port" , HttpCode . BadRequest )
2020 }
2121 return `http://0.0.0.0:${ port } ${ opts ?. proxyBasePath || "" } /${ req . originalUrl . slice ( base . length ) } `
You can’t perform that action at this time.
0 commit comments