Skip to content

Mobile drops mutual-TLS client certificates on MySQL and PostgreSQL #2083

Closed

Description

@datlechin

What happens

The mobile MySQL and PostgreSQL drivers never send the client certificate or private key, so a connection configured for mutual TLS connects without a client identity. The macOS plugins send both.

Driver macOS Mobile
MySQL / MariaDB MYSQL_OPT_SSL_CA, MYSQL_OPT_SSL_CERT, MYSQL_OPT_SSL_KEY (Plugins/MySQLDriverPlugin/MariaDBPluginConnection.swift:283-289) CA only (TableProMobile/TableProMobile/Drivers/MySQLDriver.swift:284)
PostgreSQL / Redshift sslrootcert, sslcert, sslkey (Plugins/PostgreSQLDriverPlugin/LibPQPluginConnection.swift:333-339) sslrootcert only (TableProMobile/TableProMobile/Drivers/PostgreSQLDriver.swift:346)

Neither mobile driver file contains any reference to clientCertificatePath or clientKeyPath.

Depending on server policy the connection either fails with a TLS or authentication error that never mentions the client certificate, or it succeeds without the identity the user configured. Both are silent about the real cause.

Why it is reachable

DriverSSLConfiguration (TableProMobile/TableProMobile/Drivers/DriverSSLConfiguration.swift) already carries clientCertificatePath and clientKeyPath end to end, and connections carrying them arrive through import and sync (TableProMobile/TableProMobile/Services/IOSConnectionImportService.swift:160-161).

Second half: there is no way to supply a certificate on iOS

There is no certificate file picker anywhere in the mobile connection form. Certificate paths only arrive from a Mac, where PathPortability.expandHome rewrites them into the iOS sandbox, so the file almost never exists on device. DriverSSLConfiguration.existingCACertificatePath checks fileExists, so even the CA path that is wired up usually resolves to nil.

Fixing the two drivers is necessary but not sufficient. Mobile needs a way to import certificate files, with a bookmark store like the one FileBookmarkStore already provides for DuckDB, or it should say plainly that the connection needs a certificate it does not have.

Suggested scope

  1. Pass client certificate and key in both mobile drivers, matching the macOS plugins.
  2. Add certificate import to the mobile connection form, backed by security-scoped bookmarks.
  3. Report a configured but missing certificate as its own error instead of connecting without it.

Related

The mobile Redis driver had the same driver-side gap. It was fixed alongside the Redis ACL username fix, which also added cert_filename and private_key_filename to the Redis TLS options.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions