Integrate EncryptorDecryptor for rust credit card store
Categories
(Toolkit :: Form Autofill, task, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: dimi, Assigned: dimi)
References
(Blocks 2 open bugs)
Details
Attachments
(3 external files, 1 obsolete file)
| Assignee | ||
Comment 1•2 months ago
|
||
The Rust store now holds an EncryptorDecryptor, so it owns the key and decides
what counts as undecryptable. The adapter's crypto sites go through the store
instead of OSKeyStore; a number encrypted under any other key would read back
as an unreadable card. Reading one becomes decryptNumber(), the single place
this store decrypts.
RustAutofillStore opens the store with a key held in NSS's key4.db under its
own name, distinct from logins', and supplies the primary password through a
PrimaryPasswordAuthenticator modelled on passwordmgr's. Both stores keep keys
in the same key4.db, so the prompt is shared: this one declines while
LoginHelper.requestReauth holds the token logged out, and announces the
outcome on the topics passwordmgr's callers already wait on.
A cancelled prompt and data that will not decrypt arrive as the same crypto
error, so the handler records which it was and decryptNumber turns a
cancellation back into NS_ERROR_ABORT, which is what crypto-SDR and the JSON
store report and what callers branch on.
Cards written under OSKeyStore no longer read back. The JSON records they were
copied from are still there -- the migration never wipes its source -- but
nothing re-runs the copy on its own, so recovering them needs the profile put
back on the JSON store first. No profile is in that position: the pref is off
on every channel.
| Assignee | ||
Comment 2•2 months ago
|
||
The Rust store encrypts with a key of its own, so which key reads a card back
depends on which store wrote it and cc-number-encrypted can no longer be
handed straight to OSKeyStore.
Both credit card collections grow decryptNumber(), and the three consumers that
decrypted for themselves -- filling a form, opening the edit dialog, and
revealing a card in the sidebar -- ask the collection they read the record
from. For the JSON store that is OSKeyStore as before, re-authentication and
its telemetry trigger included; for the Rust store re-authentication is a step
of its own, its key not being the one the OS prompt guards, and it asks not to
be handed an OS key store key it would never read.
FormAutofillSection is bundled for iOS, where importing the storage would drag
the whole store in with it, so the parent passes the decryption in rather than
the section reaching for it.
The migration itself is unchanged: it already crossed the number in the clear.
What moves is which key each side uses. #creditCardKeysAvailable asks about
both now: reading the source does not cover the Rust store's key, which the
copy needs to write with, and a primary password answered mid-copy would spend
one of the three attempts the migration gets.
A browser test covers what the xpcshell ones cannot: filling a form is the only
path that takes the ciphertext the receiving store wrote and asks for the
number back. It saves a card in JSON, migrates it, fills it, captures a new one
against the Rust store, resubmits a stored card to check it is recognised
rather than duplicated, and switches back. Its own directory, since a manifest
sets prefs for all of its tests and the address suite has to keep running
without this one turned on.
Depends on D325372
| Assignee | ||
Comment 3•2 months ago
|
||
The store's key lives in NSS, so a profile with a primary password set cannot
read it until the user supplies one. P1 left that case declining rather than
prompting; this is the prompt, and everything that has to hold still around it.
The prompt itself is passwordmgr's, shown from a PrimaryPasswordAuthenticator
modelled on RustLoginStorageAuthenticator. Both stores keep keys in the same
key4.db and the token is global, so unlocking for one unlocks the other: this
announces the outcome on the topics passwordmgr's callers already wait on, and
declines while LoginHelper.requestReauth holds the token deliberately logged
out rather than answering its prompt for it.
A declined prompt and data that will not decrypt reach JS as the same crypto
error. The handler records which it was and the adapter turns a cancellation
back into NS_ERROR_ABORT, which is what crypto-SDR and the JSON store report
and what callers already branch on: an edit dialog returns rather than opening
with a blank number, and a merge that needed the stored number refuses instead
of quietly dropping it. getDuplicateRecords gives up on the first one rather
than asking again for every remaining card.
The migration settles the key up front, the way LoginStorageMigrator does. A
prompt answered mid-copy would otherwise spend one of the three attempts the
migration gets, and three spent attempts cost it for good.
Still missing, and tracked separately: this store's prompts are untelemetered,
and uiBusy has no shared owner, so passwordmgr cannot see that a prompt of
ours is already on screen.
Depends on D325373
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
| Assignee | ||
Comment 4•1 month ago
|
||
Local vendor of application-services draft pull request #7573 (head
54fc561bfe), its four commits applied onto the revision the tree already
vendors, 7585e03e2. It moves autofill's credit card encryption onto the
db-crypto crate: Store::new() takes an EncryptorDecryptor, and the record API
carries the card number in cleartext, which the store encrypts and derives the
last four digits from. A number the key cannot read fails the read. It also
removes the key-based encrypt_string() and decrypt_string(), which nothing can
call once no consumer holds ciphertext.
The NSS store constructor is behind the crate's new keydb feature, which the
uniffi-bindgen-gecko-js components crate turns on as it already does for
db-crypto. Both store constructors are declared AsyncWrapped, since each does
the same database work as Store's own constructor, and the two new key manager
helpers Sync, alongside create_autofill_key().
This must not land. It carries a draft pull request, and should be dropped as
soon as a real vendor bump carries it in.
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
https://hg.mozilla.org/mozilla-central/rev/aef603e1b41d
https://hg.mozilla.org/mozilla-central/rev/a934ff59f7fd
https://hg.mozilla.org/mozilla-central/rev/761e23e95635
Comment 7•1 month ago
|
||
Comment on attachment 9641128 [details]
Bug 2071247 - P4. Prompt for the primary password when the store's key needs it r?joschmidt
Revision D325418 was moved to bug 2080074. Setting attachment 9641128 [details] to obsolete.
Updated•1 month ago
|
Description
•