File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ interface RateLimitEntry {
3030
3131const rateLimitMap = new Map < string , RateLimitEntry > ( ) ;
3232const RATE_LIMIT_WINDOW_MS = 60 * 1000 ; // 1 minute
33- const RATE_LIMIT_MAX_REQUESTS = 100 ; // 100 requests per minute per IP
33+ const RATE_LIMIT_MAX_REQUESTS = 600 ; // 600 requests per minute per IP (dashboard makes many API calls)
3434
3535function checkRateLimit ( clientIp : string ) : boolean {
3636 const now = Date . now ( ) ;
@@ -110,9 +110,9 @@ function createServer(ctx: ServerContext): http.Server {
110110 }
111111
112112 // HIGH FIX: Host header validation to prevent DNS rebinding attacks
113- const hostHeader = req . headers . host ;
114- const allowedHosts = [ ` localhost: ${ PORT } ` , ` 127.0.0.1: ${ PORT } ` ] ;
115- if ( ! hostHeader || ! allowedHosts . includes ( hostHeader ) ) {
113+ const hostHeader = req . headers . host ?. split ( ':' ) [ 0 ] || '' ;
114+ const allowedHosts = [ ' localhost' , ' 127.0.0.1' , '0.0.0.0' , '' ] ;
115+ if ( hostHeader && ! allowedHosts . includes ( hostHeader ) ) {
116116 res . writeHead ( 400 , { 'Content-Type' : 'application/json' } ) ;
117117 res . end ( JSON . stringify ( { error : 'Invalid Host header' } ) ) ;
118118 return ;
You can’t perform that action at this time.
0 commit comments