-
Notifications
You must be signed in to change notification settings - Fork 39.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
Include ServerName in tls transport cache key #56415
Conversation
This will need picks. /lgtm |
/status in-progress |
[MILESTONENOTIFIER] Milestone Pull Request Current @caesarxuchao @deads2k @liggitt Note: This pull request is marked as Example update:
Pull Request Labels
|
picks opened |
integration test setup for one test had a bug that was masked because the extension server and kube apiserver were both in-process and shared the tls config cache. pushed a test update |
still |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, liggitt Associated issue: 56385 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
lgtm. |
Automatic merge from submit-queue (batch tested with PRs 56094, 52910, 55953, 56405, 56415). If you want to cherry-pick this change to another branch, please follow the instructions here. |
@@ -88,5 +88,5 @@ func tlsConfigKey(c *Config) (string, error) { | |||
return "", err | |||
} | |||
// Only include the things that actually affect the tls.Config | |||
return fmt.Sprintf("%v/%x/%x/%x", c.TLS.Insecure, c.TLS.CAData, c.TLS.CertData, c.TLS.KeyData), nil | |||
return fmt.Sprintf("%v/%x/%x/%x/%v", c.TLS.Insecure, c.TLS.CAData, c.TLS.CertData, c.TLS.KeyData, c.TLS.ServerName), nil |
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.
Uh, are we printing very sensitive key data into the cache key? That seems like a terrible idea, doesn't 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.
It's safer to put things into a key struct, that way you don't have to worry about collisions (things maybe having /
in them that shouldn't, say).
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.
Uh, are we printing very sensitive key data into the cache key? That seems like a terrible idea, doesn't it?
If you have memory access to the cache keys, you also have it to the cache data, which has the same information in a different form
It's safer to put things into a key struct, that way you don't have to worry about collisions (things maybe having / in them that shouldn't, say).
/
isn't an issue in this particular case with the current data (%x
hex-encodes, and the first value is a bool), but agree a key struct would be better 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.
If you have memory access to the cache keys, you also have it to the cache data, which has the same information in a different form
I can easily see someone printing the keys to a debug log or something, which is readable by more people than they expect. People don't usually expect cache keys to be super sensitive.
I agree the separator is likely not an actual bug in this particular case, but if you use the struct approach everywhere you prevent an entire class of really hard to find bugs, some of which are serious security problems.
I will likely file an issue about these items.
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.
fair enough. opened #56811 to switch to struct key with its own String() impl that omits logging the key data
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!
Fixes #56385