-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[PM-30845] fix(vault): preserve card brand when editing existing card #18381
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
[PM-30845] fix(vault): preserve card brand when editing existing card #18381
Conversation
|
Thank you for your contribution! We've added this to our internal tracking system for review. Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process. |
jengstrom-bw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VedantMadane I added a comment on your change to card-details-section.component.ts that should get things working
libs/vault/src/cipher-form/components/card-details-section/card-details-section.component.ts
Show resolved
Hide resolved
Addresses review feedback from @jengstrom-bw in PR bitwarden#18381. The brand field was being used in card-details-section.component.ts but wasn't defined in the OptionalInitialValues type, causing a TypeScript compilation error. Adds brand?: string; to the Credit Card Information section of OptionalInitialValues in cipher-form-config.service.ts.
jengstrom-bw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making that change. Looks good!
|
@VedantMadane I've moved this PR to QA for testing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18381 +/- ##
=======================================
Coverage 43.43% 43.43%
=======================================
Files 3689 3689
Lines 108247 108248 +1
Branches 16374 16375 +1
=======================================
+ Hits 47014 47016 +2
Misses 59252 59252
+ Partials 1981 1980 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0d895e7 to
646c05c
Compare
Addresses review feedback from @jengstrom-bw in PR bitwarden#18381. The brand field was being used in card-details-section.component.ts but wasn't defined in the OptionalInitialValues type, causing a TypeScript compilation error. Adds brand?: string; to the Credit Card Information section of OptionalInitialValues in cipher-form-config.service.ts.
Fixes bitwarden#16978 The brand field was not being restored when editing an existing card cipher, causing it to show '--Select--' and potentially lose the brand data when saving. Added the brand field to initFromExistingCipher() to properly restore the card brand when opening a card for editing. Also updated the test to verify all card fields including brand, expMonth, and expYear are properly initialized from existing cipher data.
Addresses review feedback from @jengstrom-bw in PR bitwarden#18381. The brand field was being used in card-details-section.component.ts but wasn't defined in the OptionalInitialValues type, causing a TypeScript compilation error. Adds brand?: string; to the Credit Card Information section of OptionalInitialValues in cipher-form-config.service.ts.
646c05c to
8bd20ae
Compare
8bd20ae to
bf35bad
Compare
|
Great job! No new security vulnerabilities introduced in this pull request |

Tracking
Fixes #16978
Objective
When editing an existing card cipher, the brand field was not being restored, causing it to show '--Select--' instead of the saved brand value. If the user saves the card in this state, the brand information is lost.
Reminders before review
Changeset
Root cause
In \card-details-section.component.ts, the \initFromExistingCipher()\ method was missing the \�rand\ field when patching the form values.
Fix
Added the \�rand\ field to \initFromExistingCipher()\ to properly restore the card brand when opening a card for editing.
Testing
Updated the test \initializes cardDetailsForm from getInitialCipherValue\ to verify all card fields including brand, expMonth, and expYear are properly initialized from existing cipher data.
Security
No security implications - this is a data preservation fix.
Checklist