Bug 2075560 - Remove the key-based encrypt/decrypt_string functions - #7576
Conversation
00784a9 to
3c5b714
Compare
2d1e2e5 to
afc4fce
Compare
afc4fce to
88e764d
Compare
88e764d to
84c493a
Compare
| &record.cc_number_enc, | ||
| self.encdec.as_ref(), | ||
| record.guid.as_str(), | ||
| )? |
There was a problem hiding this comment.
So if we have any undecryptable credit card, get_local_dupe would return an error - is this expected behaviour?
I know this is how it was before but since we now possibly delay key retrieval - which could fail - this might become more important.
| Ok(serde_json::from_str(&cleartext).unwrap_or(Self { | ||
| cc_number: cleartext, | ||
| cc_cvv: None, | ||
| })) |
There was a problem hiding this comment.
I'm not sure about the fallback here, logins throw if the json is not parseable. And we don't reuse the old cc_number_enc value, so there's no need for this fallback, isn't it?
| Ok(InternalCreditCard { | ||
| guid: p.id, | ||
| cc_name: p.entry.cc_name, | ||
| cc_number_enc, |
There was a problem hiding this comment.
wait, why does InternalCreditCard still use cc_number_enc?
| id: self.guid, | ||
| entry: PayloadEntry { | ||
| cc_name: self.cc_name, | ||
| cc_number, |
| cc_number: cleartext, | ||
| ..Default::default() | ||
| } | ||
| .encrypt(&static_key_encryptor(&key)?, "<no guid>") |
There was a problem hiding this comment.
Maybe I do not understand this, this seems wrong. Isn't this part of the old API for cc_number_enc, which this commit does not touch?
| let cleartext = serde_json::to_string(self) | ||
| .map_err(|e| Error::EncryptionFailed(format!("{e} (encrypting {guid})")))?; | ||
| let cipherbytes = encdec | ||
| .encrypt(cleartext.into_bytes()) | ||
| .map_err(|e| Error::EncryptionFailed(format!("{e} (encrypting {guid})")))?; | ||
| String::from_utf8(cipherbytes) | ||
| .map_err(|e| Error::EncryptionFailed(format!("{e} (encrypting {guid}: data not utf8)"))) |
There was a problem hiding this comment.
This masks all errors, maybe you could align with logins and propagate the underlying error?
84c493a to
659baa2
Compare
b6d4ceb to
1405cb1
Compare
659baa2 to
a41d977
Compare
1405cb1 to
835f79e
Compare
|
The encrypted |
|
Okay, so here's the new plan, as discussed on slack:
We can close this branch. |
6c4a511 to
67b2c07
Compare
67b2c07 to
78b935d
Compare
2e22c13 to
373d3d7
Compare
78b935d to
f0084db
Compare
373d3d7 to
e16fb6b
Compare
f0084db to
5410677
Compare
e16fb6b to
cec147e
Compare
5410677 to
f18e557
Compare
cec147e to
e893ad6
Compare
With transparent card numbers no consumer handles ciphertext, so the namespace functions that took a key have no callers left. create_autofill_key() stays for consumers that manage a static key.
f18e557 to
6156f4a
Compare
Stacked on #7573 (base is
theidkamp/pr-7573; will be rebased onto main right after #7573 merges, so both land in the same nightly)What
Bug 2075560: Remove the key-based
encrypt_string/decrypt_stringnamespace functions. With transparent card numbers (#7573) no consumer handles ciphertext, so nothing needs them.create_autofill_key()stays for consumers that manage a static key; for canaries usedb_crypto.create_canary/check_canary(format-compatible with canaries created via the removedencrypt_string).Breaking API changes
encrypt_string(key, ...)/decrypt_string(key, ...)removed. (AndroidAutofillCrypto.kt& iOSRustAutofill.swift/RustKeychain.swift; Desktop never used these)Pull Request checklist