Skip to content

[PM-22344] - fix Error: Cannot Decrypt when moving a vault item to a collection #5911

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

Merged
merged 9 commits into from
Jun 3, 2025

Conversation

jaasen-livefront
Copy link
Collaborator

@jaasen-livefront jaasen-livefront commented Jun 3, 2025

🎟️ Tracking

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

📔 Objective

This PR fixes an issue where the /cipher/share endpoint was causing the shared cipher's encryption to break. This was due to a change from this PR that changed using ToCipher to casting with Cipher which caused a loss of the associated data and thus a failure of decryption in the client. It also returns as a ListResponseModel and updates the tests.

📸 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

@jaasen-livefront jaasen-livefront requested a review from a team as a code owner June 3, 2025 19:03
@jaasen-livefront jaasen-livefront changed the title [PM-22344] - use ToCipher instead of casting [PM-22344] - fix Error: Cannot Decrypt when moving a vault item to a collection Jun 3, 2025
gbubemismith
gbubemismith previously approved these changes Jun 3, 2025
@shane-melton
Copy link
Member

shane-melton commented Jun 3, 2025

@jaasen-livefront Switching to a ListResponseModel (which I'm in favor of) will also require changing the client service(s) to match the new response type.

Copy link
Member

@shane-melton shane-melton left a comment

Choose a reason for hiding this comment

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

We've got some failing tests we need to fix before merge

Copy link
Contributor

github-actions bot commented Jun 3, 2025

Logo
Checkmarx One – Scan Summary & Details7f222429-4e02-4682-adef-640cb423c004

Great job, no security vulnerabilities found in this Pull Request

@gbubemismith gbubemismith self-requested a review June 3, 2025 19:23
Copy link

codecov bot commented Jun 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.74%. Comparing base (6411cc6) to head (aaebba0).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5911      +/-   ##
==========================================
+ Coverage   47.73%   47.74%   +0.01%     
==========================================
  Files        1665     1665              
  Lines       75014    75015       +1     
  Branches     6755     6755              
==========================================
+ Hits        35806    35814       +8     
+ Misses      37743    37741       -2     
+ Partials     1465     1460       -5     

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -1106,7 +1106,8 @@ public async Task<CipherMiniResponseModel[]> PutShareMany([FromBody] CipherBulkS
userId
);

return updated.Select(c => new CipherMiniResponseModel(c, _globalSettings, false)).ToArray();
var response = updated.Select(c => new CipherMiniResponseModel(c, _globalSettings, false)).ToArray();
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need the toArray anymore

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed!

gbubemismith
gbubemismith previously approved these changes Jun 3, 2025
Copy link

sonarqubecloud bot commented Jun 3, 2025

@jaasen-livefront jaasen-livefront merged commit 2e14a46 into main Jun 3, 2025
37 checks passed
@jaasen-livefront jaasen-livefront deleted the PM-22344 branch June 3, 2025 21:02
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