fix(basic-auth): split credentials on the first colon only - #13836
Open
Arjen10 wants to merge 6 commits into
Open
fix(basic-auth): split credentials on the first colon only#13836Arjen10 wants to merge 6 commits into
Arjen10 wants to merge 6 commits into
Conversation
RFC 7617 treats everything after the first ':' as the password. ngx.re.split on all colons truncated passwords that contained ':'.
nic-6443
previously approved these changes
Aug 26, 2026
membphis
previously approved these changes
Aug 26, 2026
AlinsRan
previously approved these changes
Aug 26, 2026
5 tasks
waterWang
added a commit
to waterWang/apisix
that referenced
this pull request
Aug 26, 2026
RFC 8265 section 4.1 requires the OpaqueString password profile to be
non-zero-length. The consumer schema currently declares `password` as plain
`{ type = "string" }` with no minLength, so the Admin API accepts a consumer
whose password is an empty string. Such a consumer authenticates, appearing
protected while effectively having no secret. Once apache#13836 lands (split on the
first colon per RFC 7617), `user:` would also return 200 for an empty-password
consumer.
Fix:
- add `minLength = 1` to `consumer_schema.password` so the Admin API rejects
empty passwords on consumer create/update
- fail closed in `find_consumer` when either the presented or the resolved
password is empty, covering legacy empty-password consumers and
`$secret://` / `$ENV://` references that resolve to ""
Regression tests: consumer schema rejects empty password, Admin API rejects
empty consumer password, empty/whitespace-only passwords in the
Authorization header return 401.
Closes apache#13881
Contributor
|
@Arjen10 could u please resolve the merge conflicts, thanks |
# Conflicts: # t/plugin/basic-auth.t
Contributor
Author
done |
nic-6443
previously approved these changes
Aug 28, 2026
AlinsRan
previously approved these changes
Aug 28, 2026
Contributor
|
@Arjen10 please fix CI |
Contributor
Author
ok,i will fix it this weekend |
Contributor
Author
|
@janiussyafiq TEST 37–39 set consumer foo's password to $env://BASIC_AUTH_EMPTY_PASSWORD and declare the empty env in nginx main_config. i tested it successfully in my local docker env. |
Contributor
Author
|
@juzhiyuan please restart github CI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
RFC 7617 treats everything after the first ':' as the password. ngx.re.split on all colons truncated passwords that contained ':'.
Align with the implementation of ldap-auth-advanced
Which issue(s) this PR fixes:
Fixes #13835
Checklist