From 5d41e3f4d82df9094968bd2632ea8acf18801737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 15 Jan 2025 15:31:13 +0100 Subject: [PATCH 1/3] Update secrecy crate; remove unused methods --- Cargo.lock | 51 +++++++++--------- Cargo.toml | 4 +- src/config.rs | 8 +-- src/db/models/device.rs | 108 ++++++++++++++------------------------ src/db/models/settings.rs | 21 ++++---- src/grpc/mod.rs | 20 ++++--- src/secret.rs | 63 +++++++++------------- tests/auth.rs | 4 +- 8 files changed, 124 insertions(+), 155 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f1be3d7b..e52eb2ad2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -144,11 +144,12 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", + "once_cell", "windows-sys 0.59.0", ] @@ -479,9 +480,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" dependencies = [ "serde", ] @@ -1026,9 +1027,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f" [[package]] name = "dbl" @@ -1088,7 +1089,7 @@ dependencies = [ "ssh-key", "struct-patch", "tera", - "thiserror 1.0.69", + "thiserror 2.0.11", "time", "tokio", "tokio-stream", @@ -1709,7 +1710,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fda788993cc341f69012feba8bf45c0ba4f3291fcc08e214b4d5a7332d88aff" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "libc", "libgit2-sys", "log", @@ -1735,7 +1736,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "ignore", "walkdir", ] @@ -2578,9 +2579,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "matchers" @@ -2652,9 +2653,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" +checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924" dependencies = [ "adler2", ] @@ -2949,7 +2950,7 @@ version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "cfg-if", "foreign-types", "libc", @@ -3521,7 +3522,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "getopts", "memchr", "pulldown-cmark-escape", @@ -3643,7 +3644,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", ] [[package]] @@ -3920,7 +3921,7 @@ version = "0.38.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "errno", "libc", "linux-raw-sys", @@ -4090,9 +4091,9 @@ dependencies = [ [[package]] name = "secrecy" -version = "0.8.0" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a" dependencies = [ "serde", "zeroize", @@ -4104,7 +4105,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "core-foundation", "core-foundation-sys", "libc", @@ -4524,7 +4525,7 @@ checksum = "4560278f0e00ce64938540546f59f590d60beee33fffbd3b9cd47851e5fff233" dependencies = [ "atoi", "base64 0.22.1", - "bitflags 2.7.0", + "bitflags 2.8.0", "byteorder", "bytes", "chrono", @@ -4568,7 +4569,7 @@ checksum = "c5b98a57f363ed6764d5b3a12bfedf62f07aa16e1856a7ddc2a0bb190a959613" dependencies = [ "atoi", "base64 0.22.1", - "bitflags 2.7.0", + "bitflags 2.8.0", "byteorder", "chrono", "crc", @@ -5183,7 +5184,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "bytes", "futures-util", "http 1.2.0", @@ -5533,9 +5534,9 @@ checksum = "e2eebbbfe4093922c2b6734d7c679ebfebd704a0d7e56dfcb0d05818ce28977d" [[package]] name = "uuid" -version = "1.11.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b913a3b5fe84142e269d63cc62b64319ccaf89b748fc31fe025177f767a756c4" +checksum = "744018581f9a3454a9e15beb8a33b017183f1e7c0cd170232a2d1453b23a51c4" dependencies = [ "getrandom", "serde", diff --git a/Cargo.toml b/Cargo.toml index acd52dfd3..6740e695f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,7 +52,7 @@ reqwest = { version = "0.11", features = ["json"] } rsa = { version = "0.9", features = ["pem"] } rust-embed = { version = "8.5", features = ["include-exclude"] } rust-ini = "0.21" -secrecy = { version = "0.8", features = ["serde"] } +secrecy = { version = "0.10", features = ["serde"] } semver = "1.0" serde = { version = "1.0", features = ["derive"] } # match version from webauthn-rs-core @@ -70,7 +70,7 @@ sqlx = { version = "0.8", features = [ ssh-key = "0.6" struct-patch = "0.8" tera = "1.20" -thiserror = "1.0" +thiserror = "2.0" # match axum-extra -> cookies time = { version = "0.3", default-features = false } tokio = { version = "1", features = [ diff --git a/src/config.rs b/src/config.rs index f1f084717..d617d25a9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -9,7 +9,7 @@ use rsa::{ traits::PublicKeyParts, RsaPrivateKey, }; -use secrecy::{ExposeSecret, Secret}; +use secrecy::{ExposeSecret, SecretString}; #[derive(Clone, Parser, Serialize, Debug)] #[command(version)] @@ -27,7 +27,7 @@ pub struct DefGuardConfig { #[arg(long, env = "DEFGUARD_SECRET_KEY")] #[serde(skip_serializing)] - pub secret_key: Secret, + pub secret_key: SecretString, #[arg(long, env = "DEFGUARD_DB_HOST", default_value = "localhost")] pub database_host: String, @@ -43,7 +43,7 @@ pub struct DefGuardConfig { #[arg(long, env = "DEFGUARD_DB_PASSWORD", default_value = "")] #[serde(skip_serializing)] - pub database_password: Secret, + pub database_password: SecretString, #[arg(long, env = "DEFGUARD_HTTP_PORT", default_value_t = 8000)] pub http_port: u16, @@ -63,7 +63,7 @@ pub struct DefGuardConfig { default_value = "pass123" )] #[serde(skip_serializing)] - pub default_admin_password: Secret, + pub default_admin_password: SecretString, #[arg(long, env = "DEFGUARD_OPENID_KEY", value_parser = Self::parse_openid_key)] #[serde(skip_serializing)] diff --git a/src/db/models/device.rs b/src/db/models/device.rs index b5ea0dfb9..978992479 100644 --- a/src/db/models/device.rs +++ b/src/db/models/device.rs @@ -107,14 +107,18 @@ pub struct DeviceNetworkInfo { } impl DeviceInfo { - pub async fn from_device<'e, E>(executor: E, device: Device) -> Result + pub(crate) async fn from_device<'e, E>( + executor: E, + device: Device, + ) -> Result where E: PgExecutor<'e>, { debug!("Generating device info for {device}"); let network_info = query_as!( DeviceNetworkInfo, - "SELECT wireguard_network_id network_id, wireguard_ip \"device_wireguard_ip: IpAddr\", preshared_key, is_authorized \ + "SELECT wireguard_network_id network_id, wireguard_ip \"device_wireguard_ip: IpAddr\", \ + preshared_key, is_authorized \ FROM wireguard_network_device \ WHERE device_id = $1", device.id @@ -232,7 +236,7 @@ pub struct ModifyDevice { impl WireguardNetworkDevice { #[must_use] - pub fn new(network_id: Id, device_id: Id, wireguard_ip: IpAddr) -> Self { + pub(crate) fn new(network_id: Id, device_id: Id, wireguard_ip: IpAddr) -> Self { Self { wireguard_network_id: network_id, wireguard_ip, @@ -243,16 +247,17 @@ impl WireguardNetworkDevice { } } - pub async fn insert<'e, E>(&self, executor: E) -> Result<(), SqlxError> + pub(crate) async fn insert<'e, E>(&self, executor: E) -> Result<(), SqlxError> where E: PgExecutor<'e>, { query!( "INSERT INTO wireguard_network_device \ - (device_id, wireguard_network_id, wireguard_ip, is_authorized, authorized_at, preshared_key) \ - VALUES ($1, $2, $3, $4, $5, $6) \ - ON CONFLICT ON CONSTRAINT device_network \ - DO UPDATE SET wireguard_ip = $3, is_authorized = $4", + (device_id, wireguard_network_id, wireguard_ip, is_authorized, authorized_at, \ + preshared_key) \ + VALUES ($1, $2, $3, $4, $5, $6) \ + ON CONFLICT ON CONSTRAINT device_network \ + DO UPDATE SET wireguard_ip = $3, is_authorized = $4", self.device_id, self.wireguard_network_id, IpNetwork::from(self.wireguard_ip.clone()), @@ -266,7 +271,7 @@ impl WireguardNetworkDevice { Ok(()) } - pub async fn update<'e, E>(&self, executor: E) -> Result<(), SqlxError> + pub(crate) async fn update<'e, E>(&self, executor: E) -> Result<(), SqlxError> where E: PgExecutor<'e>, { @@ -287,7 +292,7 @@ impl WireguardNetworkDevice { Ok(()) } - pub async fn delete<'e, E>(&self, executor: E) -> Result<(), SqlxError> + pub(crate) async fn delete<'e, E>(&self, executor: E) -> Result<(), SqlxError> where E: PgExecutor<'e>, { @@ -303,7 +308,7 @@ impl WireguardNetworkDevice { Ok(()) } - pub async fn find<'e, E>( + pub(crate) async fn find<'e, E>( executor: E, device_id: Id, network_id: Id, @@ -313,7 +318,8 @@ impl WireguardNetworkDevice { { let res = query_as!( Self, - "SELECT device_id, wireguard_network_id, wireguard_ip \"wireguard_ip: IpAddr\", preshared_key, is_authorized, authorized_at \ + "SELECT device_id, wireguard_network_id, wireguard_ip \"wireguard_ip: IpAddr\", \ + preshared_key, is_authorized, authorized_at \ FROM wireguard_network_device \ WHERE device_id = $1 AND wireguard_network_id = $2", device_id, @@ -334,7 +340,8 @@ impl WireguardNetworkDevice { { let result = query_as!( Self, - "SELECT device_id, wireguard_network_id, wireguard_ip \"wireguard_ip: IpAddr\", preshared_key, is_authorized, authorized_at \ + "SELECT device_id, wireguard_network_id, wireguard_ip \"wireguard_ip: IpAddr\", \ + preshared_key, is_authorized, authorized_at \ FROM wireguard_network_device WHERE device_id = $1", device_id ) @@ -348,13 +355,17 @@ impl WireguardNetworkDevice { }) } - pub async fn all_for_network<'e, E>(executor: E, network_id: Id) -> Result, SqlxError> + pub(crate) async fn all_for_network<'e, E>( + executor: E, + network_id: Id, + ) -> Result, SqlxError> where E: PgExecutor<'e>, { let res = query_as!( Self, - "SELECT device_id, wireguard_network_id, wireguard_ip \"wireguard_ip: IpAddr\", preshared_key, is_authorized, authorized_at \ + "SELECT device_id, wireguard_network_id, wireguard_ip \"wireguard_ip: IpAddr\", \ + preshared_key, is_authorized, authorized_at \ FROM wireguard_network_device \ WHERE wireguard_network_id = $1", network_id @@ -402,7 +413,7 @@ impl Device { } impl Device { - pub fn update_from(&mut self, other: ModifyDevice) { + pub(crate) fn update_from(&mut self, other: ModifyDevice) { self.name = other.name; self.wireguard_pubkey = other.wireguard_pubkey; self.description = other.description; @@ -410,7 +421,7 @@ impl Device { /// Create WireGuard config for device. #[must_use] - pub fn create_config( + pub(crate) fn create_config( &self, network: &WireguardNetwork, wireguard_network_device: &WireguardNetworkDevice, @@ -455,7 +466,7 @@ impl Device { ) } - pub async fn find_by_ip<'e, E>( + pub(crate) async fn find_by_ip<'e, E>( executor: E, ip: IpAddr, network_id: Id, @@ -477,7 +488,10 @@ impl Device { .await } - pub async fn find_by_pubkey<'e, E>(executor: E, pubkey: &str) -> Result, SqlxError> + pub(crate) async fn find_by_pubkey<'e, E>( + executor: E, + pubkey: &str, + ) -> Result, SqlxError> where E: PgExecutor<'e>, { @@ -492,7 +506,7 @@ impl Device { .await } - pub async fn find_by_id_and_username( + pub(crate) async fn find_by_id_and_username( pool: &PgPool, id: Id, username: &str, @@ -510,39 +524,10 @@ impl Device { .await } - pub async fn find_by_id_and_user_id( + pub(crate) async fn all_for_username( pool: &PgPool, - id: Id, - user_id: Id, - ) -> Result, SqlxError> { - query_as!( - Self, - "SELECT device.id, name, wireguard_pubkey, user_id, created, description, \ - device_type \"device_type: DeviceType\", configured \ - FROM device JOIN \"user\" ON device.user_id = \"user\".id \ - WHERE device.id = $1 AND \"user\".id = $2", - id, - user_id - ) - .fetch_optional(pool) - .await - } - - pub async fn get_ip(&self, pool: &PgPool, network_id: Id) -> Result, SqlxError> { - let result = query!( - "SELECT wireguard_ip \ - FROM wireguard_network_device \ - WHERE device_id = $1 AND wireguard_network_id = $2", - self.id, - network_id - ) - .fetch_one(pool) - .await?; - - Ok(Some(result.wireguard_ip.to_string())) - } - - pub async fn all_for_username(pool: &PgPool, username: &str) -> Result, SqlxError> { + username: &str, + ) -> Result, SqlxError> { query_as!( Self, "SELECT device.id, name, wireguard_pubkey, user_id, created, description, \ @@ -555,7 +540,7 @@ impl Device { .await } - pub async fn get_network_configs( + pub(crate) async fn get_network_configs( &self, network: &WireguardNetwork, transaction: &mut PgConnection, @@ -588,7 +573,7 @@ impl Device { Ok((device_network_info, device_config)) } - pub async fn add_to_network( + pub(crate) async fn add_to_network( &self, network: &WireguardNetwork, ip: IpAddr, @@ -621,19 +606,6 @@ impl Device { Ok((device_network_info, device_config)) } - pub async fn remove_from_network( - &self, - network: &WireguardNetwork, - transaction: &mut PgConnection, - ) -> Result<(), DeviceError> { - let wireguard_network_device = - WireguardNetworkDevice::find(&mut *transaction, self.id, network.id) - .await? - .ok_or_else(|| DeviceError::Unexpected("Device not found in network".into()))?; - wireguard_network_device.delete(&mut *transaction).await?; - Ok(()) - } - // Add device to all existing networks pub async fn add_to_all_networks( &self, @@ -732,7 +704,7 @@ impl Device { Err(ModelError::CannotCreate) } - pub async fn assign_network_ip( + pub(crate) async fn assign_network_ip( &self, transaction: &mut PgConnection, network: &WireguardNetwork, diff --git a/src/db/models/settings.rs b/src/db/models/settings.rs index a3a2f0c86..f38a5ef5d 100644 --- a/src/db/models/settings.rs +++ b/src/db/models/settings.rs @@ -8,7 +8,7 @@ use sqlx::{query, query_as, PgExecutor, PgPool, Type}; use struct_patch::Patch; use thiserror::Error; -use crate::secret::SecretString; +use crate::secret::SecretStringWrapper; // wrap in `Option` since a static cannot be initialized with a non-const function static SETTINGS: RwLock> = RwLock::new(None); @@ -85,7 +85,7 @@ pub struct Settings { pub smtp_port: Option, pub smtp_encryption: SmtpEncryption, pub smtp_user: Option, - pub smtp_password: Option, + pub smtp_password: Option, pub smtp_sender: Option, // Enrollment pub enrollment_vpn_step_optional: bool, @@ -99,7 +99,7 @@ pub struct Settings { // LDAP pub ldap_url: Option, pub ldap_bind_username: Option, - pub ldap_bind_password: Option, + pub ldap_bind_password: Option, pub ldap_group_search_base: Option, pub ldap_user_search_base: Option, pub ldap_user_obj_class: Option, @@ -127,16 +127,17 @@ impl Settings { "SELECT openid_enabled, wireguard_enabled, webhooks_enabled, \ worker_enabled, challenge_template, instance_name, main_logo_url, nav_logo_url, \ smtp_server, smtp_port, smtp_encryption \"smtp_encryption: _\", smtp_user, \ - smtp_password \"smtp_password?: SecretString\", smtp_sender, \ + smtp_password \"smtp_password?: SecretStringWrapper\", smtp_sender, \ enrollment_vpn_step_optional, enrollment_welcome_message, \ enrollment_welcome_email, enrollment_welcome_email_subject, \ enrollment_use_welcome_message_as_email, uuid, ldap_url, ldap_bind_username, \ - ldap_bind_password \"ldap_bind_password?: SecretString\", \ + ldap_bind_password \"ldap_bind_password?: SecretStringWrapper\", \ ldap_group_search_base, ldap_user_search_base, ldap_user_obj_class, \ ldap_group_obj_class, ldap_username_attr, ldap_groupname_attr, \ ldap_group_member_attr, ldap_member_attr, openid_create_account, \ - license, \ - gateway_disconnect_notifications_enabled, gateway_disconnect_notifications_inactivity_threshold, gateway_disconnect_notifications_reconnect_notification_enabled \ + license, gateway_disconnect_notifications_enabled, \ + gateway_disconnect_notifications_inactivity_threshold, \ + gateway_disconnect_notifications_reconnect_notification_enabled \ FROM \"settings\" WHERE id = 1", ) .fetch_optional(executor) @@ -210,7 +211,7 @@ impl Settings { self.smtp_port, &self.smtp_encryption as &SmtpEncryption, self.smtp_user, - &self.smtp_password as &Option, + &self.smtp_password as &Option, self.smtp_sender, self.enrollment_vpn_step_optional, self.enrollment_welcome_message, @@ -220,7 +221,7 @@ impl Settings { self.uuid, self.ldap_url, self.ldap_bind_username, - &self.ldap_bind_password as &Option, + &self.ldap_bind_password as &Option, self.ldap_group_search_base, self.ldap_user_search_base, self.ldap_user_obj_class, @@ -285,7 +286,7 @@ impl Settings { && self.smtp_server != Some("".to_string()) && self.smtp_user != Some("".to_string()) && self.smtp_password - != Some(SecretString::from_str("").expect("Failed to convert empty string")) + != Some(SecretStringWrapper::from_str("").expect("Failed to convert empty string")) && self.smtp_sender != Some("".to_string()) } } diff --git a/src/grpc/mod.rs b/src/grpc/mod.rs index a4b60e591..ed9f97935 100644 --- a/src/grpc/mod.rs +++ b/src/grpc/mod.rs @@ -335,7 +335,8 @@ impl GatewayState { let network_name = self.network_name.clone(); debug!( - "Scheduling gateway disconnect email notification for {hostname} to be sent in {delay:?}" + "Scheduling gateway disconnect email notification for {hostname} to be sent in \ + {delay:?}" ); // use cancellation token to abort sending if gateway reconnects during the delay // we should never need to cancel a previous token since that would've been done on reconnect @@ -349,8 +350,10 @@ impl GatewayState { tokio::select! { _ = async { sleep(delay).await; - debug!("Gateway disconnect notification delay has passed. Trying to send email..."); - if let Err(e) = send_gateway_disconnected_email(name, network_name, &hostname, &mail_tx, &pool) + debug!("Gateway disconnect notification delay has passed. \ + Trying to send email..."); + if let Err(e) = send_gateway_disconnected_email(name, network_name, &hostname, + &mail_tx, &pool) .await { error!("Failed to send gateway disconnect notification: {e}"); @@ -358,10 +361,11 @@ impl GatewayState { info!("Gateway {hostname} disconnected. Email notification sent",); } } => { - debug!("Scheduled gateway disconnect notification for {hostname} has been sent") + debug!("Scheduled gateway disconnect notification for {hostname} has been \ + sent"); }, _ = cancellation_token.cancelled() => { - info!("Scheduled gateway disconnect notification for {hostname} cancelled") + info!("Scheduled gateway disconnect notification for {hostname} cancelled"); } } }); @@ -399,7 +403,11 @@ impl GatewayState { /// Cancels disconnect notification if one is scheduled to be sent fn cancel_pending_disconnect_notification(&mut self) { - debug!("Checking if there's a gateway disconnect notification for {} pending which needs to be cancelled", self.hostname); + debug!( + "Checking if there's a gateway disconnect notification for {} pending which needs \ + to be cancelled", + self.hostname + ); if let Some(token) = &self.pending_notification_cancel_token { debug!( "Cancelling pending gateway disconnect notification for {}", diff --git a/src/secret.rs b/src/secret.rs index 9eed4570f..2611312e8 100644 --- a/src/secret.rs +++ b/src/secret.rs @@ -1,29 +1,33 @@ use std::{convert::Infallible, error::Error, str::FromStr}; -use secrecy::{ExposeSecret, Secret}; +use secrecy::{ExposeSecret, SecretString}; use serde::{Deserialize, Serialize}; -use sqlx::{encode::IsNull, Database, Decode, Encode, Type}; +use sqlx::{ + encode::IsNull, + postgres::{PgArgumentBuffer, PgTypeInfo, PgValueRef}, + Decode, Encode, Postgres, Type, +}; -/// Wrapper for secrecy Secret struct which implements sqlx Postgres -#[derive(Clone, Deserialize, Debug)] -pub struct SecretString(Secret); +/// Wrapper for secrecy `SecretString` struct which implements sqlx traits. +#[derive(Clone, Debug, Deserialize)] +pub struct SecretStringWrapper(SecretString); -impl SecretString { +impl SecretStringWrapper { #[must_use] pub fn expose_secret(&self) -> &str { self.0.expose_secret() } } -impl FromStr for SecretString { +impl FromStr for SecretStringWrapper { type Err = Infallible; fn from_str(src: &str) -> Result { - Ok(Self(Secret::new(src.to_string()))) + Ok(Self(SecretString::from(src))) } } -impl Serialize for SecretString { +impl Serialize for SecretStringWrapper { fn serialize(&self, ser: S) -> Result where S: serde::Serializer, @@ -32,49 +36,32 @@ impl Serialize for SecretString { } } -impl<'q, DB: Database> Decode<'q, DB> for SecretString -where - String: Decode<'q, DB>, -{ - fn decode(value: ::ValueRef<'q>) -> Result> { - >::decode(value).map(|v| Self(Secret::from(v))) +impl Decode<'_, Postgres> for SecretStringWrapper { + fn decode(value: PgValueRef<'_>) -> Result> { + >::decode(value).map(|v| Self(SecretString::from(v))) } } -impl<'q, DB: Database> Encode<'q, DB> for SecretString -where - String: Encode<'q, DB>, -{ +impl Encode<'_, Postgres> for SecretStringWrapper { fn encode_by_ref( &self, - buf: &mut ::ArgumentBuffer<'q>, + buf: &mut PgArgumentBuffer, ) -> Result> { - >::encode_by_ref(self.0.expose_secret(), buf) - } - - fn produces(&self) -> Option { - >::produces(self.0.expose_secret()) - } - - fn size_hint(&self) -> usize { - >::size_hint(self.0.expose_secret()) + <&str as Encode>::encode_by_ref(&self.0.expose_secret(), buf) } } -impl Type for SecretString -where - String: Type, -{ - fn type_info() -> DB::TypeInfo { - >::type_info() +impl Type for SecretStringWrapper { + fn type_info() -> PgTypeInfo { + >::type_info() } - fn compatible(ty: &DB::TypeInfo) -> bool { - >::compatible(ty) + fn compatible(ty: &PgTypeInfo) -> bool { + >::compatible(ty) } } -impl PartialEq for SecretString { +impl PartialEq for SecretStringWrapper { fn eq(&self, other: &Self) -> bool { self.0.expose_secret() == other.0.expose_secret() } diff --git a/tests/auth.rs b/tests/auth.rs index a2daa86fc..d31eea478 100644 --- a/tests/auth.rs +++ b/tests/auth.rs @@ -11,7 +11,7 @@ use defguard::{ models::settings::update_current_settings, MFAInfo, MFAMethod, Settings, User, UserDetails, }, handlers::{Auth, AuthCode, AuthResponse, AuthTotp}, - secret::SecretString, + secret::SecretStringWrapper, }; use reqwest::{header::USER_AGENT, StatusCode}; use serde::Deserialize; @@ -302,7 +302,7 @@ async fn test_email_mfa() { settings.smtp_server = Some("smtp_server".into()); settings.smtp_port = Some(587); settings.smtp_user = Some("dummy_user".into()); - settings.smtp_password = Some(SecretString::from_str("dummy_password").unwrap()); + settings.smtp_password = Some(SecretStringWrapper::from_str("dummy_password").unwrap()); settings.smtp_sender = Some("smtp@sender.pl".into()); update_current_settings(&pool, settings).await.unwrap(); From a3e0d79ca0806e0a710e0eb820995c5d6ac0df6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 15 Jan 2025 15:57:51 +0100 Subject: [PATCH 2/3] Update tonic/prost --- Cargo.lock | 235 +++++++++++++++++++++++------------------------------ Cargo.toml | 14 ++-- build.rs | 2 +- 3 files changed, 110 insertions(+), 141 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e52eb2ad2..471ba6419 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -263,38 +263,16 @@ dependencies = [ ] [[package]] -name = "autocfg" -version = "1.4.0" +name = "atomic-waker" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] -name = "axum" -version = "0.6.20" +name = "autocfg" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" -dependencies = [ - "async-trait", - "axum-core 0.3.4", - "bitflags 1.3.2", - "bytes", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.32", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "sync_wrapper 0.1.2", - "tower 0.4.13", - "tower-layer", - "tower-service", -] +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "axum" @@ -303,7 +281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", - "axum-core 0.4.5", + "axum-core", "bytes", "futures-util", "http 1.2.0", @@ -336,28 +314,11 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e7c467bdcd2bd982ce5c8742a1a178aba7b03db399fd18f5d5d438f5aa91cb4" dependencies = [ - "axum 0.7.9", + "axum", "forwarded-header-value", "serde", ] -[[package]] -name = "axum-core" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "mime", - "rustversion", - "tower-layer", - "tower-service", -] - [[package]] name = "axum-core" version = "0.4.5" @@ -385,8 +346,8 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c794b30c904f0a1c2fb7740f7df7f7972dfaa14ef6f57cb6178dc63e5dca2f04" dependencies = [ - "axum 0.7.9", - "axum-core 0.4.5", + "axum", + "axum-core", "bytes", "cookie 0.18.1", "fastrand", @@ -671,12 +632,9 @@ dependencies = [ [[package]] name = "claims" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6995bbe186456c36307f8ea36be3eefe42f49d106896414e18efc4fb2f846b5" -dependencies = [ - "autocfg", -] +checksum = "bba18ee93d577a8428902687bcc2b6b45a56b1981a1f6d779731c86cc4c5db18" [[package]] name = "clap" @@ -846,6 +804,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -1046,7 +1014,7 @@ version = "1.1.4" dependencies = [ "anyhow", "argon2", - "axum 0.7.9", + "axum", "axum-client-ip", "axum-extra", "base32", @@ -1771,6 +1739,25 @@ dependencies = [ "tracing", ] +[[package]] +name = "h2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.2.0", + "indexmap 2.7.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "1.8.3" @@ -1986,7 +1973,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -2009,6 +1996,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", + "h2 0.4.7", "http 1.2.0", "http-body 1.0.1", "httparse", @@ -2054,14 +2042,15 @@ dependencies = [ [[package]] name = "hyper-timeout" -version = "0.4.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ - "hyper 0.14.32", + "hyper 1.5.2", + "hyper-util", "pin-project-lite", "tokio", - "tokio-io-timeout", + "tower-service", ] [[package]] @@ -2368,9 +2357,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -2714,7 +2703,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework", + "security-framework 2.11.1", "security-framework-sys", "tempfile", ] @@ -3440,9 +3429,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.6" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +checksum = "2c0fef6c4230e4ccf618a35c59d7ede15dea37de8427500f50aff708806e42ec" dependencies = [ "bytes", "prost-derive", @@ -3450,13 +3439,12 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.6" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" +checksum = "d0f3e5beed80eb580c68e2c600937ac2c4eedabdfd5ef1e5b7ea4f3fba84497b" dependencies = [ - "bytes", "heck", - "itertools 0.12.1", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -3471,12 +3459,12 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.6" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.13.0", "proc-macro2", "quote", "syn 2.0.96", @@ -3484,9 +3472,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.6" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +checksum = "cc2f1e56baa61e93533aebc21af4d2134b70f66275e0fcdf3cbe43d77ff7e8fc" dependencies = [ "prost", ] @@ -3704,7 +3692,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.32", @@ -3940,26 +3928,13 @@ dependencies = [ "sct", ] -[[package]] -name = "rustls" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" -dependencies = [ - "log", - "ring", - "rustls-pki-types", - "rustls-webpki 0.102.8", - "subtle", - "zeroize", -] - [[package]] name = "rustls" version = "0.23.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8" dependencies = [ + "log", "once_cell", "ring", "rustls-pki-types", @@ -3970,15 +3945,14 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile 2.2.0", "rustls-pki-types", "schannel", - "security-framework", + "security-framework 3.2.0", ] [[package]] @@ -4106,7 +4080,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.8.0", - "core-foundation", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +dependencies = [ + "bitflags 2.8.0", + "core-foundation 0.10.0", "core-foundation-sys", "libc", "security-framework-sys", @@ -4784,7 +4771,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -4968,16 +4955,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" version = "2.5.0" @@ -5009,17 +4986,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" -dependencies = [ - "rustls 0.22.4", - "rustls-pki-types", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.1" @@ -5074,29 +5040,31 @@ dependencies = [ [[package]] name = "tonic" -version = "0.11.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" dependencies = [ "async-stream", "async-trait", - "axum 0.6.20", - "base64 0.21.7", + "axum", + "base64 0.22.1", "bytes", "flate2", - "h2", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.32", + "h2 0.4.7", + "http 1.2.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.5.2", "hyper-timeout", + "hyper-util", "percent-encoding", "pin-project", "prost", "rustls-native-certs", "rustls-pemfile 2.2.0", - "rustls-pki-types", + "socket2", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.1", "tokio-stream", "tower 0.4.13", "tower-layer", @@ -5106,22 +5074,23 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.11.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" +checksum = "9557ce109ea773b399c9b9e5dca39294110b74f1f342cb347a80d1fce8c26a11" dependencies = [ "prettyplease", "proc-macro2", "prost-build", + "prost-types", "quote", "syn 2.0.96", ] [[package]] name = "tonic-health" -version = "0.11.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cef6e24bc96871001a7e48e820ab240b3de2201e59b517cf52835df2f1d2350" +checksum = "1eaf34ddb812120f5c601162d5429933c9b527d901ab0e7f930d3147e33a09b2" dependencies = [ "async-stream", "prost", @@ -5180,9 +5149,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.5.2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" dependencies = [ "bitflags 2.8.0", "bytes", @@ -5513,7 +5482,7 @@ version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "943e0ff606c6d57d410fd5663a4d7c074ab2c5f14ab903b9514565e59fa1189e" dependencies = [ - "axum 0.7.9", + "axum", "mime_guess", "regex", "reqwest 0.12.12", diff --git a/Cargo.toml b/Cargo.toml index 6740e695f..2538a43a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ openidconnect = { version = "3.5", default-features = false, optional = true, fe "reqwest", ] } pgp = "0.14" -prost = "0.12" +prost = "0.13" pulldown-cmark = "0.12" rand = "0.8" rand_core = { version = "0.6", default-features = false, features = [ @@ -83,10 +83,10 @@ tokio = { version = "1", features = [ ] } tokio-stream = "0.1" tokio-util = "0.7" -tonic = { version = "0.11", features = ["gzip", "tls", "tls-roots"] } -tonic-health = "0.11" +tonic = { version = "0.12", features = ["gzip", "tls", "tls-roots"] } +tonic-health = "0.12" totp-lite = { version = "2.0" } -tower-http = { version = "0.5", features = ["fs", "trace"] } +tower-http = { version = "0.6", features = ["fs", "trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } trait-variant = "0.1" @@ -104,7 +104,7 @@ x25519-dalek = { version = "2.0", features = ["static_secrets"] } [dev-dependencies] bytes = "1.6" -claims = "0.7" +claims = "0.8" matches = "0.1" regex = "1.10" reqwest = { version = "0.11", features = [ @@ -118,8 +118,8 @@ serde_qs = "0.13" webauthn-authenticator-rs = { version = "0.5", features = ["softpasskey"] } [build-dependencies] -prost-build = "0.12" -tonic-build = "0.11" +prost-build = "0.13" +tonic-build = "0.12" vergen-git2 = { version = "1.0", features = ["build"] } [features] diff --git a/build.rs b/build.rs index aff731c9d..818835a98 100644 --- a/build.rs +++ b/build.rs @@ -11,7 +11,7 @@ fn main() -> Result<(), Box> { "license.LicenseLimits", "#[derive(serde::Serialize, serde::Deserialize)]", ); - tonic_build::configure().compile_with_config( + tonic_build::configure().compile_protos_with_config( config, &[ "proto/core/auth.proto", From 8bdefc97d3d6945ee3651a776e288c226c23e2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 15 Jan 2025 15:58:33 +0100 Subject: [PATCH 3/3] Update .sqlx --- ...e87a85eb04e2b0eec2d9bc63e8fee6abda27e.json | 23 ------ ...0ab40e9045d220622de7a50b14db19b0dad93.json | 75 ------------------- ...a482bed34f4322b68ee24defb825d0484471.json} | 8 +- 3 files changed, 4 insertions(+), 102 deletions(-) delete mode 100644 .sqlx/query-035360e0dd260aece5c89979b28e87a85eb04e2b0eec2d9bc63e8fee6abda27e.json delete mode 100644 .sqlx/query-9df3fb838f3e4323482bca3e0b80ab40e9045d220622de7a50b14db19b0dad93.json rename .sqlx/{query-8991cfc5792e48b724b8701d5218c96be06a9f09ab3c5f6f0567d9dcd8304294.json => query-a90f80642df16af7e6282ac3c329a482bed34f4322b68ee24defb825d0484471.json} (84%) diff --git a/.sqlx/query-035360e0dd260aece5c89979b28e87a85eb04e2b0eec2d9bc63e8fee6abda27e.json b/.sqlx/query-035360e0dd260aece5c89979b28e87a85eb04e2b0eec2d9bc63e8fee6abda27e.json deleted file mode 100644 index 30fd8c341..000000000 --- a/.sqlx/query-035360e0dd260aece5c89979b28e87a85eb04e2b0eec2d9bc63e8fee6abda27e.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT wireguard_ip FROM wireguard_network_device WHERE device_id = $1 AND wireguard_network_id = $2", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "wireguard_ip", - "type_info": "Inet" - } - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - }, - "nullable": [ - false - ] - }, - "hash": "035360e0dd260aece5c89979b28e87a85eb04e2b0eec2d9bc63e8fee6abda27e" -} diff --git a/.sqlx/query-9df3fb838f3e4323482bca3e0b80ab40e9045d220622de7a50b14db19b0dad93.json b/.sqlx/query-9df3fb838f3e4323482bca3e0b80ab40e9045d220622de7a50b14db19b0dad93.json deleted file mode 100644 index abd8b36f0..000000000 --- a/.sqlx/query-9df3fb838f3e4323482bca3e0b80ab40e9045d220622de7a50b14db19b0dad93.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT device.id, name, wireguard_pubkey, user_id, created, description, device_type \"device_type: DeviceType\", configured FROM device JOIN \"user\" ON device.user_id = \"user\".id WHERE device.id = $1 AND \"user\".id = $2", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Int8" - }, - { - "ordinal": 1, - "name": "name", - "type_info": "Text" - }, - { - "ordinal": 2, - "name": "wireguard_pubkey", - "type_info": "Text" - }, - { - "ordinal": 3, - "name": "user_id", - "type_info": "Int8" - }, - { - "ordinal": 4, - "name": "created", - "type_info": "Timestamp" - }, - { - "ordinal": 5, - "name": "description", - "type_info": "Text" - }, - { - "ordinal": 6, - "name": "device_type: DeviceType", - "type_info": { - "Custom": { - "name": "device_type", - "kind": { - "Enum": [ - "user", - "network" - ] - } - } - } - }, - { - "ordinal": 7, - "name": "configured", - "type_info": "Bool" - } - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - true, - false, - false - ] - }, - "hash": "9df3fb838f3e4323482bca3e0b80ab40e9045d220622de7a50b14db19b0dad93" -} diff --git a/.sqlx/query-8991cfc5792e48b724b8701d5218c96be06a9f09ab3c5f6f0567d9dcd8304294.json b/.sqlx/query-a90f80642df16af7e6282ac3c329a482bed34f4322b68ee24defb825d0484471.json similarity index 84% rename from .sqlx/query-8991cfc5792e48b724b8701d5218c96be06a9f09ab3c5f6f0567d9dcd8304294.json rename to .sqlx/query-a90f80642df16af7e6282ac3c329a482bed34f4322b68ee24defb825d0484471.json index 5ba69fc9f..663ceb874 100644 --- a/.sqlx/query-8991cfc5792e48b724b8701d5218c96be06a9f09ab3c5f6f0567d9dcd8304294.json +++ b/.sqlx/query-a90f80642df16af7e6282ac3c329a482bed34f4322b68ee24defb825d0484471.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT openid_enabled, wireguard_enabled, webhooks_enabled, worker_enabled, challenge_template, instance_name, main_logo_url, nav_logo_url, smtp_server, smtp_port, smtp_encryption \"smtp_encryption: _\", smtp_user, smtp_password \"smtp_password?: SecretString\", smtp_sender, enrollment_vpn_step_optional, enrollment_welcome_message, enrollment_welcome_email, enrollment_welcome_email_subject, enrollment_use_welcome_message_as_email, uuid, ldap_url, ldap_bind_username, ldap_bind_password \"ldap_bind_password?: SecretString\", ldap_group_search_base, ldap_user_search_base, ldap_user_obj_class, ldap_group_obj_class, ldap_username_attr, ldap_groupname_attr, ldap_group_member_attr, ldap_member_attr, openid_create_account, license, gateway_disconnect_notifications_enabled, gateway_disconnect_notifications_inactivity_threshold, gateway_disconnect_notifications_reconnect_notification_enabled FROM \"settings\" WHERE id = 1", + "query": "SELECT openid_enabled, wireguard_enabled, webhooks_enabled, worker_enabled, challenge_template, instance_name, main_logo_url, nav_logo_url, smtp_server, smtp_port, smtp_encryption \"smtp_encryption: _\", smtp_user, smtp_password \"smtp_password?: SecretStringWrapper\", smtp_sender, enrollment_vpn_step_optional, enrollment_welcome_message, enrollment_welcome_email, enrollment_welcome_email_subject, enrollment_use_welcome_message_as_email, uuid, ldap_url, ldap_bind_username, ldap_bind_password \"ldap_bind_password?: SecretStringWrapper\", ldap_group_search_base, ldap_user_search_base, ldap_user_obj_class, ldap_group_obj_class, ldap_username_attr, ldap_groupname_attr, ldap_group_member_attr, ldap_member_attr, openid_create_account, license, gateway_disconnect_notifications_enabled, gateway_disconnect_notifications_inactivity_threshold, gateway_disconnect_notifications_reconnect_notification_enabled FROM \"settings\" WHERE id = 1", "describe": { "columns": [ { @@ -76,7 +76,7 @@ }, { "ordinal": 12, - "name": "smtp_password?: SecretString", + "name": "smtp_password?: SecretStringWrapper", "type_info": "Text" }, { @@ -126,7 +126,7 @@ }, { "ordinal": 22, - "name": "ldap_bind_password?: SecretString", + "name": "ldap_bind_password?: SecretStringWrapper", "type_info": "Text" }, { @@ -237,5 +237,5 @@ false ] }, - "hash": "8991cfc5792e48b724b8701d5218c96be06a9f09ab3c5f6f0567d9dcd8304294" + "hash": "a90f80642df16af7e6282ac3c329a482bed34f4322b68ee24defb825d0484471" }