Skip to content

Make STARTTLS mandatory: support starttls.required in external.email #246

Closed

Description

@vharseko

Problem

EmailClient never sets mail.smtp.starttls.required, so STARTTLS is opportunistic. When the server's EHLO reply does not advertise STARTTLS, javax.mail 1.4.7's SMTPTransport throws only if mail.smtp.starttls.required is true. Otherwise it continues in clear and goes on to AUTH.

An on-path attacker who strips STARTTLS from the EHLO reply therefore gets the SMTP credentials and the message in clear, and the certificate checks added in #206 never run. The current behaviour is documented (chap-mail.adoc: "If the server does not support STARTTLS, the connection continues without the use of TLS").

Raised as a follow-up in the #206 review.

Proposal

  • Add an optional starttls.required setting to external.email, mapped to mail.smtp.starttls.required:

    props.put("mail.smtp.starttls.required",
            String.valueOf(starttlsConfig.get("required").defaultTo(false).asBoolean()));
  • Decide the default. false keeps current deployments working. true is safe by default, but breaks servers that do not offer STARTTLS.

  • Document it in chap-mail.adoc and keep it through the Admin UI save (see the starttls merge in EmailConfigView.save).

  • Add a test in EmailClientTest.

Activity

  1. added
    enhancementNew feature or request
    securitySecurity fix / CVE remediation
    javaPull requests that update Java code
    on Oct 5, 2026
  2. added a commit that references this issue on Oct 6, 2026
    6e26142
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestjavaPull requests that update Java codesecuritySecurity fix / CVE remediation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions