Skip to content

Commit

Permalink
Fix audit-log encoding issue (CC-7337) (#20345)
Browse files Browse the repository at this point in the history
* add changes

* added changelog

* change update

* CE chnages

* Removed gzip size fix

* fix changelog

* Update .changelog/20345.txt

Co-authored-by: Hans Hasselberg <hans@hashicorp.com>

* Adding comments

---------

Co-authored-by: Abhishek Sahu <abhishek.sahu@hashicorp.com>
Co-authored-by: Hans Hasselberg <hans@hashicorp.com>
Co-authored-by: srahul3 <rahulsharma@hashicorp.com>
  • Loading branch information
4 people committed Feb 6, 2024
1 parent 3bbdbd2 commit 5ec5b1d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
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 @@ -187,7 +187,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 @@ -299,7 +301,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 @@ -96,9 +96,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

0 comments on commit 5ec5b1d

Please sign in to comment.