diff --git a/src/bin/batch_ingest.rs b/src/bin/batch_ingest.rs index bc6d5b1..4a0fe65 100644 --- a/src/bin/batch_ingest.rs +++ b/src/bin/batch_ingest.rs @@ -70,7 +70,9 @@ async fn main() -> Result<()> { let ingester = BatchIngester::new(db, queue_service, file_service, config); println!("Starting batch ingestion from: {}", directory); - println!("User ID: {}", user_id); + // Only show the first and last character of the user ID + let masked_user_id = format!("{}{}", &user_id.to_string()[..1], &user_id.to_string()[user_id.to_string().len() - 1..]); + println!("User ID: {}", masked_user_id); // Start ingestion if let Err(e) = ingester.ingest_directory(dir_path, user_id).await { diff --git a/src/config.rs b/src/config.rs index e3a763b..2c17566 100644 --- a/src/config.rs +++ b/src/config.rs @@ -59,7 +59,9 @@ impl Config { let credentials = &credentials_part[username_start + 3..]; if let Some(colon_pos) = credentials.find(':') { let username = &credentials[..colon_pos]; - format!("{}{}:***@{}", protocol, username, remaining_part) + // Show first and last character of the username + let masked_username = format!("{}{}", &username[..1], &username[username.len() - 1..]); + format!("{}{}:***@{}", protocol, masked_username, remaining_part) } else { format!("{}***@{}", protocol, remaining_part) } diff --git a/src/main.rs b/src/main.rs index dd4a143..a386786 100644 --- a/src/main.rs +++ b/src/main.rs @@ -108,8 +108,10 @@ async fn main() -> anyhow::Result<()> { } else { "unknown" }; + // if we get the username, let's now mask it to get just the first and last character + let masked_username = format!("{}{}", &username[..1], &username[username.len() - 1..]); - format!("{}://{}:***@{}", protocol, username, host_part) + format!("{}://{}:***@{}", protocol, masked_username, host_part) } else { "Invalid database URL format".to_string() };