Skip to content

fix(sync): an open editor's read secrets go only where the library still points - #4835

Merged
datlechin merged 2 commits into
mainfrom
fix/editor-secret-provenance
Dec 2, 2026
Merged

datlechin merged 2 commits into
mainfrom
fix/editor-secret-provenance

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • The connection editor notes a DialedSecrets.Reading for each secret a connect checks when it reads it: the library's destination for the connection through its profiles, the connection and profiles it names, and the landing count.
  • Test Connection treats a read value as missing once the library points the connection elsewhere or a secret of it or its profiles landed since. It checks when it starts and again right before testConnection pins the SSH profile, with no suspension in between, and takes back a staged copy that moved.
  • Missing, not read again: Test dials the record the editor loaded, so a secret read again for the new destination would go to the old one. Matches the connect path and core ADR 0114.
  • Save never writes a value read from the connection's own item back to it, a retry after a failed write included. Before, a retry wrote every read value back, which could restore a password a pull took out.
  • An SSH secret read from the linked profile goes to the connection's own items on a switch to Inline only while its reading holds.
  • A field the person changes drops its reading for good, so a typed value goes where the editor points, the read one typed again included.
  • A read value keeps going after the person edits or deletes the linked SSH profile from this editor, unless a secret landed since.
  • readBackLandings and landed(since:for:) become readLandingsBack, reading(for:), landed(since:) and holds(_:).
  • Core ADR 0116, amending 0114, records the editor rule and keeps the published SSH route out of the Mac's check: the Mac dials through its own ~/.ssh/config, never another device's route; a pulled route change still reaches it as a landing; and the Mac records its own route mid-connect, so the route in the comparison would drop its own password.

Test plan

  • New, failing on main: ConnectionEditorStoreSecretStateTests.testDropsAPasswordReadBeforeTheProfileMoved, testDropsAPasswordReadBeforeALanding, retriedSaveKeepsAPulledRemoval.
  • New: testUsesTheReadPassword, testSendsAPasswordTypedAfterTheMove, testSendsTheReadPasswordTypedAgain, moveWhileTestPreparesWithdrawsTheReadPassword, profileEditedHereKeepsTheReadPassword, profileDeletedHereKeepsTheReadPassword, retriedSaveWritesNoReadPasswordBack.
  • New: DialedSecretsTests.readingHoldsUntilTheLibraryMoves, readingWithAnUnreadLandingWaitsForTheReadBack, deletedConnectionHoldsNoReading. landingAfterTheReadBackIsSeen moves to the new API, same behavior.
  • verify.sh --jobs 4 test passes on every suite fix(sync): a Mac connect uses a stored secret only where the library still points #4824's test plan lists (DialedSecretsTests, DriverOpenSecretReadTests, the ConnectionEditorStore suites, KeychainSyncedSecretsTests, KeychainSyncedConnectionSecretsTests, CoreLibraryStoreTests, SessionRecoveryLoopTests, SessionLanesTests, DatabaseManagerTunnelTests, CredentialLeaseRoutingTests, LocalCredentialConsentTests, ConnectionWarningTests, DatabaseManagerRDSEndpointTests, CloudSQLIAMAuthTests, GlobalStateSuites/EnvVarReferenceConsentTests, the NativeDump, SchemaRegistry and MetadataConnectionPool suites, SyncPassFollowerTests, CredentialProfileStorageTests) plus SecretWritePlanTests, ConnectionEditorEngineEditsTests and SSHProfileStorageTests: 671 cases. The ConnectionEditorStore suites ran again after the review fixes: 153 of 153.
  • verify.sh build and lint on each changed Swift file pass.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant