[Java][FlightSQL][JDBC] Driver drops TLS for endpoint locations advertised by the server
- Lingua principale
- Java
- Stelle
- 94
- Fork
- 152
- Merge medio
- 3g 16h
- PR unite (30g)
- 11
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da ArrowFlightSqlClientHandler.getStreams e segui il modo in cui le posizioni degli endpoint pubblicizzati configurano i client clonati; ispeziona ClientHandshakeWrapper per il percorso di handshake osservato. Riproduci il problema con withEncryption(true), credentials e un endpoint FlightInfo non sicuro, quindi aggiungi una copertura di regressione che dimostri che il requisito di crittografia configurato non viene perso silenziosamente e che credentials non vengono inviati in testo non cifrato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- security
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 72/100