-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Fix audit-log encoding issue (CC-7337) #20345
Conversation
@@ -188,7 +188,8 @@ func (s *HTTPHandlers) handler() http.Handler { | |||
// Register the wrapper. | |||
wrapper := func(resp http.ResponseWriter, req *http.Request) { | |||
start := time.Now() | |||
handler(resp, req) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You sure that this line can be safely removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hander(resp, req)
is called inside https://github.com/hashicorp/consul/pull/20345/files#diff-ad6af77036bc1fef503bdda8fcfca16347a3ef985dc9defbe9d915d4c106524dR99
looks same for CE.
Is there an issue?
Co-authored-by: Hans Hasselberg <hans@hashicorp.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
#20497) * no-op commit due to failed cherry-picking * Fix audit-log encoding issue (CC-7337) (#20345) * 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> --------- Co-authored-by: temp <temp@hashicorp.com> Co-authored-by: Ashesh Vidyut <134911583+absolutelightning@users.noreply.github.com> Co-authored-by: Abhishek Sahu <abhishek.sahu@hashicorp.com> Co-authored-by: Hans Hasselberg <hans@hashicorp.com> Co-authored-by: srahul3 <rahulsharma@hashicorp.com>
#20498) * no-op commit due to failed cherry-picking * Fix audit-log encoding issue (CC-7337) (#20345) * 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> --------- Co-authored-by: temp <temp@hashicorp.com> Co-authored-by: Ashesh Vidyut <134911583+absolutelightning@users.noreply.github.com> Co-authored-by: Abhishek Sahu <abhishek.sahu@hashicorp.com> Co-authored-by: Hans Hasselberg <hans@hashicorp.com> Co-authored-by: srahul3 <rahulsharma@hashicorp.com>
#20499) Fix audit-log encoding issue (CC-7337) (#20345) * add changes * added changelog * change update * CE chnages * Removed gzip size fix * fix changelog * Update .changelog/20345.txt * Adding comments --------- Co-authored-by: Ashesh Vidyut <134911583+absolutelightning@users.noreply.github.com> Co-authored-by: Abhishek Sahu <abhishek.sahu@hashicorp.com> Co-authored-by: Hans Hasselberg <hans@hashicorp.com> Co-authored-by: srahul3 <rahulsharma@hashicorp.com>
* 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>
* 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>
#20749) Fix audit-log encoding issue (CC-7337) (#20345) * add changes * added changelog * change update * CE chnages * Removed gzip size fix * fix changelog * Update .changelog/20345.txt * Adding comments --------- Co-authored-by: Ashesh Vidyut <134911583+absolutelightning@users.noreply.github.com> Co-authored-by: Abhishek Sahu <abhishek.sahu@hashicorp.com> Co-authored-by: Hans Hasselberg <hans@hashicorp.com> Co-authored-by: srahul3 <rahulsharma@hashicorp.com>
Description
Fixes bug - CC-7337, where we can see zip encoded characters in audit log files.
The audit-logs needs to be human-readable hence the changes in this PR is making sure that the audit log for any API call is only JSON encoded(not zip encoded). This is done by enforcing the request header
Accept-Encoding: application/json
only for audit logs. By doing so the zip handler will ignore encoding the response to zip.Also found another bug, if we enforce the JSON in audit response, the audit-log handler is ignoring the 429 status-code hence converting it to 200.
Encoded log sample.
Testing & Reproduction steps
Manual steps on local -
consul acl bootstrap
X-Consul-Token
-After this fix the log file will be generated without Non Ascii Characters -
PR Checklist