-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
redact s3 credential values when printing config to logs #5961
Conversation
d413498
to
50b97af
Compare
50b97af
to
fe89098
Compare
@@ -69,8 +85,8 @@ type S3Config struct { | |||
BucketNames string | |||
Endpoint string `yaml:"endpoint"` | |||
Region string `yaml:"region"` | |||
AccessKeyID string `yaml:"access_key_id"` | |||
SecretAccessKey string `yaml:"secret_access_key"` | |||
AccessKeyID secret `yaml:"access_key_id"` |
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.
I'm failing to understand how this will redact when printing these configs in logs. Can you clarify?
- Can you tell me where exactly it's getting logged?
- Even with this change, if we log the config (either logfmt or json), it's still going to be visible correct?
- Only advantage of adding this
secret
type I see is when we print the config after marshalling into YAML, it won't be visible. Is that your real use case? can you help me understand how it's useful?
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.
Thanks for taking a look!
When I set the -print-config-stderr
or -log-config-reverse-order
, loki marshals the config to YAML and dumps it to stderr. This diff forces S3 credentials to be redacted from this output. I will update the PR description as well.
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.
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.
Thanks @afayngelerindbx for the clarification :)
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!
What this PR does / why we need it:
This PR makes sure that we don't commit S3 credential values to logs when using
-print-config-stderr
and-log-config-reverse-order
flags.Checklist
CHANGELOG.md
about the changes.