feat(plugin-mssql): add Windows Authentication (Kerberos) on macOS#1890
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 579fd045ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fieldId: MSSQLConnectionOptions.AdditionalFieldKey.authMethod, | ||
| values: ["windows"] | ||
| ) | ||
| ).withHidesUsername(true), |
There was a problem hiding this comment.
Gate MSSQL plugin on the new PluginKit API
When the registry publishes this MSSQL plugin, older TablePro builds whose currentPluginKitVersion is still 18 will pass the bundle compatibility check because Plugins/MSSQLDriverPlugin/Info.plist still only declares TableProPluginKitVersion 18, but this static metadata now calls the newly added ConnectionField.withHidesUsername symbol. Those older hosts do not have that symbol in their bundled TableProPluginKit, so activating the 1.1 plugin can fail before users get a clean compatibility error. Please bump the plugin compatibility or add a TableProMinAppVersion for the first app version that contains this API.
Useful? React with 👍 / 👎.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Windows Authentication (Kerberos) for SQL Server
Closes #1879.
Adds Windows Authentication (Kerberos) to the SQL Server driver on macOS. On macOS, "Windows Authentication" for SQL Server means Kerberos (ticket-based); NTLM/SSPI is Windows-only, so this is the path Azure Data Studio, DataGrip, and DBeaver all use.
What it does
The connection form gains an Authentication picker: SQL Server Authentication (unchanged default) or Windows Authentication (Kerberos). When Kerberos is selected:
user@REALM.COM) and a Keychain-backed Password.kinitticket (single sign-on) via FreeTDS'sGSS_C_NO_CREDENTIALpath. This is the default and what most macOS users want.gss_aapl_initial_cred, write it to a private ccache, pointKRB5CCNAMEat it for the connect, then release it.How it works
MSSQLConnectionOptions.initblanks the username and password wheneverauthMethod == .windows, at the single choke point both the macOS plugin and iOS share, so a synced or imported connection can't leak a stale SQL username into the GSS path.KRB5CCNAME, soMSSQLKerberosConnectGateserializes all Windows-auth connects behind a shared async lock and restores the previous value after each connect. All GSS code is macOS-only and isolated in the plugin.ConnectionFieldgains ahidesUsernameflag (mirroringhidesPassword) as a builder-set property, so the public initializer is unchanged. The ABI check confirms this is additive, so nocurrentPluginKitVersionbump.PluginMetadataRegistry+RegistryDefaults.swift, not by the installed bundle. The three fields (Authentication dropdown, Kerberos Principal, Kerberos Password) are declared both there and inMSSQLPlugin.swift, and the two declarations must stay in sync. That is why the picker shows in the form even before the 1.1.0 plugin is installed, while the plugin bundle supplies the connect-time GSS behavior.Build and release (required for the feature to work at runtime)
The bundled FreeTDS was built without GSSAPI, so this is dormant until the static library is rebuilt.
scripts/build-freetds.shnow passes--enable-krb5to the macOS slices (iOS stays krb5-free) and emits the flat committed archives the plugin links. The pbxproj change (the only binary-diff file) adds-framework GSSto the MSSQL plugin target'sOTHER_LDFLAGSin both Debug and Release, and bumps itsMARKETING_VERSIONto 1.1. The two new plugin sources (MSSQLKerberosConnectGate.swift,MSSQLKerberosCredentials.swift) are picked up by the target's filesystem-synchronized group, so they need no pbxproj entry.The iOS xcframework is unchanged, so no iOS re-upload.
Testing
Verified locally:
MSSQLConnectionOptionsAuthMethodTests(Windows blanks credentials, SQL passes them through,authMethod(from:)parsing),MSSQLKerberosClassifierTests(one per failure kind), aUsernameHidingTestssuite, an empty-username case inMSSQLLoginParametersTests, and a deterministic iOSMSSQLDriverWindowsAuthTests(rejection before any network).--strict: clean. PluginKit ABI check: additive only.GSS.framework.Not covered by automated tests (needs a real environment):
TableProUITestscase was added for the Authentication picker and field hiding: the flow depends on live plugin metadata and a real Kerberos server, so it isn't deterministic in UI automation. The field-hiding logic is covered by theUsernameHidingTestsunit suite instead.Known limitation (follow-up)
FreeTDSConnection.connect()still has no cancellation path. BecauseMSSQLKerberosConnectGateserializes all Windows-auth connects through one shared lock held across the whole connect, a connect stalled on an unreachable KDC can make Cancel unresponsive up to the login timeout and blocks every other Windows-auth connection attempt until then, not just its own tab. Fixing that properly needs a FreeTDS fork, so it is tracked separately in #1889 rather than bundled here.Docs and changelog
Updated
docs/databases/mssql.mdx(new Windows Authentication section, troubleshooting, revised limitations) and added a changelog entry.