-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
[credentialprovider] avoid potential secret leaking while reading .dockercfg #94712
Conversation
/release-note-none |
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
/milestone v1.20 |
pkg/credentialprovider/config.go
Outdated
@@ -230,17 +233,15 @@ func ReadDockerConfigFileFromURL(url string, client *http.Client, header *http.H | |||
|
|||
func readDockerConfigFileFromBytes(contents []byte) (cfg DockerConfig, err error) { | |||
if err = json.Unmarshal(contents, &cfg); err != nil { | |||
klog.Errorf("while trying to parse blob %q: %v", contents, err) | |||
return nil, err | |||
return nil, fmt.Errorf("while trying to parse blob: %v", err) |
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.
add a test to make sure this does what you want.
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.
Addressed
I think a test is in order. it's not obvious that an unmarshaller does what you want here. /lgtm cancel |
fd880d7
to
cec73ff
Compare
/approve |
There are a lot of scenarios where an invalid .dockercfg file will still contain secrets. This commit removes logging of the contents to avoid any potential leaking and manages the actual error by printing to the user the actual location of the invalid file. Signed-off-by: Nikolaos Moraitis <nmoraiti@redhat.com>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, droslean, liggitt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-kubernetes-bazel-test |
#94547 flake |
I opened cherry-picks given the potential sec impact. |
…upstream-release-1.19 Automated cherry pick of #94712: avoid potential secret leaking while reading .dockercfg
…upstream-release-1.17 Automated cherry pick of #94712: avoid potential secret leaking while reading .dockercfg
…upstream-release-1.18 Automated cherry pick of #94712: avoid potential secret leaking while reading .dockercfg
There are a lot of scenarios where an invalid .dockercfg file
will still contain secrets. This commit removes the logging of the
contents to avoid any potential leaking and manages the actual error
by printing to the user the actual location of the invalid file.
/kind design
Signed-off-by: Nikolaos Moraitis nmoraiti@redhat.com