Skip to content

Use custom marshaller to clarify redactions#4506

Merged
shawnh2 merged 8 commits intoenvoyproxy:mainfrom
evankanderson:clarify-redacted
Nov 8, 2024
Merged

Use custom marshaller to clarify redactions#4506
shawnh2 merged 8 commits intoenvoyproxy:mainfrom
evankanderson:clarify-redacted

Conversation

@evankanderson
Copy link
Copy Markdown
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

Signed-off-by: Evan Anderson <evan@stacklok.com>
@evankanderson evankanderson requested a review from a team as a code owner October 23, 2024 19:30
@evankanderson
Copy link
Copy Markdown
Contributor Author

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

@codecov
Copy link
Copy Markdown

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.

Signed-off-by: Evan Anderson <evan@stacklok.com>
@evankanderson
Copy link
Copy Markdown
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].

Signed-off-by: Evan Anderson <evan@stacklok.com>
Signed-off-by: Evan Anderson <evan@stacklok.com>
@evankanderson
Copy link
Copy Markdown
Contributor Author

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

Signed-off-by: Evan Anderson <evan@stacklok.com>
Signed-off-by: Evan Anderson <evan@stacklok.com>
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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