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

Trusted Device Encryption #497

Merged
merged 22 commits into from
Jan 23, 2024
Merged

Trusted Device Encryption #497

merged 22 commits into from
Jan 23, 2024

Conversation

Hinton
Copy link
Member

@Hinton Hinton commented Jan 12, 2024

Type of change

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

Objective

Implement trusted device encryption. Verified backwards compatibility with existing device keys from desktop.

Before you submit

  • Please add unit tests where it makes sense to do so

Copy link

codecov bot commented Jan 12, 2024

Codecov Report

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

Comparison is base (ae32c8d) 50.08% compared to head (5afc7fd) 50.68%.

Files Patch % Lines
crates/bitwarden/src/auth/client_auth.rs 12.50% 7 Missing ⚠️
crates/bitwarden-crypto/src/keys/device_key.rs 97.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #497      +/-   ##
==========================================
+ Coverage   50.08%   50.68%   +0.60%     
==========================================
  Files         161      162       +1     
  Lines        7881     7998     +117     
==========================================
+ Hits         3947     4054     +107     
- Misses       3934     3944      +10     

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

@Hinton Hinton changed the title Initial work on TDE Trusted Device Encryption Jan 19, 2024
@Hinton Hinton requested review from dani-garcia and jlf0dev January 19, 2024 09:53
@Hinton Hinton marked this pull request as ready for review January 19, 2024 09:54
@Hinton Hinton requested a review from dani-garcia January 22, 2024 13:06
@bitwarden-bot
Copy link

bitwarden-bot commented Jan 22, 2024

Logo
Checkmarx One – Scan Summary & Details6022a6c5-9de1-42c3-b351-f0fc162f0da2

Fixed Issues

Severity Issue Source File / Package
HIGH Command_Injection /languages/python/example.py: 66
HIGH Command_Injection /languages/python/example.py: 35
HIGH Missing User Instruction /Dockerfile: 23
HIGH Reflected_XSS /languages/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt: 379
MEDIUM Apt Get Install Pin Version Not Defined /Dockerfile: 9
MEDIUM Privacy_Violation /languages/java/Example.java: 12
MEDIUM Privacy_Violation /languages/java/src/main/java/com/bitwarden/sdk/SecretsClient.java: 40
MEDIUM Privacy_Violation /languages/java/Example.java: 13
MEDIUM Unchecked_Input_for_Loop_Condition /languages/kotlin/app/src/main/java/com/bitwarden/myapplication/MainActivity.kt: 379
MEDIUM Unpinned Actions Full Length Commit SHA /build-cli-docker.yml: 68
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 61
MEDIUM Unpinned Actions Full Length Commit SHA /release-napi.yml: 50
MEDIUM Unpinned Actions Full Length Commit SHA /release-napi.yml: 104
MEDIUM Unpinned Actions Full Length Commit SHA /build-cli-docker.yml: 151
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 52
MEDIUM Unpinned Actions Full Length Commit SHA /publish-rust-crates.yml: 134
MEDIUM Unpinned Actions Full Length Commit SHA /build-cli-docker.yml: 75
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 137
MEDIUM Unpinned Actions Full Length Commit SHA /release-cli.yml: 78
MEDIUM Unpinned Actions Full Length Commit SHA /release-napi.yml: 135
MEDIUM Using Platform Flag with FROM Command /Dockerfile: 4
LOW Healthcheck Instruction Missing /Dockerfile: 23
LOW Missing_CSP_Header /about.hbs: 48

jlf0dev
jlf0dev previously approved these changes Jan 23, 2024
Copy link
Member

@jlf0dev jlf0dev left a comment

Choose a reason for hiding this comment

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

Looks good!

pub struct DeviceKey(SymmetricCryptoKey);

#[derive(Debug)]
pub struct CreateDeviceKey {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Not sure of the naming scheme here but at a glance this tells me these are the inputs needed to create a Device Key. Maybe this should be CreatedDeviceKey?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I've renamed it to TrustDeviceResponse which is inline with other structs. We'll want to revisit this in the future.

@Hinton Hinton requested a review from jlf0dev January 23, 2024 14:52
dani-garcia
dani-garcia previously approved these changes Jan 23, 2024
Copy link
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

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

LGTM. Some minor formatting, not sure why rustfmt didn't catch that

crates/bitwarden-crypto/src/keys/device_key.rs Outdated Show resolved Hide resolved
@Hinton Hinton merged commit 43a97fe into main Jan 23, 2024
55 of 56 checks passed
@Hinton Hinton deleted the ps/tde branch January 23, 2024 15:25
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.

4 participants