Skip to content
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

Fix ciphers & collections using wrong key when decrypting #812

Merged
merged 7 commits into from
May 31, 2024
Merged

Conversation

Hinton
Copy link
Member

@Hinton Hinton commented May 31, 2024

📔 Objective

In #738 we migrated away from decrypt and used decrypt_with_key instead. However ciphers can be encrypted using either organization keys or user key. The changes introduced meant we always used the users key instead of conditionally based on the value of organization_jd in Cipher.

The fix was to call locate_key on Cipher and Collection.

To properly write tests I needed to mock a user account and organization. I took this moment to refactor our tests account and we now have nice helpers for initializing the [email protected] account, which also includes an organization.

⏰ 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

@Hinton Hinton requested a review from dani-garcia May 31, 2024 10:05
Copy link
Contributor

github-actions bot commented May 31, 2024

Logo
Checkmarx One – Scan Summary & Details04ee2ccf-725e-40d9-8b55-7b52651e9d78

No New Or Fixed Issues Found

dani-garcia
dani-garcia previously approved these changes May 31, 2024
Copy link

codecov bot commented May 31, 2024

Codecov Report

Attention: Patch coverage is 93.65079% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 59.44%. Comparing base (9eb4237) to head (2483b5d).

Files Patch % Lines
...rates/bitwarden/src/mobile/vault/client_ciphers.rs 88.88% 6 Missing ⚠️
crates/bitwarden/src/client/test_accounts.rs 93.93% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #812      +/-   ##
==========================================
+ Coverage   58.02%   59.44%   +1.42%     
==========================================
  Files         179      180       +1     
  Lines       11634    11753     +119     
==========================================
+ Hits         6751     6987     +236     
+ Misses       4883     4766     -117     

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

@Hinton Hinton requested a review from dani-garcia May 31, 2024 11:24
dani-garcia
dani-garcia previously approved these changes May 31, 2024
dani-garcia
dani-garcia previously approved these changes May 31, 2024
@Hinton Hinton merged commit a9f77e6 into main May 31, 2024
103 checks passed
@Hinton Hinton deleted the ps/fix-cipher branch May 31, 2024 12:11
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.

2 participants