[Security audit] Replace silent IMAP/SMTP exception handling with narrow logging #14

Closed
opened 2026-07-13 20:11:29 +02:00 by zemion · 1 comment
Owner

Bandit/Ruff flag production try/except blocks that silently pass in mail sending/sync code.

Source report: /mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949/bandit.json

Observed locations:

  • src/govoplan_mail/backend/sending/imap.py
  • src/govoplan_mail/backend/sending/smtp.py

Acceptance criteria:

  • Replace silent handling with narrow exception types where possible.
  • Add debug or warning logging that does not leak credentials or message content.
  • Preserve best-effort cleanup behavior where appropriate.
  • Add narrow suppressions only where silence is explicitly intentional.
<!-- codex-security-audit-fingerprint:security-audit-20260713-mail-silent-exceptions --> Bandit/Ruff flag production `try`/`except` blocks that silently pass in mail sending/sync code. Source report: `/mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949/bandit.json` Observed locations: - `src/govoplan_mail/backend/sending/imap.py` - `src/govoplan_mail/backend/sending/smtp.py` Acceptance criteria: - Replace silent handling with narrow exception types where possible. - Add debug or warning logging that does not leak credentials or message content. - Preserve best-effort cleanup behavior where appropriate. - Add narrow suppressions only where silence is explicitly intentional.
Author
Owner

Codex State: done

Summary

  • Replaced silent SMTP/IMAP cleanup exception handlers with debug logging that avoids credentials and message content.

Changed Files

  • src/govoplan_mail/backend/sending/imap.py
  • src/govoplan_mail/backend/sending/smtp.py

Verification

  • rg -n '^\s*pass(\s*#.*)?$' src/govoplan_mail/backend/sending/imap.py src/govoplan_mail/backend/sending/smtp.py
  • /mnt/DATA/git/govoplan/.venv/bin/python -m py_compile src/govoplan_mail/backend/sending/imap.py src/govoplan_mail/backend/sending/smtp.py
  • git diff --check -- src/govoplan_mail/backend/sending/imap.py src/govoplan_mail/backend/sending/smtp.py
  • PYTHONPATH=/mnt/DATA/git/govoplan-mail/src:/mnt/DATA/git/govoplan-core/src /mnt/DATA/git/govoplan/.venv/bin/python -m unittest discover -s /mnt/DATA/git/govoplan-mail/tests
## Codex State: done ### Summary - Replaced silent SMTP/IMAP cleanup exception handlers with debug logging that avoids credentials and message content. ### Changed Files - `src/govoplan_mail/backend/sending/imap.py` - `src/govoplan_mail/backend/sending/smtp.py` ### Verification - `rg -n '^\s*pass(\s*#.*)?$' src/govoplan_mail/backend/sending/imap.py src/govoplan_mail/backend/sending/smtp.py` - `/mnt/DATA/git/govoplan/.venv/bin/python -m py_compile src/govoplan_mail/backend/sending/imap.py src/govoplan_mail/backend/sending/smtp.py` - `git diff --check -- src/govoplan_mail/backend/sending/imap.py src/govoplan_mail/backend/sending/smtp.py` - `PYTHONPATH=/mnt/DATA/git/govoplan-mail/src:/mnt/DATA/git/govoplan-core/src /mnt/DATA/git/govoplan/.venv/bin/python -m unittest discover -s /mnt/DATA/git/govoplan-mail/tests`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-mail#14
No description provided.