configfile: Initialize nil AuthConfigs#4418
Conversation
|
Thank you for contributing! It appears your commit message is missing a DCO sign-off, We require all commit messages to have a There is no need to open a new pull request, but to fix this (and make CI pass), Unfortunately, it's not possible to do so through GitHub's web UI, so this needs You can find some instructions in the output of the DCO check (which can be found Steps to do so "roughly" come down to:
Sorry for the hassle (I wish GitHub would make this a bit easier to do), and let me know if you need help or more detailed instructions! |
vvoland
left a comment
There was a problem hiding this comment.
Thank you for the contribution!
In addition to the missing DCO, I have one suggestion.
| if authConfigs == nil { | ||
| authConfigs = make(map[string]types.AuthConfig) | ||
| } |
There was a problem hiding this comment.
This won't save the auth in the ConfigFile because we create a completely new map here.
Instead of doing the nil check on caller side, we need to solve this issue in the GetAuthConfigs directly:
cli/cli/config/configfile/file.go
Lines 95 to 98 in df04aca
This way we also won't have to do the nil check in all the places GetAuthConfigs is called (there are currently no other places which break with nil value though).
fd814b8 to
9a4552d
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #4418 +/- ##
==========================================
+ Coverage 58.97% 59.40% +0.43%
==========================================
Files 286 288 +2
Lines 24771 24780 +9
==========================================
+ Hits 14608 14721 +113
+ Misses 9276 9173 -103
+ Partials 887 886 -1 |
Initialize AuthConfigs map if it's nil before returning it. This fixes fileStore.Store nil dereference panic when adding a new key to the map. Signed-off-by: Danial Gharib <danial.mail.gh@gmail.com> Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
9a4552d to
ad43df5
Compare
vvoland
left a comment
There was a problem hiding this comment.
I went ahead and applied my suggestion as we'd like to get this in for the next patch release.
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
we should look at some of the follow-ups as well, but this fixes the immediate issue
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)