Skip to content

Verify SMTP server hostname on SSL/TLS connections - #527

Merged
NicoPiel merged 1 commit into
OpenIntegrationEngine:mainfrom
NicoPiel:fix/smtp-hostname-verification
Nov 18, 2026
Merged

NicoPiel merged 1 commit into
OpenIntegrationEngine:mainfrom
NicoPiel:fix/smtp-hostname-verification

Conversation

@NicoPiel

Copy link
Copy Markdown
Contributor

What

Calls email.setSSLCheckServerIdentity(true) wherever SMTP is set up with SSL or STARTTLS:

  • DefaultSmtpConfiguration (SMTP Sender connector)
  • DefaultConfigurationController (server email settings / test email)
  • ServerSMTPConnection

Why

SonarQube flags these as java:S5527 (6 critical issues). By default commons-email checks the certificate chain but never matches the certificate to the host. So anyone in the network path with any valid certificate could intercept SMTP traffic, including the login credentials.

Reviewer notes

  • Behavior change: if a setup reaches its mail server by IP address, or the server's certificate doesn't match the configured hostname, sending mail will now fail during the TLS handshake. Worth a line in the release notes.
  • Verified with ./gradlew :server:compileJava on JDK 17. No automated tests cover these paths, and I haven't tested it against a real TLS mail server.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Test Results

  144 files  ±0    144 suites  ±0   4m 15s ⏱️ +23s
  964 tests ±0    964 ✅ ±0  0 💤 ±0  0 ❌ ±0 
1 246 runs  ±0  1 240 ✅ ±0  6 💤 ±0  0 ❌ ±0 

Results for commit dc6587c. ± Comparison against base commit 89f1c03.

♻️ This comment has been updated with latest results.

@mgaffigan mgaffigan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be exploitable with MITM. Probably needs a CVE filed.

@gibson9583 gibson9583 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks safe to merge.

@jonbartels jonbartels left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Needs a note in the release notes so that users using SMTP that would somehow not pass the server identity check to fix that BEFORE upgrading.

@tonygermano
tonygermano force-pushed the fix/smtp-hostname-verification branch from fbfc446 to dc6587c Compare November 18, 2026 18:33
@tonygermano
tonygermano removed their request for review November 18, 2026 18:38
commons-email only checks the certificate chain by default, so any
valid certificate was accepted regardless of host. Enable server
identity checking wherever SSL or STARTTLS is configured.

Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Tony Germano <tony@germano.name>
@NicoPiel
NicoPiel force-pushed the fix/smtp-hostname-verification branch from dc6587c to cfde7ec Compare November 18, 2026 21:38
@NicoPiel
NicoPiel merged commit cfde7ec into OpenIntegrationEngine:main Nov 18, 2026
9 of 10 checks passed
@tonygermano tonygermano added this to the Next Release milestone Nov 18, 2026
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.

5 participants