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

Explore using sqlite #652

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Explore using sqlite #652

wants to merge 12 commits into from

Conversation

Hinton
Copy link
Member

@Hinton Hinton commented Mar 7, 2024

Type of change

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

Objective

Code changes

  • file.ext: Description of what was changed and why

Before you submit

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

@bitwarden-bot
Copy link

bitwarden-bot commented Mar 7, 2024

Logo
Checkmarx One – Scan Summary & Details6eea1930-7915-4992-9526-c46d67c4774f

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Unpinned Actions Full Length Commit SHA /publish-rust-crates.yml: 200 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

Fixed Issues

Severity Issue Source File / Package
MEDIUM Unpinned Actions Full Length Commit SHA /publish-rust-crates.yml: 56

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

Attention: Patch coverage is 93.49593% with 16 lines in your changes missing coverage. Please review.

Project coverage is 56.76%. Comparing base (d43d1cb) to head (017055b).
Report is 132 commits behind head on main.

Files with missing lines Patch % Lines
crates/bitwarden-vault/src/sync.rs 0.00% 11 Missing ⚠️
crates/bitwarden-core/src/database/sqlite.rs 96.84% 3 Missing ⚠️
crates/bitwarden-core/src/database/mod.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #652      +/-   ##
==========================================
+ Coverage   56.00%   56.76%   +0.76%     
==========================================
  Files         193      196       +3     
  Lines       12607    12851     +244     
==========================================
+ Hits         7060     7295     +235     
- Misses       5547     5556       +9     

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

Comment on lines 39 to 48
// TODO: Move into a separate util
guard
.execute(
"CREATE TABLE IF NOT EXISTS ciphers (
id TEXT PRIMARY KEY,
value TEXT NOT NULL
)",
(),
)
.unwrap();
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'm thinking of moving this into a migration service instead.


pub struct ClientVault<'a> {
pub(crate) client: &'a mut crate::Client,
pub cipher_repository: Box<dyn CipherRepository + Send>,
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 think repositories should be internal to the module and we probably want to expose some service instead. Since we will want to hook into some event system, and probably expose nice methods for saving decrypted views.

@Hinton Hinton requested review from dani-garcia and MGibson1 June 3, 2024 13:21
Hinton added 2 commits June 28, 2024 16:24
# Conflicts:
#	Cargo.lock
#	crates/bitwarden-core/src/.gitignore
#	crates/bitwarden-vault/src/cipher/repository.rs
#	crates/bitwarden-vault/src/sync.rs
#	crates/bitwarden/Cargo.toml
#	crates/bitwarden/src/client/client.rs
#	crates/bitwarden/src/client/mod.rs
#	crates/bitwarden/src/error.rs
#	crates/bitwarden/src/vault/client_vault.rs
@@ -79,6 +82,7 @@
})),
external_client,
encryption_settings: RwLock::new(None),
db: Arc::new(Mutex::new(SqliteDatabase::default().unwrap())),

Check failure

Code scanning / clippy

used unwrap() on a Result value Error

used unwrap() on a Result value
Comment on lines +14 to +19
pub fn default() -> Result<Self, DatabaseError> {
let conn =
Connection::open("test.sqlite").map_err(|_| DatabaseError::FailedToOpenConnection)?;

Self::new_conn(conn)
}

Check failure

Code scanning / clippy

method default can be confused for the standard trait method std::default::Default::default Error

method default can be confused for the standard trait method std::default::Default::default
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