File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -186,17 +186,28 @@ func newImageRegistrySecretFromDockerConfigBytes(in []byte) (ImageRegistrySecret
186
186
return nil , fmt .Errorf ("empty dockerconfig bytes" )
187
187
}
188
188
189
+ // Check if the input is just the JSON null literal
190
+ if bytes .TrimSpace (in ) != nil && string (bytes .TrimSpace (in )) == "null" {
191
+ return nil , fmt .Errorf ("dockerconfig bytes contain JSON null" )
192
+ }
193
+
189
194
errs := []error {}
190
195
191
196
cfg , err := decodeDockerConfigJSONBytes (in )
192
197
if err == nil {
198
+ if cfg == nil {
199
+ return nil , fmt .Errorf ("decoded DockerConfigJSONBytes is nil" )
200
+ }
193
201
return & imageRegistrySecretImpl {cfg : * cfg , isLegacyStyle : false }, nil
194
202
}
195
203
196
204
errs = append (errs , err )
197
205
198
206
auths , err := decodeDockercfgBytes (in )
199
207
if err == nil {
208
+ if auths == nil {
209
+ return nil , fmt .Errorf ("decoded DockercfgBytes is nil" )
210
+ }
200
211
return & imageRegistrySecretImpl {cfg : DockerConfigJSON {Auths : * auths }, isLegacyStyle : true }, nil
201
212
}
202
213
You can’t perform that action at this time.
0 commit comments