Repository navigation
fix(plugin-trino): turn on TLS for port 443, refuse plaintext credentials, fix mutual TLS and URL import TLS - #3168
Merged
datlechin merged 6 commits intoSep 28, 2026
Conversation
…e on 443 and 8443
This was referenced Sep 28, 2026
Signed-off-by: Ngô Quốc Đạt <[email protected]>
…tual TLS, and harden URL import TLS
4 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3166.
This PR started as a Network-tab warning for Trino on port 443 (thanks @J2TeamNNL for the first pass). Review found the warning left the cause in place and pointed at a mode the form refused to save, so the branch now carries the fix itself, plus the TLS defects the investigation turned up next to it.
Root cause
TablePro picked the SSL mode from the database type alone. A Trino connection typed as
host:443kept SSL Disabled, and the driver senthttp://host:443/v1/statementto an HTTPS listener, which nginx answers with400 The plain HTTP request was sent to HTTPS port. Every Trino client does the opposite: the JDBC driver (TrinoUri.isSecureConnection: schemetrinoand port443), the CLI (port == 443 ? "https" : "http") and trino-python-client all switch to HTTPS on 443 and verify the certificate against the platform trust store. That is why the reporter's DBeaver connection works.The ways out were broken too. Verify Identity could not be saved without a CA file, although Trino's transport already checks the system trust store when none is set. The modes that could be saved, Preferred and Required, skip certificate checks for Trino. And every failure reached the user as raw nginx HTML or "Query was cancelled".
What changed
Ports that mean TLS (commit 1)
tlsImpliedPorts(Trino[443]; ClickHouse[8443, 443], matching clickhouse-connect, first entry is the driver's TLS port) andverifiesServerWithSystemTrust(Trino, ClickHouse). SQL Server's hidden CA field moved to the same metadata (supportsPerConnectionCertificatePaths).SSLPaneViewModelrecords where its mode came from (type default, implied by the port, chosen). Typing a TLS port while the mode is still the default selects Verify Identity, typing another port restores the default, and a mode the user picked is never changed. Opening a stored connection never rewrites it. Under Port, a note says the port turned TLS on; a connection that is Disabled on a TLS port gets a caution and a Use Verify Identity button.SSLHandshakeError. PEM CA files work. HTML error pages read as their title.Collateral fixes (commit 2)
TrinoStatementClientis the single check; the plugin maps it to the user's words). A coordinator on plain HTTP ignores the token and trusts the user name alone, so sending it bought nothing and leaked it.POST /v1/statementinto aGETand followed it, to another host or to plain HTTP. The error now names the target and, for anhttps://redirect on the same host, the port to use.TableProTLSClientIdentitytarget:SecItemImportwith no keychain, CryptoKit for EC keys,SecIdentityCreate,URLCredential. It reads PKCS#1, PKCS#8 and SEC1 keys in PEM or DER, refuses encrypted keys with a message, and never writes to a keychain. The old paths crashed on anRSA PRIVATE KEYfile, rejected other key forms, and etcd's added each key to the login keychain for the length of the call. A server that asks for a certificate and gets none, or rejects the one sent, is told apart from a connection dropped after the server began answering (URLSessionTaskMetrics.responseStartDate).jdbc:in front of a known scheme is dropped, and JDBCuser=/password=fill the credentials when the URL carries none. Trino'sSSL=trueandSSLVerification=FULL|CA|NONE, ClickHouse JDBC'ssslmode=strict|none, andVERIFY_FULL-style spellings are read. A URL that turns TLS on and names no port opens on the driver's TLS port, and a written port is kept.openused to ignore the driver's default SSL mode, so a PostgreSQL link ran without Preferred's TLS. Both paths now resolve through oneSSLModeResolution.SSLHandshakeErrorrecovery strings named an "SSL tab" that no longer exists. They now name the Network tab, and the hostname-mismatch advice no longer suggests Verify CA, which only moves the problem.No PluginKit ABI change: only existing public symbols are used and the
SSLHandshakeErroredits are string bodies (scripts/check-pluginkit-abi.sh: unchanged). The Trino and etcd halves needplugin-trinoandplugin-etcdreleases to reach users; the form, URL import and ClickHouse changes ship with the app.Split out into their own PRs: the health monitor retrying TLS configuration failures forever (#3170), and Verify CA without a CA file on Kafka, Oracle and Teradata (#3171).
Before / After
ClickHouse, port typed as 8443 on a new connection:
Verification
verify.sh buildPASS,verify.sh plugins(AllPlugins, all 40 plugins) PASS.ConnectionURLParserTests(the full existing parser suite),ConnectionURLParserJDBCTests,ConnectionURLParserTLSPortTests,ImportedSSLModeResolutionTests(form and deep link agree on mode and port for the same URL),ConnectionURLFormatterTests,ClickHouseTLSConfigurationTests,EtcdServerTrustTests,TrinoSSLMappingTests,SSLPaneViewModelTests,ConnectionFormPortTLSTestsandDatabaseTypeTests.TableProTrinoCoreandTableProTLSClientIdentitypackages: 90 XCTest and 60 Swift Testing cases pass.TrinoMutualTLSTestsruns a realNWListenerTLS server that requires a client certificate, over TLS 1.2 and 1.3: the certificate is presented, a certificate from another CA is reported as rejected, a missing one as required, and a connection dropped mid-response as a transport failure. That last test fails with theresponseStartDatecheck removed.ConnectionFormTLSPortUITests: 4/4. Typing 8443 shows the note and selects Verify Identity, typing 8123 reverts it, and Disabled on 8443 offers Use Verify Identity.swiftlint lint --stricton every changed file: no violations on changed lines.docs/style, source and link checks clean.