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

[PM-6108] Add support for missing AES decrypt types #335

Merged
merged 2 commits into from
Feb 8, 2024

Conversation

dani-garcia
Copy link
Member

Type of change

- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Add support for the missing AES decryption types: AesCbc256_B64 and AesCbc128_HmacSha256_B64.

Note that SymmetricCryptoKey at the moment expects 32 byte keys, and AES128 used 16 byte keys, so the 16byte key+mac get parsed as a single 32byte key. At the moment we just split it by hand, but ultimately we would need to handle this better in a future refactor.

@dani-garcia dani-garcia requested a review from Hinton November 17, 2023 17:09
@bitwarden-bot
Copy link

bitwarden-bot commented Nov 17, 2023

Logo
Checkmarx One – Scan Summary & Details7786be58-0802-46c2-bee3-7d44fda4b9db

No New Or Fixed Issues Found

@Hinton Hinton changed the title Add support for missing AES decrypt types [PM-6108] Add support for missing AES decrypt types Feb 6, 2024
@dani-garcia dani-garcia force-pushed the ps/more-aes-decrypt-support branch from a89e868 to a76b21b Compare February 6, 2024 18:10
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@1595306). Click here to learn what that means.
Report is 5 commits behind head on main.

Files Patch % Lines
...rates/bitwarden-crypto/src/enc_string/symmetric.rs 94.44% 2 Missing ⚠️
crates/bitwarden-crypto/src/aes.rs 97.56% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #335   +/-   ##
=======================================
  Coverage        ?   58.90%           
=======================================
  Files           ?      171           
  Lines           ?    10211           
  Branches        ?        0           
=======================================
  Hits            ?     6015           
  Misses          ?     4196           
  Partials        ?        0           

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

Copy link
Member

@Hinton Hinton left a comment

Choose a reason for hiding this comment

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

Can we add some tests to confirm we're decrypting this correctly?

Comment on lines +244 to +247
// TODO: SymmetricCryptoKey is designed to handle 32 byte keys only, but this
// variant uses a 16 byte key This means the key+mac are going to be
// parsed as a single 32 byte key, at the moment we split it manually
// When refactoring the key handling, this should be fixed.
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a ticket for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I created a new one in SDK future: PM-6164

@dani-garcia dani-garcia merged commit f57262c into main Feb 8, 2024
57 checks passed
@dani-garcia dani-garcia deleted the ps/more-aes-decrypt-support branch February 8, 2024 13:14
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