Skip to content

FXCM-2281: Integrate EncryptorDecryptor into the autofill database - #7573

Open
theidkamp wants to merge 1 commit into
mozilla:db-cryptofrom
theidkamp:fxcm-2281-integrate-encryptor
Open

theidkamp wants to merge 1 commit into
mozilla:db-cryptofrom
theidkamp:fxcm-2281-integrate-encryptor

Conversation

@theidkamp

@theidkamp theidkamp commented Sep 2, 2026

Copy link
Copy Markdown

What

The autofill store now owns its encryption context: Store::new() takes an EncryptorDecryptor (from the shared db-crypto crate, #7542) and passes it to the database. All code accessing the encrypted column obtains the
encryptor/decryptor from the database, so encryption keys no longer need to be passed through the sync API.

  • constructor(string dbpath, EncryptorDecryptor encdec)
  • scrub_undecryptable_credit_card_data_for_remote_replacement() no longer takes an encryption key.

This follows the same structure as logins on the db-crypto branch:

  • autofill/src/encryption.rs has been removed. Call sites now use db_crypto types directly, string conversion lives next to its consumers, and the key-based UDL functions have moved to lib.rs.
  • Factory functions matching the logins API were added as a workaround for the UniFFI/JS trait bug: create_static_key_manager, create_managed_encdec, create_autofill_store_with_static_key_manager,
    and behind the new keydb feature create_autofill_store_with_nss_keymanager (using the key name
    as-autofill-key).

Breaking changes

Code that constructs the store (or calls scrub) is affected, one call site per platform:

  • Desktop: RustAutofillStore.sys.mjs (Store.init)
  • Android: AutofillCreditCardsAddressesStorage.kt (store init, uses
    createAutofillStoreWithStaticKeyManager(dbPath, key) with the existing autofill key)
  • iOS: RustAutofill.swift (store init + the scrub call, iOS is its only caller)

The sync engine also no longer implements set_local_encryption_key. The store owns
the encryptor, so there is nothing to hand over. Consumers must stop passing an
encryption key for creditcards in the sync manager's local_encryption_keys
before updating; passing one now hits sync15's default and panics at sync time
(a runtime break, not a compile break):

  • Android: WorkManagerSyncManager.kt:410–414: drop the CreditCards keyProvider
    guard and its engineKeyProviders registration, leaving only
    registerWithSyncManager() (matching the Passwords branch)
  • iOS: RustSyncManager.swift: drop localEncryptionKeys["creditcards"] = key

Blocked on #7542 this branch does not build until the shared crate lands.

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

@theidkamp
theidkamp force-pushed the fxcm-2281-integrate-encryptor branch from cbfbb17 to 516027a Compare September 10, 2026 20:42
@theidkamp
theidkamp changed the base branch from main to db-crypto September 14, 2026 13:44
@theidkamp
theidkamp force-pushed the fxcm-2281-integrate-encryptor branch 4 times, most recently from 503e4c4 to c37bde5 Compare September 15, 2026 07:34
@theidkamp
theidkamp force-pushed the fxcm-2281-integrate-encryptor branch from c37bde5 to 57f41f7 Compare September 18, 2026 13:08
@theidkamp
theidkamp marked this pull request as ready for review September 22, 2026 13:49
Move autofill's credit-card encryption onto the shared db-crypto crate and let
AutofillDb own the encryptor, as logins' LoginDb does. The consumer supplies it
when building the store, so no key is passed into individual calls or down
through the sync layers.
@theidkamp
theidkamp force-pushed the fxcm-2281-integrate-encryptor branch from 57f41f7 to 5574c93 Compare September 22, 2026 13:54

This branch has not been deployed

No deployments
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