Skip to content
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

x/text/secure/precis: UsernameCaseMapped and UsernameCasePreserved should disallow empty usernames #64531

Open
mitar opened this issue Dec 4, 2023 · 0 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mitar
Copy link
Contributor

mitar commented Dec 4, 2023

Go version

go version go1.21.3 linux/amd64

What operating system and processor architecture are you using (go env)?

```shell GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/home/mitar/.cache/go-build' GOENV='/home/mitar/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/mitar/.go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/home/mitar/.go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.21.3' GCCGO='/usr/bin/gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/dev/null' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3082737491=/tmp/go-build -gno-record-gcc-switches' ```

What did you do?

Ran precis.UsernameCaseMapped.String("").

What did you expect to see?

An error returned as written in RFC 8265:

A username MUST NOT be zero bytes in length. This rule is to be enforced after any normalization and mapping of code points.

It seems DisallowEmpty option should be added to UsernameCaseMapped and UsernameCasePreserved. It is already added to Nickname and OpaqueString.

What did you see instead?

No error returned.

@bcmills bcmills changed the title golang.org/x/text/secure/precis: UsernameCaseMapped and UsernameCasePreserved should disallow empty usernames x/text/secure/precis: UsernameCaseMapped and UsernameCasePreserved should disallow empty usernames Dec 4, 2023
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 4, 2023
@gopherbot gopherbot added this to the Unreleased milestone Dec 4, 2023
@bcmills bcmills modified the milestones: Unreleased, Backlog Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants