Skip to content

Conversation

gbubemismith
Copy link
Contributor

🎟️ Tracking

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

related to this PR

📔 Objective

Editing a cipher with attachments causes attachment corruption when switching between cipher-key encryption and user-key encryption in either direction. The SDK's AttachmentView was not providing the decrypted attachment key needed for re-encryption scenarios. When the cipher gets re-encrypted between different encryption contexts (cipher-key ↔ user-key) during save, the client needs the decrypted attachment key to properly re-encrypt it under the new encryption context. Without this, null gets posted for the attachment key, breaking decryption.

This is a temporary solution during the migration from TypeScript to the SDK. The decrypted_key field should be removed once all encryption logic is handled within the SDK.

Cleanup tracked in: https://bitwarden.atlassian.net/browse/PM-23005

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation 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 confirmed issue 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

@gbubemismith gbubemismith requested a review from a team as a code owner June 25, 2025 00:39
Copy link
Contributor

github-actions bot commented Jun 25, 2025

Logo
Checkmarx One – Scan Summary & Details5da3c438-3c11-48b6-8df4-8202dadf02f3

Great job, no security vulnerabilities found in this Pull Request

nick-livefront
nick-livefront previously approved these changes Jun 25, 2025
shane-melton
shane-melton previously approved these changes Jun 30, 2025
@gbubemismith gbubemismith dismissed stale reviews from shane-melton and nick-livefront via a5f9fcc July 3, 2025 17:12
@shane-melton
Copy link
Member

@gbubemismith Looks like we have failing tests, not 100% sure if related to these changes though

@gbubemismith
Copy link
Contributor Author

@gbubemismith Looks like we have failing tests, not 100% sure if related to these changes though

Looks like this PR hasn't been implemented yet on the client

Copy link
Collaborator

@nick-livefront nick-livefront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbubemismith These changes look good to me, the PR you linked above. Can that be pulled in and the failing CI resolved? Or is this dependent on anything else?

@gbubemismith
Copy link
Contributor Author

@gbubemismith These changes look good to me, the PR you linked above. Can that be pulled in and the failing CI resolved? Or is this dependent on anything else?

This PR addresses it

Copy link

sonarqubecloud bot commented Jul 7, 2025

Copy link

codecov bot commented Jul 7, 2025

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 37.19%. Comparing base (f76276d) to head (bfe79df).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...bs/common/src/vault/models/view/attachment.view.ts 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15324   +/-   ##
=======================================
  Coverage   37.18%   37.19%           
=======================================
  Files        3275     3275           
  Lines       94347    94349    +2     
  Branches    14240    14242    +2     
=======================================
+ Hits        35083    35090    +7     
+ Misses      57811    57804    -7     
- Partials     1453     1455    +2     

☔ 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.

@gbubemismith gbubemismith merged commit 4d9516c into main Jul 7, 2025
98 checks passed
@gbubemismith gbubemismith deleted the vault/PM-22812 branch July 7, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants