Skip to content

Conversation

@YaroSpace
Copy link
Collaborator

@YaroSpace YaroSpace commented Jan 24, 2026

Copilot AI review requested due to automatic review settings January 24, 2026 09:56
@YaroSpace YaroSpace requested a review from gorillamoe as a code owner January 24, 2026 09:56
@YaroSpace YaroSpace closed this Jan 24, 2026
@YaroSpace YaroSpace reopened this Jan 24, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

* fix: use standard Base64 encoding for OAuth2 Basic authentication

- Add base64_encode_standard() function for OAuth2 Basic auth headers
- Keep base64_encode() as URL-safe for PKCE and JWT use cases
- Update oauth.lua to use standard Base64 for Authorization: Basic headers

This fixes the OAuth2 client credentials authentication issue where kulala
was incorrectly using URL-safe Base64 encoding (+ -> -, / -> _) instead of
standard Base64 encoding as required by RFC 6749 Section 2.3.1.

Fixes authentication failures with OAuth2 providers that strictly validate
Base64 encoding in Authorization: Basic headers.

* test: add comprehensive tests for Base64 encoding fix with safe credentials

- Add unit tests for base64_encode_standard() and base64_encode() functions
- Add integration tests for OAuth2 Basic auth with safe test credentials
- Add regression test ensuring PKCE still uses URL-safe encoding

All test credentials are randomly generated safe values that produce the
required Base64 patterns (+ and / characters) without exposing real secrets.

Tests verify:
- Standard Base64 encoding for OAuth2 Basic auth (fixes "invalid_client" errors)
- URL-safe Base64 encoding still works for PKCE/JWT (no regression)
- Proper character substitutions: + vs -, / vs _, padding handling

This prevents regression of the OAuth2 client credentials authentication
bug where kulala incorrectly used URL-safe Base64 instead of standard
Base64 for Authorization: Basic headers per RFC 7617.

Co-Authored-By: Claude (claude-sonnet-4) <noreply@anthropic.com>

* fix: update OAuth Basic auth test to expect standard Base64 with padding

The existing test expected URL-safe Base64 encoding (Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ)
but the fix correctly changed OAuth2 Basic auth to use standard Base64 encoding
(Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ=) per RFC 7617.

For the test credentials "client_id:client_secret", the only difference is
padding (= character) since this string doesn't produce + or / characters.

This fixes the CI test failure caused by the Base64 encoding fix.

Co-Authored-By: Claude (claude-sonnet-4) <noreply@anthropic.com>

* fix: update OAuth tests to properly override Client Secret in private env

The test failures were caused by Client Secret values being overridden by the
private environment configuration. The update_env() function requires a second
parameter `true` to update the private environment where "Client Secret" is defined.

Changes:
- Update "Client Secret" in private environment for + character test
- Update "Client Secret" in private environment for / character test
- Keep "Client ID" and other settings in public environment

This ensures the test credentials (test:> and user123:?pass) are used instead
of the default client_secret, allowing proper testing of Base64 character handling.

Co-Authored-By: Claude (claude-sonnet-4) <noreply@anthropic.com>

* fix: remove URL encoding from OAuth2 Basic auth credentials

---------

Co-authored-by: 🚀 Niklas Arens <niklas.arens@mercedes-benz.com>
Co-authored-by: Claude (claude-sonnet-4) <noreply@anthropic.com>
Co-authored-by: Marco Kellershoff <1384938+gorillamoe@users.noreply.github.com>
@YaroSpace YaroSpace force-pushed the develop branch 2 times, most recently from 5100796 to 5ac0b77 Compare February 8, 2026 21:31
@YaroSpace YaroSpace merged commit 2778228 into main Feb 8, 2026
7 checks passed
YaroSpace added a commit that referenced this pull request Feb 8, 2026
* origin/main:
  docs: Auto-generate vimdocs + vimtags (#830)
  Weekly Updates (#819)
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.

[BUG] Errors in Kulala LSP: [Feature] Make --data-binary body size threshold configurable in copy() function

2 participants