Skip to content

Commit

Permalink
internal/appsec: fix missing ResponseHeaderCopier call (#2841)
Browse files Browse the repository at this point in the history
Signed-off-by: Eliott Bouhana <[email protected]>
  • Loading branch information
eliottness authored Sep 2, 2024
1 parent e7ca17e commit 2c85bdc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/appsec/emitter/httpsec/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func WrapHandler(handler http.Handler, span ddtrace.Span, pathParams map[string]
r = r.WithContext(ctx)

defer func() {
events := op.Finish(MakeHandlerOperationRes(w))
events := op.Finish(MakeHandlerOperationRes(w, opts.ResponseHeaderCopier))

// Execute the onBlock functions to make sure blocking works properly
// in case we are instrumenting the Gin framework
Expand Down Expand Up @@ -149,12 +149,12 @@ func MakeHandlerOperationArgs(r *http.Request, clientIP netip.Addr, pathParams m
}

// MakeHandlerOperationRes creates the HandlerOperationRes value.
func MakeHandlerOperationRes(w http.ResponseWriter) types.HandlerOperationRes {
func MakeHandlerOperationRes(w http.ResponseWriter, responseHeadersCopier func(http.ResponseWriter) http.Header) types.HandlerOperationRes {
var status int
if mw, ok := w.(interface{ Status() int }); ok {
status = mw.Status()
}
return types.HandlerOperationRes{Status: status, Headers: headersRemoveCookies(w.Header())}
return types.HandlerOperationRes{Status: status, Headers: headersRemoveCookies(responseHeadersCopier(w))}
}

// Remove cookies from the request headers and return the map of headers
Expand Down

0 comments on commit 2c85bdc

Please sign in to comment.