-
Notifications
You must be signed in to change notification settings - Fork 20
Improve credit card naming and add Dashlane tests #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This commit introduces several improvements to the CXF (Credential Exchange Format) importer, focusing on better handling of credit card items and expanding test coverage. Objective: The primary goal is to enhance the user experience when importing credit card data from CXF files by providing more sensible default names for items. A secondary objective is to add comprehensive integration tests for Dashlane exports to ensure compatibility and prevent regressions. Behavioral Changes: When importing a credit card from a CXF file, if the item's main title is empty or consists only of whitespace, the importer will now use the cardholder's name as the item name. If both the title and cardholder name are absent, it will fall back to "Untitled Card". This prevents the creation of nameless credit card entries in the vault. Specific Changes: - **`cxf/import.rs`**: - The internal `add_item` helper function has been updated to accept an optional `custom_name` parameter, allowing the item's name to be overridden during creation. - For credit card credentials, logic has been added to check if the `item.title` is blank. If it is, the cardholder's name (`card.cardholder_name`) is used as the item name. A fallback to "Untitled Card" is implemented if the cardholder's name is also unavailable. - Added several new unit tests to verify the new naming logic for credit cards under various conditions: - Empty title uses cardholder name. - Whitespace-only title uses cardholder name. - Title is present, so cardholder name is ignored for naming. - Both title and cardholder name are missing, resulting in a fallback name. - **`cxf/tests/dashlane_import_test.rs`**: - A new integration test file has been added to validate the import of Dashlane-generated CXF files. - This includes a full test suite (`test_import_dashlane`) that parses a sample `dashlane_export.json` file and asserts that all items (Logins, Cards, Notes, Identities, etc.) are correctly converted into Bitwarden cipher objects. - **`resources/dashlane_export.json`**: - A new resource file containing a sample export from Dashlane has been added. This file serves as the test case for the new Dashlane integration test. - **`cxf/tests/mod.rs`**: - The new `dashlane_import_test` module is now included in the test suite.
Great job! No new security vulnerabilities introduced in this pull request |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #503 +/- ##
==========================================
+ Coverage 77.97% 78.08% +0.10%
==========================================
Files 287 287
Lines 27673 27808 +135
==========================================
+ Hits 21579 21714 +135
Misses 6094 6094 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
CXF is owned by arch, adding @Hinton as reviewer. Ping me when he has approved it! |
🎟️ Tracking
TBD
📔 Objective
This change introduces several improvements to the CXF (Credential Exchange Format) importer, focusing on better handling of credit card items and expanding test coverage.
The primary goal is to enhance the user experience when importing credit card data from CXF files by providing more sensible default names for items. A secondary objective is to add comprehensive integration tests for Dashlane exports to ensure compatibility and prevent regressions.
Behavioral Changes:
When importing a credit card from a CXF file, if the item's main title is empty or consists only of whitespace, the importer will now use the cardholder's name as the item name. If both the title and cardholder name are absent, it will fall back to "Untitled Card". This prevents the creation of nameless credit card entries in the vault.
Specific Changes:
cxf/import.rs
:add_item
helper function has been updated to accept an optionalcustom_name
parameter, allowing the item's name to be overridden during creation.item.title
is blank. If it is, the cardholder's name (card.cardholder_name
) is used as the item name. A fallback to "Untitled Card" is implemented if the cardholder's name is also unavailable.cxf/tests/dashlane_import_test.rs
:test_import_dashlane
) that parses a sampledashlane_export.json
file and asserts that all items (Logins, Cards, Notes, Identities, etc.) are correctly converted into Bitwarden cipher objects.resources/dashlane_export.json
:cxf/tests/mod.rs
:dashlane_import_test
module is now included in the test suite.⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes