fix(plugin-redis)!: full SSL refactor with typed SSLConfiguration across plugin boundary (#1247)#1248
Merged
Merged
Conversation
…onfig and bump PluginKit ABI to v12
…ype, add per-plugin SSL tests
…dblib ignores them
…erify for Verify Identity
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.
Closes #1247.
Full refactor of the plugin SSL surface. Fixes the user-reported bug (Redis "Required (skip verify)" never actually skipped verification) plus three sibling bugs in the same code path, and replaces the stringly-typed dictionary at the plugin boundary with a typed
SSLConfiguration.Root cause
RedisSSLConfigreadverifyPeerfromadditionalFields["sslVerifyPeer"]with a fallback of"true". The app core never wrote that key, so the fallback always won and every SSL mode performed verification.But the real anti-pattern is the boundary itself:
PluginDatabaseDriver.connect()receivedadditionalFields: [String: String]and every plugin parsed the SSL strings differently. Six plugins, four working approaches, one broken (Redis), one missing TLS entirely (MSSQL). No compiler help, no shared semantics.Refactor scope
Typed SSLConfiguration boundary. New
Plugins/TableProPluginKit/SSLConfiguration.swiftdefines the canonicalSSLConfigurationstruct +SSLModeenum withisEnabled,verifiesCertificate,verifiesHostnamehelpers.DriverConnectionConfigcarries it as a first-class field. The app-sideSSLConfiguration/SSLModecollapsed into typealiases of the PluginKit types so there is one canonical type; the app-side localized labels remain as an extension. PluginKit ABI bumped 11 → 12; every bundled plugin'sInfo.plistbumped.Redis ("Required (skip verify)" SSL mode does not actually skip certificate verification for Redis connections #1247).
RedisSSLConfigextracted to its own file, drives directly from typedSSLMode.connectSSLmaps perhiredis_ssl.h:.disabledskips TLS;.preferred/.requiredenable TLS withREDIS_SSL_VERIFY_NONE;.verifyCa/.verifyIdentityenable TLS withREDIS_SSL_VERIFY_PEERplus CA path; SNI hostname set only for.verifyIdentity. CA path gated onverifiesCertificate, matching PostgreSQL.MSSQL TLS, fresh implementation. Previously SSL was completely absent from FreeTDS dblib setup; the connection form's SSL pane did nothing. Now
MSSQLSSLMapping.freetdsEncryptionFlag(for:)maps to FreeTDS strings and is passed viadbsetlname(login, value, DBSETENCRYPT). Documented limitation: dblib does not expose per-connection cert verification, so.verifyCa/.verifyIdentityboth map torequireand verification depends on the system trust store andfreetds.conf.MongoDB. URI builder switches on
SSLModeper libmongoc semantics..preferred/.requiredsettlsAllowInvalidCertificates=true(no TLS fallback in libmongoc, so these behave identically)..verifyCasetstlsAllowInvalidHostnames=true. CA file loaded only when verifying.mongodb+srvURIs force.requiredif user picked.disabled, per spec.PostgreSQL, MySQL, ClickHouse. Switched from
Stringparsing toSSLModeswitch. MySQL no longer loads CA file when not verifying.Tests. New
SSLConfigurationTests(7 cases, computed helpers, Codable round-trip, raw-value stability). NewRedisSSLConfigTests(6 cases, one per mode + path passthrough, regression cover for "Required (skip verify)" SSL mode does not actually skip certificate verification for Redis connections #1247). NewMSSQLSSLMappingTests(5 cases, one per mode). ObsoleteSSLModeStringTestsdeleted (it duplicated parsing logic the refactor eliminated).Docs.
docs/databases/redis.mdxanddocs/databases/mssql.mdxdocument the per-mode behavior tables. CHANGELOG entries under[Unreleased]cover Fixed ("Required (skip verify)" SSL mode does not actually skip certificate verification for Redis connections #1247, MSSQL, MongoDB, MySQL) and Changed (PluginKit ABI bump with registry-republish note).Verification
swiftlint lint --stricton every touched file is clean. Other plugins have pre-existing violations onmainthat this PR does not change.xcodebuild buildsucceeds (the two SwiftLint plugin failures in CodeEditSourceEditor/CodeEditTextView are the known headless sandbox issue, unrelated).SSLConfigurationTests(7),RedisSSLConfigTests(6),MSSQLSSLMappingTests(5),PostgresDumpServiceCommandTestsincluding SSL mapping (10).Post-merge action required
PluginKit ABI bumped to v12. Per
CLAUDE.mdpost-bump checklist, every registry plugin (MongoDB, Oracle, DuckDB, MSSQL, Cassandra, Etcd, CloudflareD1, DynamoDB, BigQuery, LibSQL) must be re-tagged with a bumped patch version andplugins.jsonupdated, otherwise users hit "Plugin was built with PluginKit version 11, but version 12 is required" on next app update. Do this before cutting the next app release.Test plan
.requiredmode still connects (verify-skip path)..verifyCastill connects (verify path)..requiredconnects against a self-signed server.dear-toad-*.upstash.io:6379) with.required (skip verify)connects..verifyCaconnects when CA is provided..requiredconnects.mongodb+srv://connects when SSL was left.disabled(auto-upgraded to.required).