[fix](auth)Fix arrow flight client ip auth#63506
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
/review |
There was a problem hiding this comment.
Reviewed PR 63506 against the Doris code-review checklist and threat model.
Critical checkpoint conclusions:
- Goal/test coverage: The PR fixes Arrow Flight SQL password authentication to use the real gRPC peer IP instead of always using 0.0.0.0. The unit test covers tracer extraction/fallback and the regression test exercises host-qualified authentication through Arrow Flight SQL.
- Scope/focus: The implementation is small and focused on FE Arrow Flight auth plus tests.
- Concurrency/lifecycle: The gRPC Context holder is per-call; no shared mutable cross-call state was introduced. The holder value is only used during call authentication and token creation.
- Configuration/compatibility: No new config, storage format, or FE-BE protocol compatibility concern.
- Parallel paths: This aligns Arrow Flight credential auth with existing MySQL-style remote-host password checks; bearer-token session creation continues to use the remote IP captured at initial credential authentication.
- Error handling: Authentication failures continue through the existing Arrow Flight UNAUTHENTICATED path.
- Observability: Existing auth failure logging remains; no additional observability appears required for this focused fix.
- Security/threat model: FE Arrow Flight is an in-scope client-facing endpoint. The change improves RBAC/auth host matching and does not add reverse-proxy header trust or broaden the boundary.
- User focus: No additional user-provided review focus was specified.
No blocking issues found.
TPC-H: Total hot run time: 31606 ms |
TPC-DS: Total hot run time: 169467 ms |
FE Regression Coverage ReportIncrement line coverage |
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: The Arrow Flight remote IP authentication regression creates host-specific users and grants only SELECT_PRIV. In cloud mode those authenticated users also need compute group usage privilege before SELECT 1 can execute.
### Release note
None
### Check List (For Author)
- Test: Manual test
- Ran `git diff --check`
- Attempted regression test with `timeout 45 ./run-regression-test.sh --run -d arrow_flight_sql_p0 -s test_auth_remote_ip`, but the local cluster failed before the Arrow Flight query because BE nodes were not alive: `No backend available as scan node`
- Behavior changed: No
- Does this need documentation: No
|
run buildall |
TPC-H: Total hot run time: 31258 ms |
TPC-DS: Total hot run time: 169080 ms |
FE UT Coverage ReportIncrement line coverage |
|
run buildall |
TPC-H: Total hot run time: 31003 ms |
TPC-DS: Total hot run time: 168666 ms |
FE Regression Coverage ReportIncrement line coverage |
|
/review |
|
OpenCode automated review failed and did not complete. Error: Review step was failure (possibly timeout or cancelled) Please inspect the workflow logs and rerun the review after the underlying issue is resolved. |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
There was a problem hiding this comment.
Review completed. I did not find a blocking issue in the live PR diff. The implementation uses a gRPC ServerStreamTracer to capture the peer address before Arrow Flight header authentication and passes that IP into Doris password/user@host matching; the token/session path then preserves the authenticated remote IP. The regression test covers fallback from the old hardcoded 0.0.0.0 behavior by creating that host entry with a wrong password and creating likely local/private remote host patterns with the valid password.\n\nCritical checkpoint conclusions:\n- Goal/test: The code addresses the stated Arrow Flight user@host auth issue and includes unit plus regression coverage.\n- Scope: The live PR is focused on Arrow Flight auth remote IP and its test.\n- Concurrency: The tracer is per stream; shared state is only a gRPC Context key with a per-call holder, so no cross-call state issue found.\n- Lifecycle/static init: No static initialization-order or special lifecycle issue found.\n- Config: No new config items.\n- Compatibility: No storage/protocol compatibility issue found; default fallback remains 0.0.0.0 when no peer address is available.\n- Parallel paths: Basic credential auth is the relevant path; bearer token/session creation consumes the captured IP through existing token details.\n- Conditional checks: Fallback handling for missing/non-INET peer address is reasonable.\n- Tests: Coverage is adequate for the changed behavior; I did not run tests in this review environment.\n- Observability: Existing auth errors/logging remain sufficient.\n- Transaction/persistence/data writes: Not applicable.\n- FE/BE variable passing: Not applicable.\n- Performance: No meaningful overhead beyond per-call tracer allocation/address extraction.\n\nThreat-model/user focus: FE Arrow Flight authentication is an in-scope client-facing auth path; no additional user-provided review focus was supplied.
## Changes In Doris 4.1.0, Arrow Flight SQL authentication may fail for users created with a specific host/IP. Example input: ```sql CREATE USER 'read_user'@'192.0.2.10' IDENTIFIED BY '12345'; GRANT SELECT_PRIV ON *.* TO 'read_user'@'192.0.2.10'; ``` Then connect through Arrow Flight SQL with the same username and password, for example by ADBC/Python or Arrow Flight JDBC. Actual wrong output: ``` UNAUTHENTICATED: [FlightSQL] Unable to authenticate user read_user, exception: errCode = 2, detailMessage = Access denied for user 'read_user@0.0.0.0' (using password: YES) ``` Expected output: ``` The user should be authenticated as the real remote client identity, for example: read_user@192.0.2.10 and the connection should succeed when the password and privileges match that user@host. ``` Root cause: Arrow Flight SQL previously used hardcoded remote IP 0.0.0.0 during username/password authentication. As a result, Doris matched the wrong user@host entry instead of using the actual client IP from the gRPC connection. This PR fixes Arrow Flight SQL authentication to use the real gRPC peer IP when validating credentials.
## Changes In Doris 4.1.0, Arrow Flight SQL authentication may fail for users created with a specific host/IP. Example input: ```sql CREATE USER 'read_user'@'192.0.2.10' IDENTIFIED BY '12345'; GRANT SELECT_PRIV ON *.* TO 'read_user'@'192.0.2.10'; ``` Then connect through Arrow Flight SQL with the same username and password, for example by ADBC/Python or Arrow Flight JDBC. Actual wrong output: ``` UNAUTHENTICATED: [FlightSQL] Unable to authenticate user read_user, exception: errCode = 2, detailMessage = Access denied for user 'read_user@0.0.0.0' (using password: YES) ``` Expected output: ``` The user should be authenticated as the real remote client identity, for example: read_user@192.0.2.10 and the connection should succeed when the password and privileges match that user@host. ``` Root cause: Arrow Flight SQL previously used hardcoded remote IP 0.0.0.0 during username/password authentication. As a result, Doris matched the wrong user@host entry instead of using the actual client IP from the gRPC connection. This PR fixes Arrow Flight SQL authentication to use the real gRPC peer IP when validating credentials.
Changes
In Doris 4.1.0, Arrow Flight SQL authentication may fail for users created with a specific host/IP.
Example input:
Then connect through Arrow Flight SQL with the same username and password, for example by ADBC/Python or Arrow Flight JDBC.
Actual wrong output:
Expected output:
Root cause:
Arrow Flight SQL previously used hardcoded remote IP 0.0.0.0 during username/password authentication. As a result, Doris matched the wrong user@host entry
instead of using the actual client IP from the gRPC connection.
This PR fixes Arrow Flight SQL authentication to use the real gRPC peer IP when validating credentials.