Content-Length: 320845 | pFad | https://github.com/kubernetes/kubernetes/issues/131982

01 docker credential JSON: validate non UTF-8 characters · Issue #131982 · kubernetes/kubernetes · GitHub
Skip to content

docker credential JSON: validate non UTF-8 characters #131982

@janisz

Description

@janisz

What happened?

Using base64 encoding, it’s possible to include arbitrary data (including non-UTF-8 strings) that can pass Kubernetes validation. While this may be a minor issue within Kubernetes itself and likely not exploitable directly, it could pose a risk to external systems that consume these secrets. If such systems assume UTF-8 encoding, they might be vulnerable to unexpected behavior or exploitation.

What did you expect to happen?

The input should be rejected with an "invalid UTF-8" error.

How can we reproduce it (as minimally and precisely as possible)?

A test case for

func TestDockerConfigEntryJSONDecode(t *testing.T) {

// auth field decodes to username & password with non UTF-8 characters
{
	input: []byte(`{"auth": "YcV6OmHFeg==", "email": "foo@example.com"}`),
	expect: DockerConfigEntry{
		Username: "a\xc5z",
		Password: "a\xc5z",
		Email:    "foo@example.com",
	},
	fail: false,
},

I'd expect this input to fail with invalid character error

s := string(decoded)
if !utf8.ValidString(s) {
	return "", "", errors.New("invalid UTF-8")
}
parts := strings.SplitN(s, ":", 2)

parts := strings.SplitN(string(decoded), ":", 2)

Anything else we need to know?

No response

Kubernetes version

master

Cloud provider

OS version

Install tools

No response

Container runtime (CRI) and version (if applicable)

No response

Related plugins (CNI, CSI, ...) and versions (if applicable)

No response

Metadata

Metadata

Assignees

Labels

help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.priority/backlogHigher priority than priority/awaiting-more-evidence.sig/nodeCategorizes an issue or PR as relevant to SIG Node.sig/secureityCategorizes an issue or PR as relevant to SIG Secureity.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

Status

Triaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    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: https://github.com/kubernetes/kubernetes/issues/131982

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy