[19.0] Normalize falsey smtp_authentication to disable SMTP auth

What does this MR do and why?

This backports !9516 (merged) and !9521 (merged) to 19-0-stable.

When gitlab_rails['smtp_authentication'] was set to false, the smtp_settings.rb template rendered it via to_s.to_sym, producing the symbol :false. With net-smtp 0.5.x, Net::SMTP#start validates any truthy authtype against its known SASL mechanisms and raises ArgumentError: wrong authentication type false. Earlier net-smtp versions (e.g. 0.3.3) silently ignored the value, so this only surfaced after the upgrade.

Normalize the setting at config-parse time in SmtpHelper instead of branching in the template: falsey/"disable" values (false, 'false', 'none', '') become nil so no authentication: line is rendered, while real mechanisms are passed through unchanged. This keeps the template declarative and moves the decision logic into tested Ruby.

See gitlab#603334 (closed)

Describe in detail what merge request is being backported and why

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
  • The original MR has been deployed to GitLab.com (not applicable for documentation or spec changes).
  • This MR has a severity label assigned (if applicable).

Note to the merge request author and maintainer

If you have questions about the patch release process, please:

Edited by Robert Marshall

Merge request reports

Loading