-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
server: fix over redacted log line in migration server #137915
server: fix over redacted log line in migration server #137915
Conversation
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @aa-joshi)
pkg/server/migration.go
line 147 at r1 (raw file):
} log.Infof(ctx, "active cluster version setting is now %s (up from %s)", redact.Safe(newCV.PrettyPrint()), redact.Safe(prevCV.PrettyPrint()))
I think we can directly pass newCV
and prevCV
without Safe
or PrettyPrint
. Because the underlying type implements SafeFormatter
It was getting redacted because PrettyPrint()
returns string
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @arjunmahishi)
pkg/server/migration.go
line 147 at r1 (raw file):
Previously, arjunmahishi (Arjun Mahishi) wrote…
I think we can directly pass
newCV
andprevCV
withoutSafe
orPrettyPrint
. Because the underlying type implementsSafeFormatter
It was getting redacted because
PrettyPrint()
returnsstring
I believe we need to wrap in PrettyPrint because it has formatting logic based on v.IsFence()
ref:
cockroach/pkg/roachpb/version.go
Line 115 in ac3c5f2
func (v Version) PrettyPrint() string { |
Previously, aa-joshi (Akshay Joshi) wrote…
Then I think we can change PrettyPrint and make it return |
430dd79
to
b8f2695
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @arjunmahishi)
pkg/server/migration.go
line 147 at r1 (raw file):
Previously, arjunmahishi (Arjun Mahishi) wrote…
Then I think we can change PrettyPrint and make it return
redact.RedactableString
I think it's only being used for logging anyway.
PrettyPrint is invoked at multiple flows. Changing return type would increase changes significantly. As part of the task, we want to keep changes minimal so that we can backport. Let's use SafeString
here.
pkg/server/auto_upgrade.go
line 52 at r1 (raw file):
clusterVersion, err := s.clusterVersion(ctx) if err != nil { log.Errorf(ctx, "unable to retrieve cluster version: %v", redact.Safe(err))
I have reverted log redaction changes for errors as we have decided to build a standard framework for it.
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @arjunmahishi)
pkg/server/migration.go
line 147 at r1 (raw file):
Previously, aa-joshi (Akshay Joshi) wrote…
PrettyPrint is invoked at multiple flows. Changing return type would increase changes significantly. As part of the task, we want to keep changes minimal so that we can backport. Let's use
SafeString
here.
That change does not significantly change any of the non-test call sites. I wrote up a quick PR here to show it: #138353
IMO we should change PrettyPrint to return a RedactableString rather than using SafeString here.
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.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @arjunmahishi)
Previosuly, few log lines were getting redacted assuming that it contains sensitive information. Support team was facing challenges during dignostics. To address this, this patch address the log line in migration server which was overly redacted. Epic: CRDB-37533 Part of: CRDB-44885 Release note: None
b8f2695
to
4570e95
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @arjunmahishi and @rafiss)
pkg/server/migration.go
line 147 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
That change does not significantly change any of the non-test call sites. I wrote up a quick PR here to show it: #138353
IMO we should change PrettyPrint to return a RedactableString rather than using SafeString here.
Thanks for the review! updated.
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @aa-joshi and @rafiss)
pkg/clusterversion/cockroach_versions_test.go
line 150 at r3 (raw file):
} for _, test := range tests { if actual := test.cv.PrettyPrint().StripMarkers(); actual != test.exp {
We should not be getting any redaction markers if the redaction is handled correctly. If we are just using StripMarkers
to resolve the type to string, we can just convert the type of exp
to redact.RedactableString
on line 141.
Removing StripMarkers
will ensure that the test asserts the output of PrettyPrint
is not redacted.
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.
nice fix!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @arjunmahishi)
pkg/clusterversion/cockroach_versions_test.go
line 150 at r3 (raw file):
Previously, arjunmahishi (Arjun Mahishi) wrote…
We should not be getting any redaction markers if the redaction is handled correctly. If we are just using
StripMarkers
to resolve the type to string, we can just convert the type ofexp
toredact.RedactableString
on line 141.Removing
StripMarkers
will ensure that the test asserts the output ofPrettyPrint
is not redacted.
in tests, there's no strong reason to use redacted strings. IMO, it's ok to use StripMarkers here. however, it's also true that changing the type of exp
should fix it and is also a simple change. i'd be fine either way,
TFTR |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from 4570e95 to blathers/backport-release-23.2-137915: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 23.2.x failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Previosuly, few log lines were getting redacted assuming that it contains
sensitive information. Support team was facing challenges during dignostics. To
address this, this patch address the log line in migration server which was
overly redacted.
Epic: CRDB-37533
Part of: CRDB-44885
Release note: None