Skip to content

Reject duplicate basic auth usernames within a server#60

Merged
dgellow merged 2 commits into
mainfrom
sam/serviceauth-username-uniqueness
Apr 29, 2026
Merged

Reject duplicate basic auth usernames within a server#60
dgellow merged 2 commits into
mainfrom
sam/serviceauth-username-uniqueness

Conversation

@dgellow
Copy link
Copy Markdown
Contributor

@dgellow dgellow commented Apr 29, 2026

The middleware matches basic auth by username and short-circuits on the first hit, so two entries with the same username silently shadowed each other regardless of the name field. Reject at config load.

The middleware matches basic auth by username and short-circuits on the
first hit, so two entries with the same username silently shadowed each
other regardless of the `name` field. Reject at config load.
@dgellow dgellow enabled auto-merge (squash) April 29, 2026 16:55
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements validation to ensure that basic authentication usernames are unique within a server's service authorizations. Changes include updates to the JSON unmarshaling logic and the validation suite to detect duplicate usernames, along with a new test case to verify this behavior. The review feedback suggests optimizing the performance of the newly added maps by providing size hints during initialization.

Comment thread internal/config/unmarshal.go Outdated
Comment thread internal/config/validation.go Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@dgellow dgellow merged commit a6f59b1 into main Apr 29, 2026
2 checks passed
@dgellow dgellow deleted the sam/serviceauth-username-uniqueness branch April 29, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant