Skip to content

[PM-38808] Support optional encrypted Cipher.name#2773

Open
shane-melton wants to merge 1 commit into
mainfrom
PM-38808/support-optional-cipher-name
Open

[PM-38808] Support optional encrypted Cipher.name#2773
shane-melton wants to merge 1 commit into
mainfrom
PM-38808/support-optional-cipher-name

Conversation

@shane-melton

Copy link
Copy Markdown
Member

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-38808

📔 Objective

The SDK is making the encrypted Cipher.name field optional (StringString?) as part of the blob encryption migration (sdk-internal#1122) — blob-encrypted ciphers carry the name inside the sealed data blob rather than as a top-level field.

The SDK → network conversions CipherRequestModel.init(cipher:) and CipherDetailsResponseModel.init(cipher:) assign into non-optional name fields, so the now-nullable name no longer compiles. These fall back to an empty string when the name is absent.

The decrypted CipherView / CipherListView name fields are unchanged, so all UI is unaffected.

⚠️ ?? "" emits a non-optional-operand warning until the bumped SDK lands — this PR is intended to merge alongside the SDK version bump.

Adapts to the SDK making encrypted Cipher.name optional (sdk-internal#1122).
@github-actions github-actions Bot added the app:password-manager Bitwarden Password Manager app context label Jun 9, 2026
@shane-melton shane-melton marked this pull request as ready for review June 9, 2026 21:37
@shane-melton shane-melton requested review from a team and matt-livefront as code owners June 9, 2026 21:37
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR adapts two SDK-to-network model conversion sites (CipherRequestModel.init(cipher:) and CipherDetailsResponseModel.init(cipher:)) to accommodate the upcoming SDK change that makes BitwardenSdk.Cipher.name optional as part of the blob encryption migration. The change uses ?? "" to fall back to an empty string when the encrypted name is absent — appropriate because blob-encrypted ciphers carry the name inside the sealed data blob rather than as a top-level field. Other usages of cipher.name (e.g., AuthenticatorSyncService, CredentialIdentityFactory) operate on the decrypted CipherView, which retains a non-optional name, so they are correctly unaffected.

Code Review Details

No findings.

The change is minimal, targeted, and well-scoped:

  • Type-level coercion is symmetric on both SDK→network conversion paths.
  • The PR description clearly documents the temporary ?? "" non-optional-operand warning and signals that this PR is intended to land alongside the SDK version bump.
  • Pattern matches existing optional-handling conventions in the file (e.g., cipher.notes flows through as optional because the target field is optional, while name needs coercion because CipherRequestModel.name / CipherDetailsResponseModel.name remain non-optional).
  • No zero-knowledge, keychain, or input-validation concerns introduced.

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.90%. Comparing base (d07d2c2) to head (64ac596).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2773      +/-   ##
==========================================
+ Coverage   87.89%   87.90%   +0.01%     
==========================================
  Files        1716     1717       +1     
  Lines      167350   167663     +313     
==========================================
+ Hits       147092   147390     +298     
- Misses      20258    20273      +15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KatherineInCode

Copy link
Copy Markdown
Contributor

🤔 Under what circumstances will the user see a blank name because of the nil-coalescing to an empty string?

@shane-melton

Copy link
Copy Markdown
Member Author

🤔 Under what circumstances will the user see a blank name because of the nil-coalescing to an empty string?

The encrypted name will only come back null for blob encrypted ciphers. In such cases the only way to access the decrypted name property is via decrypting the blob and access the resulting CipherView.Name property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:password-manager Bitwarden Password Manager app context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants