Skip to content

[fix](fe) Reject invalid stream load tokens on commit and rollback - #62111

Merged
liaoxin01 merged 2 commits into
apache:masterfrom
liaoxin01:fix-streamload-token-auth-master
Apr 24, 2026
Merged

liaoxin01 merged 2 commits into
apache:masterfrom
liaoxin01:fix-streamload-token-auth-master

Conversation

@liaoxin01

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Stream load commit and rollback accepted invalid tokens because the return value of checkToken() was ignored.

Release note

None

Check List (For Author)

  • Test: No completed automated test run in this environment. I attempted a FE build in a worktree and reached fe-core, but did not wait for full FE packaging to finish.
  • Behavior changed: Yes. Invalid token requests are now rejected on stream load commit and rollback.
  • Does this need documentation: No

Copilot AI review requested due to automatic review settings April 3, 2026 16:02
@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?

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 PR addresses a security/authentication correctness issue in FE stream-load transaction handling by enforcing the return value of checkToken() during commit operations.

Changes:

  • Reject invalid stream-load tokens during loadTxnCommitImpl by throwing AuthenticationException when checkToken() returns false.
  • Reject invalid tokens during commitTxnImpl with the same checkToken() return-value enforcement.

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

@liaoxin01
liaoxin01 force-pushed the fix-streamload-token-auth-master branch from bd4043b to 226c408 Compare April 3, 2026 16:14
@dataroaring

Copy link
Copy Markdown
Contributor

run buildall

@dataroaring

Copy link
Copy Markdown
Contributor

/review

@github-actions github-actions Bot 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.

Found 1 issue.

  1. fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java: the rollback RPCs still ignore the result of checkToken(). loadTxnRollbackImpl() (line 1966 in the current head) and rollbackTxnImpl() (line 2085) both continue to abortTransaction(...) even when the token is invalid, so the PR does not yet satisfy its stated goal of rejecting invalid tokens on commit and rollback.

Critical checkpoints:

  • Goal: Not fully achieved; commit paths are fixed, rollback paths remain vulnerable. No test proves both commit and rollback rejection.
  • Minimality: Small and focused change, but incompletely applied to the parallel rollback paths.
  • Concurrency: Not applicable; this patch only changes FE auth guards.
  • Lifecycle/static init: Not applicable.
  • Config: No config changes.
  • Compatibility: No protocol or storage compatibility impact.
  • Parallel code paths: Failed; equivalent rollback handlers were missed.
  • Special checks: The new explicit boolean check is the right pattern where added.
  • Test coverage: Missing coverage for invalid-token rollback and end-to-end auth rejection.
  • Observability: Existing RPC status conversion remains adequate.
  • Transaction/persistence: No EditLog or persistence changes, but auth gating for rollback is still incorrect.
  • Data writes/modifications: Unauthorized rollback is still possible with an invalid token.
  • FE-BE variable passing: No new variables.
  • Performance: Negligible impact.
  • Other issues: None beyond the missed rollback paths.

liaoxin01 added a commit to liaoxin01/doris that referenced this pull request Apr 8, 2026
### What problem does this PR solve?

Issue Number: None

Related PR: apache#62111

Problem Summary: Reject invalid tokens in stream load rollback and transaction rollback paths, avoid echoing raw tokens in AuthenticationException messages, and add unit coverage for invalid-token commit and rollback requests.

### Release note

Invalid tokens are now rejected consistently for commit and rollback requests without exposing the token value in error messages.

### Check List (For Author)

- Test: FE unit test
    - ./run-fe-ut.sh --run org.apache.doris.service.FrontendServiceImplTest#testLoadTxnCommitRejectsInvalidToken+testLoadTxnRollbackRejectsInvalidToken+testCommitTxnRejectsInvalidToken+testRollbackTxnRejectsInvalidToken
- Behavior changed: Yes (invalid tokens now fail consistently on rollback and error messages no longer expose token values)
- Does this need documentation: No
@liaoxin01

Copy link
Copy Markdown
Contributor Author

run buildall

@liaoxin01
liaoxin01 force-pushed the fix-streamload-token-auth-master branch from dc3e309 to 061a919 Compare April 10, 2026 07:54
liaoxin01 added a commit to liaoxin01/doris that referenced this pull request Apr 10, 2026
Issue Number: None

Related PR: apache#62111

Problem Summary: Reject invalid tokens in stream load rollback and transaction rollback paths, avoid echoing raw tokens in AuthenticationException messages, and add unit coverage for invalid-token commit and rollback requests.

Invalid tokens are now rejected consistently for commit and rollback requests without exposing the token value in error messages.

- Test: FE unit test
    - ./run-fe-ut.sh --run org.apache.doris.service.FrontendServiceImplTest#testLoadTxnCommitRejectsInvalidToken+testLoadTxnRollbackRejectsInvalidToken+testCommitTxnRejectsInvalidToken+testRollbackTxnRejectsInvalidToken
