π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Enable secure deletion for Ensu SQLite
Manav Rathife90866ec17d
diff --git a/rust/crates/ensu/src/db/backend/sqlite.rs b/rust/crates/ensu/src/db/backend/sqlite.rsindex cf26cf74c4..4267cdc2c0 100644--- a/rust/crates/ensu/src/db/backend/sqlite.rs+++ b/rust/crates/ensu/src/db/backend/sqlite.rs@@ -13,7 +13,7 @@ pub struct SqliteBackend {impl SqliteBackend {pub fn open(path: impl AsRef<Path>) -> Result<Self> {let conn = Connection::open(path)?;- conn.execute_batch("PRAGMA foreign_keys = ON;")?;+ conn.execute_batch("PRAGMA foreign_keys = ON; PRAGMA secure_delete = ON;")?;Ok(Self {conn: Mutex::new(conn),})@@ -207,3 +207,20 @@ fn from_sql_value(value: SqlValue) -> Result<Value> {SqlValue::Real(_) => Err(Error::UnsupportedValueType("real".to_string())),}}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn disk_connections_enable_secure_delete() {+ let path = std::env::temp_dir().join(format!("ensu-sqlite-{}", uuid::Uuid::new_v4()));+ let backend = SqliteBackend::open(&path).unwrap();+ assert_eq!(+ backend.query_row("PRAGMA secure_delete", &[]).unwrap(),+ Some(vec![Value::Integer(1)])+ );+ drop(backend);+ std::fs::remove_file(path).unwrap();+ }+}