Skip to content

fix: changes regex for basic auth to be case-insensitive and adds tests for mixed case prefixes - #1788

Merged
nbulaj merged 1 commit into
doorkeeper-gem:mainfrom
syngenta:fix-basic-auth-case-insensitive
Jan 26, 2026
Merged

fix: changes regex for basic auth to be case-insensitive and adds tests for mixed case prefixes#1788
nbulaj merged 1 commit into
doorkeeper-gem:mainfrom
syngenta:fix-basic-auth-case-insensitive

Conversation

@caiubi

@caiubi caiubi commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

Summary

The RFC for basic authentication specifies that the "scheme" should be matched case-insensitively, so I changed the regex and added some specs.

Other Information

N/A

@caiubi caiubi changed the title fix: changes regex for casic auth to be case-insensitive and adds tests for mixed case prefixes fix: changes regex for basic auth to be case-insensitive and adds tests for mixed case prefixes Jan 9, 2026

@nbulaj nbulaj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I checked OAuth RFC which refers HTTP Authentication RFC and it tells about case-insensitive auth token as well. So LGTM 👍

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the Basic authentication header parsing to be case-insensitive, aligning with RFC 7617 specifications. The regex pattern is modified from /^Basic (.*)/m to /^Basic (.*)/im and comprehensive test coverage is added.

Changes:

  • Modified regex pattern in from_basic method to use case-insensitive matching with the i flag
  • Added test cases for lowercase 'basic' and mixed case 'BaSiC' authentication prefixes

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/doorkeeper/oauth/client/credentials.rb Updated regex pattern to add case-insensitive flag (i) for matching the "Basic" authentication scheme
spec/lib/oauth/client/credentials_spec.rb Added two new test cases to verify case-insensitive matching works with lowercase and mixed case variations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nbulaj

nbulaj commented Jan 26, 2026

Copy link
Copy Markdown
Member

Hello @caiubi .Sorry for the delay. Can you please also add a changelog entry and squash commits then ? 🙏 Thanks!

@caiubi
caiubi force-pushed the fix-basic-auth-case-insensitive branch from a24053e to 584b26e Compare January 26, 2026 14:37
@caiubi

caiubi commented Jan 26, 2026

Copy link
Copy Markdown
Contributor Author

It's done! 😄

@nbulaj
nbulaj merged commit e4a7b6d into doorkeeper-gem:main Jan 26, 2026
20 checks passed
@nbulaj nbulaj added this to the 5.9 milestone Feb 24, 2026
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.

6 participants