- Behavior changed: Yes (invalid tokens now fail consistently on rollback and error messages no longer expose token values)
- Does this need documentation: No
@liaoxin01

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 14.29% (1/7) 🎉
Increment coverage report
Complete coverage report

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Stream load commit and rollback accepted invalid tokens because the return value of checkToken() was ignored.

### Release note

None

### Check List (For Author)

- Test: No need to test (small FE auth guard change; no completed automated test run in this environment)
- Behavior changed: Yes (invalid token is now rejected for stream load commit/rollback)
- Does this need documentation: No
Issue Number: None

Related PR: apache#62111

Problem Summary: Reject invalid tokens in stream load rollback and transaction rollback paths, avoid echoing raw tokens in AuthenticationException messages, and add unit coverage for invalid-token commit and rollback requests.

Invalid tokens are now rejected consistently for commit and rollback requests without exposing the token value in error messages.

- Test: FE unit test
    - ./run-fe-ut.sh --run org.apache.doris.service.FrontendServiceImplTest#testLoadTxnCommitRejectsInvalidToken+testLoadTxnRollbackRejectsInvalidToken+testCommitTxnRejectsInvalidToken+testRollbackTxnRejectsInvalidToken
- Behavior changed: Yes (invalid tokens now fail consistently on rollback and error messages no longer expose token values)
- Does this need documentation: No
@liaoxin01
liaoxin01 force-pushed the fix-streamload-token-auth-master branch from 061a919 to 85da7e3 Compare April 17, 2026 09:59
@liaoxin01

Copy link
Copy Markdown
Contributor Author

run buildall

@liaoxin01

Copy link
Copy Markdown
Contributor Author

/review

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 14.29% (1/7) 🎉
Increment coverage report
Complete coverage report

@github-actions

Copy link
Copy Markdown
Contributor

OpenCode automated review failed and did not complete.

Error: Review step was failure (possibly timeout or cancelled)
Workflow run: https://github.com/apache/doris/actions/runs/24559402638

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@liaoxin01

Copy link
Copy Markdown
Contributor Author

/review

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

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

@github-actions

Copy link
Copy Markdown
Contributor

OpenCode automated review failed and did not complete.

Error: Review step was failure (possibly timeout or cancelled)
Workflow run: https://github.com/apache/doris/actions/runs/24563974343

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@liaoxin01

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot 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.

The token-only path is fixed, but I do not think this PR reaches its stated goal for the real commit/rollback request shapes that Doris currently sends.

Critical checkpoints:

  • Goal: Not fully achieved. loadTxnCommitImpl() / commitTxnImpl() / loadTxnRollbackImpl() / rollbackTxnImpl() only validate the token when auth_code is absent. Current BE callers still populate deprecated auth_code on these RPCs, so they continue to bypass the new check.
  • Minimality: The patch is small and focused.
  • Concurrency: No new concurrency or locking risk in this change.
  • Lifecycle / static init: Not applicable.
  • Config: No config changes.
  • Compatibility: No storage or protocol compatibility impact.
  • Parallel code paths: Incomplete. The legacy auth_code branch remains an authentication bypass for the same commit/rollback RPCs.
  • Special checks: checkTokenOrThrow() is the right local helper, but the surrounding condition still prevents it from running on current callers.
  • Test coverage: The new FE tests only exercise private *Impl methods with token-only requests. They do not cover the public RPC path or requests that still carry auth_code, so they do not prove the production callers are fixed.
  • Test result changes: Added FE unit tests; I did not rerun them locally in this review.
  • Observability: Existing logging / status propagation is sufficient.
  • Transaction / persistence: No EditLog or persistence changes.
  • Data writes / modifications: Unauthorized commit or rollback is still possible through the deprecated auth_code path.
  • FE-BE variable passing: No new variables.
  • Performance: No meaningful impact.
  • Other issues: None beyond the authentication bypass / missing coverage above.

Please either stop sending deprecated auth_code on these callers or make the FE handlers validate or reject it before treating the request as authenticated, then add coverage for the real request shape.

@liaoxin01
liaoxin01 dismissed github-actions[bot]’s stale review April 24, 2026 07:46

this is another problem, should be fixed in another pr.

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

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@liaoxin01
liaoxin01 merged commit 589a32c into apache:master Apr 24, 2026
33 checks passed
@liaoxin01
liaoxin01 deleted the fix-streamload-token-auth-master branch April 24, 2026 07:52
yiguolei pushed a commit that referenced this pull request May 9, 2026
@yiguolei yiguolei mentioned this pull request May 20, 2026
zhaorongsheng pushed a commit to zhaorongsheng/doris that referenced this pull request Jun 4, 2026
…pache#62111)

Problem Summary: Stream load commit and rollback accepted invalid tokens
because the return value of checkToken() was ignored.
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. dev/4.1.1-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants