Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of Fix audit-log encoding issue (CC-7337) into release/1.18.x #20749

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/20345.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
audit-logs: **(Enterprise Only)** Fixes non ASCII characters in audit logs because of gzip.
```
5 changes: 3 additions & 2 deletions agent/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ func (s *HTTPHandlers) handler() http.Handler {
// Register the wrapper.
wrapper := func(resp http.ResponseWriter, req *http.Request) {
start := time.Now()
handler(resp, req)

// this method is implemented by different flavours of consul e.g. oss, ce. ent.
s.enterpriseRequest(resp, req, handler)

labels := []metrics.Label{{Name: "method", Value: req.Method}, {Name: "path", Value: path_label}}
metrics.MeasureSinceWithLabels([]string{"api", "http"}, start, labels)
Expand Down Expand Up @@ -313,7 +315,6 @@ func (s *HTTPHandlers) handler() http.Handler {
h = mux
}

h = s.enterpriseHandler(h)
h = withRemoteAddrHandler(h)
s.h = &wrappedMux{
mux: mux,
Expand Down
6 changes: 3 additions & 3 deletions agent/http_ce.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ func parseACLAuthMethodEnterpriseMeta(req *http.Request, _ *structs.ACLAuthMetho
return nil
}

// enterpriseHandler is a noop for the enterprise implementation. we pass the original back
func (s *HTTPHandlers) enterpriseHandler(next http.Handler) http.Handler {
return next
func (s *HTTPHandlers) enterpriseRequest(w http.ResponseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) {
// no special handling for CE. Calling the default handler with default params.
handler(w, req)
}

// uiTemplateDataTransform returns an optional uiserver.UIDataTransform to allow
Expand Down
Loading