Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMTP: allow disabling starttls_auto since it's now true by default in Ruby 3 #1480

Merged
merged 1 commit into from Nov 30, 2022

Conversation

ahorek
Copy link
Contributor

@ahorek ahorek commented Apr 29, 2022

rebased #1435

… Ruby 3

Passing enable_tls/starttls/starttls_auto: false now explicitly disables
these options. They used to be all false by default, so they could only
be turned ON. So we ignored turning them OFF!

We now disable_tls/starttls/starttls_auto when they're set to false.
Leaving them set to nil inherits the upstream default.
@mikel mikel merged commit 8e17809 into mikel:2-8-stable Nov 30, 2022
bygf pushed a commit to bygf/charts-gitlab that referenced this pull request Apr 14, 2023
This commit fixes mail sending when TLS is disabled. In Ruby 3.0.5,
net-smtp v0.2.1 enabled TLS by default if the server advertises
STARTTLS support. However, mail v2.7.1 didn't explicitly disable TLS
(mikel/mail#1434), so TLS may be used with
Ruby 3 even if it is disabled. mail v2.8.1 has since fixed this issue
via mikel/mail#1480.

However, mail v2.8.1 has a bug in the logic for retrieving the settings
(https://github.com/mikel/mail/blob/2.8.1/lib/mail/network/delivery_methods/smtp.rb#L114):

```
tls = settings[:tls] || settings[:ssl]
```

If `settings[:tls]` is `false` and `settings[:ssl]` is `nil`, then
the result of `false || nil` is `nil`.

This means that TLS cannot be disabled if `settings[:tls]` is set to
`false`.

To fix this, just add a redundant `ssl` config parameter.

This came out of https://gitlab.com/gitlab-org/gitlab/-/issues/399241.

Changelog: fixed
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.

None yet

3 participants