File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,12 +106,16 @@ function extractNormalizedRequestData(
106106 delete ( headers as { cookie ?: string } ) . cookie ;
107107 }
108108
109- // Remove IP headers in case IP data should not be included in the event
109+ // Remove IP headers in case IP data should not be included in the event.
110+ // Match case-insensitively — same as getClientIPAddress — so lowercase keys are stripped too.
110111 if ( ! include . ip ) {
111- ipHeaderNames . forEach ( ipHeaderName => {
112- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
113- delete ( headers as Record < string , unknown > ) [ ipHeaderName ] ;
114- } ) ;
112+ const ipHeaderNamesLower = new Set ( ipHeaderNames . map ( name => name . toLowerCase ( ) ) ) ;
113+ for ( const key of Object . keys ( headers ) ) {
114+ if ( ipHeaderNamesLower . has ( key . toLowerCase ( ) ) ) {
115+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
116+ delete ( headers as Record < string , unknown > ) [ key ] ;
117+ }
118+ }
115119 }
116120 }
117121
You can’t perform that action at this time.
0 commit comments