fix: basic auth scheme supports case insensitivity#12539
Merged
Baoyuantop merged 9 commits intoAug 27, 2025
Conversation
SkyeYoung
requested review from
Baoyuantop,
Revolyssup,
bzp2010,
Copilot,
membphis and
nic-6443
August 21, 2025 06:34
There was a problem hiding this comment.
Pull Request Overview
This PR implements case-insensitive parsing for the "Basic" authentication scheme in HTTP Authorization headers, in compliance with RFC 7235, RFC 9110, and RFC 5234. The authentication scheme parsing now accepts various case combinations like "basic", "BASIC", "Basic", or "bASiC".
- Replaced regex-based parsing with string splitting and case-insensitive comparison
- Updated error messages for consistency
- Added comprehensive test coverage for different case variations of the Basic auth scheme
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apisix/plugins/basic-auth.lua | Reimplemented auth header parsing with case-insensitive scheme detection |
| apisix/plugins/ldap-auth.lua | Applied same case-insensitive parsing logic for consistency |
| t/plugin/basic-auth.t | Added test cases for lowercase, uppercase, and mixed case auth schemes |
| t/plugin/ldap-auth.t | Added test cases for lowercase, uppercase, and mixed case auth schemes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
bzp2010
reviewed
Aug 21, 2025
Member
|
Totally agree with @bzp2010 |
…uth-case-insensitive
membphis
approved these changes
Aug 26, 2025
Baoyuantop
approved these changes
Aug 27, 2025
jizhuozhi
pushed a commit
to jizhuozhi/apisix
that referenced
this pull request
Oct 18, 2025
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
The parsing part is reimplemented with reference to the following rfcs:
It should be noted that the original Http header field name part can handle case-insensitivity, so this PR focuses on processing the Http header field value part.
Which issue(s) this PR fixes:
Fixes #11837
Checklist