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

Use custom marshaller to clarify redactions #4506

Merged
merged 8 commits into from
Nov 8, 2024

Conversation

evankanderson
Copy link
Contributor

What type of PR is this?

fix: Make redacted fields show as "[redacted]" rather than "W3JlZGFjdGVkXQ=="

What this PR does / why we need it:

I started preparing to report a security issue with Envoy Gateway because I noticed that our logs contained a "privateKey" with a base64-encoded value. Eventually, while trying to get the key to line up with the certificate, I base-64 decoded the contents, and saw that the value was [redacted]. I'm hoping this avoids future users getting freaked out like I did.

As a maybe-beneficial side-effect, it shouldn't be necessary to call Printable() to avoid leaking XDS secret information when marshalling to/from JSON or YAML.

Which issue(s) this PR fixes:

I didn't end up filing a bug yet.

Release Notes: No

@evankanderson evankanderson requested a review from a team as a code owner October 23, 2024 19:30
@evankanderson
Copy link
Contributor Author

Note: this incorporates #4505 , as that changed the format of JSONString().

Copy link

codecov bot commented Oct 23, 2024

Codecov Report

Attention: Patch coverage is 10.71429% with 25 lines in your changes missing coverage. Please review.

Project coverage is 65.60%. Comparing base (9c9f435) to head (83abc1f).
Report is 76 commits behind head on main.

Files with missing lines Patch % Lines
internal/ir/xds.go 10.71% 24 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4506      +/-   ##
==========================================
- Coverage   65.66%   65.60%   -0.07%     
==========================================
  Files         211      211              
  Lines       31689    31691       +2     
==========================================
- Hits        20810    20791      -19     
- Misses       9677     9696      +19     
- Partials     1202     1204       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@evankanderson
Copy link
Contributor Author

Hold off on reviewing this; it looks like I missed make -k gen-check, which seems to be getting a bunch of double-base-64 encodings from somewhere even when I account for empty-bytes --> nil rather than [redacted].

@evankanderson
Copy link
Contributor Author

I think I've fixed the errors from make gen-check, though it did add a bit of extra (mostly test) complexity.

Copy link
Member

@zirain zirain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
cc @shawnh2

Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the late reply
LGTM thanks !

@arkodg arkodg requested review from a team, shawnh2 and zirain November 8, 2024 21:37
Copy link
Contributor

@shawnh2 shawnh2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shawnh2 shawnh2 merged commit 2c98617 into envoyproxy:main Nov 8, 2024
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants