Skip to content

[PM-18104] Implement generic key decryption in KeyStoreContext #152

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

Closed
wants to merge 3 commits into from

Conversation

dani-garcia
Copy link
Member

@dani-garcia dani-garcia commented Feb 7, 2025

🎟️ Tracking

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

📔 Objective

Expanded a bit a POC I had to make all the key encryption and decryption methods in KeyStore generic, through the use of a ContextHasKeys trait that ensures the store knows how to handle each key type.

I've had to introduce a trait called KeyBytes to deal with how to parse each key from bytes and convert them to bytes, initially I planned to enforce that keys had a TryFrom<Vec<u8>> and TryInto<Vec<u8>>, but hit some errors with the trait solver. I'll see if there's a better way to do it, maybe Encodable/Decodable from #142?

This is using an associated type bound, which would require us to bump MSRV to 1.79 Fixed it in ce39bca

⏰ 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

Copy link
Contributor

github-actions bot commented Feb 7, 2025

Logo
Checkmarx One – Scan Summary & Detailsf718d9b0-2003-4db9-b3ed-6eb3f9a9cda0

Great job, no security vulnerabilities found in this Pull Request

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 91.55844% with 13 lines in your changes missing coverage. Please review.

Project coverage is 65.45%. Comparing base (9e09cc5) to head (ce39bca).
Report is 91 commits behind head on main.

Files with missing lines Patch % Lines
crates/bitwarden-crypto/src/store/context.rs 91.81% 9 Missing ⚠️
crates/bitwarden-core/src/auth/auth_client.rs 0.00% 1 Missing ⚠️
crates/bitwarden-core/src/auth/renew.rs 0.00% 1 Missing ⚠️
...s/bitwarden-core/src/client/encryption_settings.rs 80.00% 1 Missing ⚠️
crates/bitwarden-core/src/mobile/crypto.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #152      +/-   ##
==========================================
+ Coverage   65.34%   65.45%   +0.10%     
==========================================
  Files         195      195              
  Lines       15087    15052      -35     
==========================================
- Hits         9859     9852       -7     
+ Misses       5228     5200      -28     

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

Copy link

sonarqubecloud bot commented Feb 7, 2025

@dani-garcia dani-garcia deleted the ps/key-store-context-generic-decrypt branch June 12, 2025 16:39
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.

1 participant