Fix code review issues - remove message re-indexing, add security notes, fix CAPA
Co-authored-by: setoelkahfi <1797197+setoelkahfi@users.noreply.github.com>
copilot-swe-agent[bot] committed
Oct 13, 2025 at 16:15 UTC
9e79fd7583e87e7f365af5c4a632349c35349d93
2 files changed
+5
-9
src/handle_pop3_session.rs
+3
-5
@@ -52,7 +52,9 @@ where
52
} else if parts.len() < 2 {
53
send_commands(&mut framed, vec!["-ERR Password required".to_string()]).await?;
54
} else {
55
- // Simple authentication - accept any password for now
55
+ // SECURITY NOTE: For demonstration purposes only - accepts any password
56
+ // In production, implement proper authentication against a user database
57
+ // with securely hashed passwords
58
let user = username.clone().unwrap();
59
authenticated_user = Some(user.clone());
60
@@ -65,8 +67,6 @@ where
67
send_commands(&mut framed, vec![
68
"+OK Capability list follows".to_string(),
69
"USER".to_string(),
68
- "UIDL".to_string(),
69
- "TOP".to_string(),
70
".".to_string(),
71
]).await?;
72
}
@@ -175,8 +175,6 @@ where
175
send_commands(&mut framed, vec![
176
"+OK Capability list follows".to_string(),
177
"USER".to_string(),
178
- "UIDL".to_string(),
179
- "TOP".to_string(),
178
".".to_string(),
179
]).await?;
180
}
src/pop3_storage.rs
+2
-4
@@ -71,11 +71,9 @@ impl Pop3Mailbox {
71
pub fn delete_marked(&self, username: &str) {
72
let mut messages = self.messages.lock().unwrap();
73
if let Some(user_messages) = messages.get_mut(username) {
74
+ // Delete marked messages without re-indexing
75
+ // This preserves message IDs for any remaining messages
76
user_messages.retain(|m| !m.deleted);
75
- // Re-index messages after deletion
76
- for (idx, msg) in user_messages.iter_mut().enumerate() {
77
- msg.id = idx + 1;
78
- }
77
}
78
}
79