Skip to content

branch-4.1: [fix](fe) Handle padded OIDC JDBC authentication payloads - #69714

Merged
yiguolei merged 1 commit into
apache:branch-4.1from
CalvinKirs:fix-oidc-jdbc-padding-branch-4.1
Oct 30, 2026
Merged

yiguolei merged 1 commit into
apache:branch-4.1from
CalvinKirs:fix-oidc-jdbc-padding-branch-4.1

Conversation

@CalvinKirs

Copy link
Copy Markdown
Member

What problem does this PR solve?

Related PR: #63068

MySQL Connector/J can send an authentication_openid_connect_client payload containing the capability byte, a length-encoded JWT, and trailing zero padding. On branch-4.1, MysqlAuthPacketCredentialExtractor requires that no bytes remain after the token. It therefore passes the entire encoded payload to the authentication plugin and a valid token fails with OIDC access token signature validation failed.

Extract the padding fix already included in master by #63068 into a standalone branch-4.1 change. Accept trailing zero bytes while preserving the existing handling of non-zero trailing data. Add coverage for a token longer than 255 bytes with the six padding bytes produced by Connector/J, and for a non-zero byte following zero padding.

Release note

Fix OIDC JDBC login failures caused by trailing zero padding in MySQL Connector/J authentication payloads.

Check List (For Author)

  • Test:
    • Unit Test: 57 MySQL protocol/authentication tests passed, with zero failures/errors/skips. The new padding test fails before the fix. FE core Checkstyle: zero violations.
    • Regression test
    • Manual test: 12/12 checks passed against the FE built from this branch, a 4.1.3 BE, and the existing Keycloak fixture with the stock OIDC plugin.
      • Unmodified Connector/J 9.4.0 and 9.6.0: OIDC login over TLS 1.3 and two consecutive queries on the same connection succeeded.
      • A token file ending in a newline also succeeded with Connector/J 9.6.0.
      • Invalid signatures (both drivers), a mismatched username, disabled TLS, and a missing token were rejected.
      • Native password login with Connector/J 8.4.0/9.6.0 and MySQL Shell 9.5 valid/invalid token checks passed.
    • FE compiled and packaged using build.sh --fe with UI disabled. For local packaging only, the BE/Cloud native dependency bootstrap was scoped to BE/Cloud because this host lacks Paimon native artifacts; the build script was restored and is not part of this PR.
  • Behavior changed:
    • Yes. OIDC JDBC payloads with zero padding now yield the original token; non-zero trailing data is not discarded.
  • Does this need documentation?
    • No.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### What problem does this PR solve?

Issue Number: N/A

Related PR: apache#63068

Problem Summary: MySQL Connector/J can append zero padding after a
length-encoded OIDC JWT. branch-4.1 requires no remaining bytes and
passes the complete encoded payload to JWT validation, rejecting valid
credentials. Backport the master zero-padding check as a standalone fix,
with tests for a long token and non-zero trailing data.

### Release note

Fix OIDC JDBC login failures caused by trailing zero padding in MySQL
Connector/J authentication payloads.

### Check List (For Author)

- Test: Unit Test. 57 related tests pass; the new padding test fails
  before the fix. FE core Checkstyle reports zero violations.
- Behavior changed: Yes. Accept zero padding after the OIDC token;
  preserve existing handling of non-zero trailing data.
- Does this need documentation: No.
@CalvinKirs
CalvinKirs requested a review from yiguolei as a code owner October 28, 2026 02:10
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@CalvinKirs

Copy link
Copy Markdown
Member Author

run buildall

@CalvinKirs CalvinKirs changed the title [fix](fe) Handle padded OIDC JDBC authentication payloads branch-4.1: [fix](fe) Handle padded OIDC JDBC authentication payloads Oct 28, 2026
@CalvinKirs CalvinKirs added the usercase Important user case type label label Oct 28, 2026
@CalvinKirs

Copy link
Copy Markdown
Member Author

run feut

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/6) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 66.67% (4/6) 🎉
Increment coverage report
Complete coverage report

@CalvinKirs

Copy link
Copy Markdown
Member Author

run feut

@yiguolei
yiguolei merged commit cfc2e40 into apache:branch-4.1 Oct 30, 2026
36 of 37 checks passed
@CalvinKirs
CalvinKirs deleted the fix-oidc-jdbc-padding-branch-4.1 branch October 30, 2026 07:42
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Oct 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed usercase Important user case type label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants