review(mail/reporting): below-cut security & robustness follow-ups #297

Closed
opened 2026-07-04 06:46:40 +00:00 by JMR-dev · 0 comments
JMR-dev commented 2026-07-04 06:46:40 +00:00 (Migrated from github.com)

Phase-3 review — below-the-cut findings (Backlog, for review):

  • Dormant conn-retry double-apply (ImapConnectionCache.kt:57): the rebuild-and-retry re-executes mutations (expunge/copy) on a fresh socket — double-applies if the server committed before the connection dropped. Dormant (reuseConnections off, #125) but a landmine to fix before that flag ships; restrict retry to idempotent reads.
  • Email in logcat (SendWorker.kt:146, IdleService.kt:167): Log.w writes account.email to logcat (not the debug report). Prefer a non-identifying account id.
  • Subject CRLF (SmtpSender.kt:65, GraphSender.kt:97): strip CR/LF from subject before setSubject (header-injection defense-in-depth).
  • Charset fallback (ImapClient.kt:486): part.content.toString() throws on unsupported/mislabeled charset → whole body fetch fails; fall back to raw-bytes best-effort.
  • https-enforce endpoint (ReportUploadWorker.kt:54): reject non-https DEBUG_REPORT_ENDPOINT (cleartext report POST if ever configured http).
  • Link URL scheme allow-list (RichText.kt:36/RichTextHtmlParser.kt:277): allow-list http/https/mailto/tel on link create+parse (outgoing-mail defense-in-depth).
Phase-3 review — below-the-cut findings (Backlog, for review): - **Dormant conn-retry double-apply** (`ImapConnectionCache.kt:57`): the rebuild-and-retry re-executes mutations (expunge/copy) on a fresh socket — double-applies if the server committed before the connection dropped. Dormant (reuseConnections off, #125) but a landmine to fix before that flag ships; restrict retry to idempotent reads. - **Email in logcat** (`SendWorker.kt:146`, `IdleService.kt:167`): `Log.w` writes `account.email` to logcat (not the debug report). Prefer a non-identifying account id. - **Subject CRLF** (`SmtpSender.kt:65`, `GraphSender.kt:97`): strip CR/LF from subject before `setSubject` (header-injection defense-in-depth). - **Charset fallback** (`ImapClient.kt:486`): `part.content.toString()` throws on unsupported/mislabeled charset → whole body fetch fails; fall back to raw-bytes best-effort. - **https-enforce endpoint** (`ReportUploadWorker.kt:54`): reject non-`https` `DEBUG_REPORT_ENDPOINT` (cleartext report POST if ever configured http). - **Link URL scheme allow-list** (`RichText.kt:36`/`RichTextHtmlParser.kt:277`): allow-list http/https/mailto/tel on link create+parse (outgoing-mail defense-in-depth).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JMR-dev/LibreMail#297