From 76d9038e5b953db2c5b5be2d4f3e6212af48a6df Mon Sep 17 00:00:00 2001 From: Dionisio Date: Thu, 12 Feb 2026 12:29:12 +0100 Subject: [PATCH] fix: resolve compiler warnings and downgrade JWT secret log to warn - Downgrade OXICLOUD_JWT_SECRET missing log from error to warn level, since generating a random secret per session is valid behavior - Remove unused import super::* in calendar_storage_adapter tests - Remove unused import tokio_stream::StreamExt in compression_service tests - Prefix unused validate_user_ownership with _ in trash_service - Add nohup.out to .gitignore --- .gitignore | 1 + src/application/services/trash_service.rs | 2 +- src/common/config.rs | 12 ++++++------ .../adapters/calendar_storage_adapter.rs | 2 -- src/infrastructure/services/compression_service.rs | 1 - 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 465f0bc7..59fd19e4 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ logs/ *.bak *.swp *.swo +nohup.out diff --git a/src/application/services/trash_service.rs b/src/application/services/trash_service.rs index 524354b7..ae54278c 100644 --- a/src/application/services/trash_service.rs +++ b/src/application/services/trash_service.rs @@ -80,7 +80,7 @@ impl TrashService { /// Validates that the given user owns the trashed item. /// Returns an error if the item does not exist or belongs to a different user. #[instrument(skip(self))] - async fn validate_user_ownership(&self, item_id: &str, user_id: &str) -> Result<()> { + async fn _validate_user_ownership(&self, item_id: &str, user_id: &str) -> Result<()> { let item_uuid = Uuid::parse_str(item_id) .map_err(|e| DomainError::validation_error(format!("Invalid item ID: {}", e)))?; let user_uuid = Uuid::parse_str(user_id) diff --git a/src/common/config.rs b/src/common/config.rs index b4c562ed..353c9b44 100644 --- a/src/common/config.rs +++ b/src/common/config.rs @@ -464,12 +464,12 @@ impl AppConfig { let generated_secret: String = key.iter().map(|b| format!("{:02x}", b)).collect(); config.auth.jwt_secret = generated_secret; - tracing::error!("=========================================================="); - tracing::error!("SECURITY WARNING: OXICLOUD_JWT_SECRET is not set!"); - tracing::error!("A random secret has been generated for this session."); - tracing::error!("All tokens will be INVALIDATED on restart."); - tracing::error!("Set OXICLOUD_JWT_SECRET env var for production use."); - tracing::error!("=========================================================="); + tracing::warn!("=========================================================="); + tracing::warn!("OXICLOUD_JWT_SECRET is not set."); + tracing::warn!("A random secret has been generated for this session."); + tracing::warn!("All tokens will be INVALIDATED on restart."); + tracing::warn!("Set OXICLOUD_JWT_SECRET env var for production use."); + tracing::warn!("=========================================================="); } if let Ok(access_token_expiry) = env::var("OXICLOUD_ACCESS_TOKEN_EXPIRY_SECS") diff --git a/src/infrastructure/adapters/calendar_storage_adapter.rs b/src/infrastructure/adapters/calendar_storage_adapter.rs index 316ccf35..3121e2c2 100644 --- a/src/infrastructure/adapters/calendar_storage_adapter.rs +++ b/src/infrastructure/adapters/calendar_storage_adapter.rs @@ -294,7 +294,5 @@ impl CalendarStoragePort for CalendarStorageAdapter { #[cfg(test)] mod tests { - use super::*; - // Tests would go here using mock repositories } diff --git a/src/infrastructure/services/compression_service.rs b/src/infrastructure/services/compression_service.rs index 96a9f4cc..9b822b5c 100644 --- a/src/infrastructure/services/compression_service.rs +++ b/src/infrastructure/services/compression_service.rs @@ -382,7 +382,6 @@ impl CompressionPort for GzipCompressionService { #[cfg(test)] mod tests { use super::*; - use tokio_stream::StreamExt; use futures::TryStreamExt; #[tokio::test]