mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 09:33:52 +00:00
fix: padded base64 encoded docker auth field
base64 allows usage of new line characters and some tools use them. As a result, the length of the encoded string cannot be used to determine whether it's padded or not. This patch fixes the regression after #82148.
This commit is contained in:
@@ -287,8 +287,7 @@ func decodeDockerConfigFieldAuth(field string) (username, password string, err e
|
||||
|
||||
// StdEncoding can only decode padded string
|
||||
// RawStdEncoding can only decode unpadded string
|
||||
// a string is correctly padded if and only if its length is a multiple of 4
|
||||
if (len(field) % 4) == 0 {
|
||||
if strings.HasSuffix(strings.TrimSpace(field), "=") {
|
||||
// decode padded data
|
||||
decoded, err = base64.StdEncoding.DecodeString(field)
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user