Skip to content

Conversation

@VedantMadane
Copy link
Contributor

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

  • All tests pass locally
  • No new lint errors introduced
  • Code follows existing patterns

@VedantMadane VedantMadane requested a review from a team as a code owner January 15, 2026 12:40
@CLAassistant
Copy link

CLAassistant commented Jan 15, 2026

CLA assistant check
All committers have signed the CLA.

@bitwarden-bot
Copy link

Thank you for your contribution! We've added this to our internal tracking system for review.
ID: PM-30845
Link: https://bitwarden.atlassian.net/browse/PM-30845

Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process.

@bitwarden-bot bitwarden-bot changed the title fix(vault): preserve card brand when editing existing card [PM-30845] fix(vault): preserve card brand when editing existing card Jan 15, 2026
@bitwarden-bot bitwarden-bot added community-pr needs-qa Marks a PR as requiring QA approval labels Jan 15, 2026
Copy link
Contributor

@jengstrom-bw jengstrom-bw left a 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

VedantMadane added a commit to VedantMadane/clients that referenced this pull request Feb 1, 2026
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
jengstrom-bw previously approved these changes Feb 3, 2026
Copy link
Contributor

@jengstrom-bw jengstrom-bw left a 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!

@jengstrom-bw
Copy link
Contributor

@VedantMadane I've moved this PR to QA for testing

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.43%. Comparing base (e5c9f93) to head (bf35bad).
⚠️ Report is 15 commits behind head on main.
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@VedantMadane VedantMadane force-pushed the fix/card-brand-lost-on-re-edit branch from 0d895e7 to 646c05c Compare February 4, 2026 12:46
@VedantMadane VedantMadane requested review from a team as code owners February 4, 2026 12:46
VedantMadane added a commit to VedantMadane/clients that referenced this pull request Feb 4, 2026
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.
@VedantMadane VedantMadane force-pushed the fix/card-brand-lost-on-re-edit branch from 646c05c to 8bd20ae Compare February 4, 2026 12:50
@VedantMadane VedantMadane force-pushed the fix/card-brand-lost-on-re-edit branch from 8bd20ae to bf35bad Compare February 4, 2026 13:05
@djsmith85 djsmith85 requested review from jengstrom-bw and removed request for a team, addisonbeck, blackwood, enmande, mzieniukbw, nikwithak, r-tome and willmartian February 4, 2026 13:46
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Logo
Checkmarx One – Scan Summary & Details607616df-1eac-49c4-a394-97fa10aa3e46

Great job! No new security vulnerabilities introduced in this pull request

@jengstrom-bw jengstrom-bw removed the needs-qa Marks a PR as requiring QA approval label Feb 4, 2026
@jengstrom-bw jengstrom-bw merged commit 04d2394 into bitwarden:main Feb 4, 2026
204 of 211 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card brand lost on re-edit

4 participants