Skip to content

Add IMAP host and port validation - #170

Open
2W0-5T3P wants to merge 2 commits into
vas3k:mainfrom
2W0-5T3P:imap-validation
Open

Add IMAP host and port validation#170
2W0-5T3P wants to merge 2 commits into
vas3k:mainfrom
2W0-5T3P:imap-validation

Conversation

@2W0-5T3P

Copy link
Copy Markdown
Contributor

summary
Added IMAP connection hardening so email servers are validated before any connection attempt is made. The change blocks unsafe targets, enforces allowed ports, resolves hostnames before connecting, and logs rejected attempts for monitoring.

What changed

  • Added a dedicated IMAP validation layer for host/port checks
  • Restricted IMAP to ports 143 and 993
  • Rejected localhost and private/local addresses
  • Validated DNS-resolved IPs to reduce rebinding risk
  • Rejected direct IP literals by default
  • Applied validation before saving/updating email server settings and before testing connections
  • Reduced connection/auth timeout behavior to fail fast

Why
This improves the security posture of the email sync flow by preventing connections to internal, localhost, or private infrastructure and by reducing exposure to misconfigured or hostile IMAP endpoints. highlighted in this issue #148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant