[Java][FlightSQL][JDBC] Driver drops TLS for endpoint locations advertised by the server
- 主要語言
- Java
- 星號
- 94
- 分支
- 152
- 平均合併
- 3 天 16 小時
- 30 天內合併 PR
- 11
描述
When a query result has endpoints with non-empty locations, `ArrowFlightSqlClientHandler.getStreams` clones the connection's `Builder` and connects to each advertised location. The clone keeps `username`/`password`, `token` and the OAuth config, and encryption is then set from the location scheme alone:
```java
.withEncryption(endpointUri.getScheme().equals(LocationSchemes.GRPC_TLS))
```
So a location with any other scheme (`grpc+tcp://` in particular) turns encryption off for that endpoint client even when the connection was opened with `useEncryption=true`. `build()` then runs the handshake and sends the credentials over the plaintext channel to the advertised host.
The documented meaning of `useEncryption` (default `true`) is "Whether to use TLS (the default is an encrypted connection)", so a server-supplied string silently overriding it is surprising: a compromised or hostile Flight SQL server, or anything able to influence the `FlightInfo` it returns, can have the driver hand over the user's credentials in cleartext, and a passive attacker on the endpoint path can read them.
Reproduced against a handler built with `withEncryption(true)` plus a username/password, given a `FlightInfo` with one endpoint at `Location.forGrpcInsecure(...)`: the driver attempts the connection and reaches `ClientHandshakeWrapper` on the unencrypted channel instead of refusing it.
`arrow-flight-sql-jdbc-driver`, main.
貢獻指南
研究方向
從 ArrowFlightSqlClientHandler.getStreams 開始,追蹤已公布的 endpoint 位置如何設定複製的用戶端;檢查 ClientHandshakeWrapper 以了解觀察到的握手路徑。使用 withEncryption(true)、credentials 和一個不安全的 FlightInfo endpoint 重現問題,然後新增回歸測試涵蓋範圍,證明已設定的加密要求不會被靜默遺失,且 credentials 不會透過明文傳送。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- security
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 72/100