Repository navigation
feat(core): SSH and credential profiles go through the checked library write - #4633
Merged
Merged
Conversation
…-library-write # Conflicts: # apple/TableProMobile/TableProMobile/CoreStore/CoreLibraryStore.swift # apple/TableProMobile/TableProMobileTests/CoreStore/CoreLibraryStoreTests.swift # core/crates/ffi/src/library.rs # core/crates/ffi/src/library_contents.rs # core/crates/ffi/tests/library_details.rs # core/crates/storage/src/connections/library/mod.rs # core/crates/storage/src/connections/store_tests.rs # core/crates/storage/src/lib.rs
…letions for one with it
…thread, without block_on
…-library-write # Conflicts: # windows/src/TablePro.Interop/Generated/tablepro_ffi.cs
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.
Summary
Core storage
LibraryWritecarriesssh_profilesandcredential_profilesbesideprojects, so all ofconnections.jsongoes throughreplace_library_blockingand its digest check in one commit.removing.removingnow covers profiles too.storage.repeated_id:removingid the file holds as two kinds.rebuild_library_blockingkeeps the profiles it names.save_ssh_profile_blocking,delete_ssh_profile_blocking,save_credential_profile_blockinganddelete_credential_profile_blockingare gone.Secrets of what a write takes out (outbox)
replace_library_blocking(over, build, delete)lists insecrets_to_deleteeach SSH or credential profile it takes out and each connectionremovingnames (SecretOwner { kind, id }). It does this in the same file write as the change.deletefor each listed owner whose id the file no longer holds for that kind;rebuild_library_blockingdrops the list unhonoured, so a rebuild can leave those secrets behind.replace_librarydeleted the connection secrets of everyremovingid before the write. Now they go after the write lands, and only for ids the file held as connections. A refused write deletes nothing.FFI
LibraryContentsgainsssh_profiles,credential_profilesandunreadable_profiles.LibraryWriteRecordgainsssh_profilesandcredential_profiles. Keys a newer build stored in a profile stay from the stored entry.ssh_profiles,save_ssh_profile,delete_ssh_profile,credential_profiles,save_credential_profileanddelete_credential_profileare removed. No app called them.HostSecrets.delete_profile(profile_id, kind: ProfileKindTag) -> SecretDeletionTag. The write calls the host's deletes through an internalSecretDeleter, on the blocking thread it runs on.NotOwnedis the answer for secrets another app keeps. Both answers clear the entry, and an error keeps it listed.delete_connectionanddelete_profilerun while the library's lock is held, so a host must not call the library from them.ssh-profile/orcredential-profile/, never a connection's.iOS
CoreLibraryStorepasses back the profiles it read in every write.SSHProfileSecretKindareretrievecalls;IOSSyncCoordinator.readableRecordTypeshas no profile type;supportsCredentialProfiles: false.deleteProfilewith.notOwned. A profile a pull takes out leaves the Mac's iCloud Keychain items to the Mac, and nothing stays listed.macOS, Windows
KeychainHostSecrets, the history store's host and the Swift and C# test fakes gain the new call.ISecretStore.DeleteProfile(Guid, ProfileKind)returnsSecretDeletion.Docs
linux/docs/storage.md.Test plan
a_profile_write_over_a_file_that_changed_since_is_refused(and deletes nothing)a_library_write_after_a_profile_write_goes_on_over_the_digest_it_returneda_library_write_keeps_each_profile_as_given_and_names_the_ones_it_wrote_and_deleteda_library_write_keeps_a_profile_this_build_cannot_read_unless_it_names_or_removes_ita_library_write_refuses_a_profile_named_twice_or_both_kept_and_removeda_rebuild_keeps_the_profiles_it_namesa_write_takes_out_the_secrets_of_what_it_removed_once_it_has_landeda_crash_between_the_two_writes_leaves_the_deletions_for_the_next_writea_secret_the_host_could_not_delete_is_tried_again_by_the_next_writean_owner_that_came_back_before_the_retry_keeps_its_secretsno_other_writer_gets_in_between_the_write_and_its_deletions(another store on the file, as the sync engine writes)a_rebuild_drops_the_deletions_its_file_listeda_removal_that_names_an_id_the_file_holds_as_two_kinds_is_refuseda_file_with_a_newer_build_s_deletions_and_keys_still_reads_and_keeps_the_deletionsa_library_write_saves_replaces_and_takes_out_profiles_by_id(wasprofiles_are_saved_replaced_and_deleted_by_id),every_profile_import_and_restore_write_tells_the_journal,a_rebuild_keeps_only_what_it_names_and_starts_a_new_generation.a_profile_write_over_a_file_changed_since_it_was_read_is_refused_and_no_secret_goesa_library_write_after_a_profile_write_goes_on_over_the_digest_it_returnedwhat_the_write_takes_out_loses_its_secrets_once_the_write_lands(covers the fix(core): replace_library refuses a file that changed since it was read, and rebuild takes over unreadable files #4617removingchange)a_secret_the_store_would_not_delete_is_tried_again_by_the_next_writea_host_that_says_a_profile_s_secrets_are_another_app_s_is_not_asked_againa_rebuild_takes_no_secret_by_an_id_from_the_file_it_replacesa_library_write_keeps_a_profile_this_build_cannot_read_and_lists_its_ida_profile_s_secrets_go_by_its_id_and_kind_and_a_locked_store_says_soa_profile_delete_takes_its_own_credentials_and_never_a_connection_sprofiles_are_written_read_and_taken_out_with_the_library(wasprofiles_are_created_replaced_and_deleted).a_library_write_keeps_a_profile_this_build_cannot_read_and_lists_its_idreplacesa_profile_save_never_takes_the_id_of_a_profile_this_build_cannot_read, whose save call is gone.mac_library()carries one profile of each kind, soa_library_written_whole_reads_back_as_it_was_writtencovers them.coreProfilesSurviveEveryWrite,profileRemovalOnIOSKeepsTheMacItems.coreOnlyValuesSurviveAnEditpasses the profiles it read.cargo test -p tablepro-storage --lib connections::on macOS: 214 of 214.verify.sh --platform windows coreon the merge with main: 422 of 422.verify.sh --platform windowson the merge with main: bindings PASS, build PASS, tests 2641 of 2641 (34 skipped).verify.sh --platform linux: build PASS,test tablepro-storage520 of 520,test tablepro-ffi422 of 422. Lint across all targets and the app's lib tests fail on main's feat(core-ai): tool calling for both provider protocols #4630 (see below), so they did not run here.verify.sh test CoreAccountMappingTests FavoriteCoreMirrorTests SavedQueryCoreMirrorTests QueryHistoryCoreMirrorTests: 31 of 31.verify.sh package TableProFFI: 9 of 9.xcodebuild build-for-testingof TableProMobile for the iOS Simulator succeeded, so the app andTableProMobileTestscompile against the new records. The simulator tests (CoreLibraryStoreTests) are owed: the build machine has no simulator runtime.-D warningsontablepro-ffiandtablepro-storage, all targets: clean.tablepro-ffifor Windows. No CI job runscargo test -p tablepro-ffion Windows, socredential_manager.rs's own Rust tests, the new one included, run on a Windows machine only.ChatMessage::texta method, andlinux/crates/app/src/ui/assistant/conversation.rsstill reads it as a field. Linux lint, the app's tests and Flatpak fail; the fix is fix(linux): read the assistant message text through ChatMessage::text() #4639.public sealed record PaletteCommitEventArgs(...) : System.EventArgs;inCommandPalette.xaml.cs. A record cannot inherit a class, so the Windows Native AOT publish fails on x64 and Arm64. A fix PR is coming.