Repository navigation
fix(connections): apply SSH profile edits and deletes to the connections that use them - #2872
Merged
Merged
Conversation
…ons that use them
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
This was referenced Sep 15, 2026
This branch was successfully deployed
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.
Foundation for reusable credential profiles (#2853), and the defects the investigation for it turned up in the same subsystem. No new feature here: this makes the profile and credential path correct so the credential profile itself can be built on it.
The defect that shaped the design
#2853 asks for credential profiles "following the reusable SSH profiles pattern". That pattern does not work the way it reads.
SSHTunnelMode.profile(id:snapshot:)freezes a wholeSSHConfigurationinto the connection when the form saves, andDatabaseManager+SSH.swiftconnects from that frozen copy. Only the secrets were ever read back from the profile. So editing a profile's host changed nothing for any connection already using it: it kept tunnelling to the old host while sending the profile's new password. Nothing in the app ever rewrote that snapshot, on this Mac or on a Mac the edit synced to.Copying that shape for credentials would have shipped a profile whose username never updates, which is exactly what the issue asks for and does not get.
So the snapshot becomes a materialized copy with a fan-out behind it.
SSHProfile.applied(to:)is the single pure transform;SSHProfileStorage.updateProfilewrites it into every linked connection,SyncCoordinator.applyRemoteSSHProfiledoes the same for an edit that arrived from another Mac, andDatabaseManager.buildEffectiveConnectionresolves against the profile directly, so the connect is right even in the window before a fan-out has run.What else was wrong here
enabled = true, a host and a username. Now the delete hands each connection that configuration and its secrets as its own inline tunnel.SyncCoordinatordropped the record and calledsaveProfilesWithoutSync, nothing else. Those keys are written and deleted in one place each, both reached only fromdeleteProfile, so nothing left could name them.saveProfilesreturnedVoidand exited early on a failed load. Create, rename and delete all closed the sheet and ranonSave, having already written the Keychain items for a profile that was never persisted. It returnsBoolnow and the editor surfaces the failure.SSHProfileStoragetookKeychainHelper.sharedconcretely rather thanAppStorageEnvironment.shared.keychain, which is the injectionConnectionStoragealready has.ConnectionFormCoordinatorhad no arm for empty-and-not-prompting, whileAuthPaneViewModelprefills the field from the Keychain. The next connect still authenticated with the old password, an encrypted export still carried it and a duplicate copied it. Same hole two lines down for the inline SSH password and key passphrase.argvwith nothing saidBackupDatabaseFlowalone.RestoreDatabaseFlowlaunches the same tool through the sameNativeDumpService.start, after an alert about overwriting data that says nothing about the command line.NativeDumpPasswordExposureis now the one owner and both flows ask.NativeDumpServiceread the Keychain directly, so a connection whose password comes from a file, a shell command, 1Password, Vault, AWS Secrets Manager or~/.pgpassdumped with an empty password against a server the app itself was connected to. The SqlPackage password-exposure warning was skipped for the same connections, by the same test.KeychainSecureStore.cleanOrphanedCredentialsdeletes everycom.TablePro.password.<uuid>whose UUID is not a locally saved connection, withkSecAttrSynchronizableAny, in the shared access group. It runs fromAppState.initbefore sync is wired, so on a fresh install the valid set is empty and it sweeps everything, and the delete propagates to the Mac that wrote it. It now returns on an empty set and only touches device-local items.The last one is also a hard constraint on the feature this unblocks: a credential profile cannot key its Keychain item
com.TablePro.password.<profileId>, because a profile id is never a connection id.The seam
ConnectionCredentialResolvernow owns the five places a password can come from, and connect,NativeDumpServiceand the SqlPackage warning all ask it the same question.DatabaseDriverFactory.resolvePassworddelegates to it;resolvedAdditionalFields(for:)is what lets a non-driver caller build the same field set.Review
Codex reviewed the working tree and returned eight findings, all real and all fixed in this branch: the delete converting a stale snapshot while handing over the current password; the restore consent above; failing open when the consent lookup throws; bypassing
mutateConnectionsand its notification; deleting secrets before the connection write that justifies them; ignoring a failed unlink during a remote delete; treating an unreadable keychain as "no secret" while deleting the source; and swallowing the resolver's error into a misleading authentication failure.Skill(security-review)then found nothing at confidence 8 or above. It confirmedConnectionCredentialResolver.resolvePasswordis byte-for-byte the original including thestoreIsTrustedgate ahead ofPasswordSourceResolver.resolve, that the new callers cannot reach.command(shell:)around it, and that no added log line or user-facing string carries a secret. Its one sub-threshold note, copied secrets left behind when a conversion fails, is fixed too.Verification
verify.sh buildPASSverify.sh teston the four new suites: 32 cases, 32 passedverify.sh teston the neighbouring suites that own the changed typesverify.sh lint TablePro TableProTests TableProMobileverify.sh docsNew tests:
SSHProfileAppliedTests(the pure transform: refresh, preserved remote-file fields, other profiles and inline tunnels left alone),SSHProfileStorageTests(fan-out, unlink on delete, secret adoption, tombstone ordering, failure propagation),StoredSecretStateTestsandClearedSecretSaveTests(the tri-state, including that a locked or cancelled Keychain never causes a delete).SSHProfileStoragehad no test suite at all before this.No UI automation: every flow here is a storage or resolution path with no new control. The SSH profile editor's failure banner is the one visible change and it needs an unwritable defaults suite to appear, which XCUITest cannot arrange against the app under test.
Not in this PR
The credential profile itself, its Settings pane and the shared picker (PR 2), and sync, export/import and iOS (PR 3).