Content-Length: 319921 | pFad | http://github.com/kubernetes/kubernetes/pull/132104/files

F3 docker credential JSON: validate non UTF-8 auth by janisz · Pull Request #132104 · kubernetes/kubernetes · GitHub
Skip to content

docker credential JSON: validate non UTF-8 auth #132104

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/credentialprovider/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"path/filepath"
"strings"
"sync"
"unicode/utf8"

"k8s.io/klog/v2"
)
Expand Down Expand Up @@ -299,8 +300,11 @@ func decodeDockerConfigFieldAuth(field string) (username, password string, err e
if err != nil {
return
}

parts := strings.SplitN(string(decoded), ":", 2)
decodedStr := string(decoded)
if !utf8.ValidString(decodedStr) {
return "", "", errors.New("unable to parse auth field, must be valid UTF-8")
}
parts := strings.SplitN(decodedStr, ":", 2)
if len(parts) != 2 {
err = fmt.Errorf("unable to parse auth field, must be formatted as base64(username:password)")
return
Expand Down
6 changes: 6 additions & 0 deletions pkg/credentialprovider/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ func TestDecodeDockerConfigFieldAuth(t *testing.T) {
password: "bar",
},

// non UTF-8 character
{
input: encodeDockerConfigFieldAuth("foo", "a\xc5z"),
fail: true,
},

// good base64 data, but no colon separating username & password
{
input: "cGFudHM=",
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/kubernetes/kubernetes/pull/132104/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy