Repository navigation
Conversation
Mailer.pm passed Bugzilla->params->{smtp_ssl} to Email::Sender, but no
such param was defined, so the undef value failed the transport's Str
check and mail_delivery_method=SMTP died.
Add smtp_ssl as a select (none, starttls, ssl; default none) and map
none to 0 for Email::Sender. Move SMTP transport construction into
_smtp_transport so it can be tested without sending. update_params
converts a 5.x boolean value: 1 becomes ssl, 0 or empty becomes none.
Providers such as Gmail and Microsoft are dropping password logins for SMTP. Add smtp_auth_method (password, oauth2). With oauth2, Bugzilla gets an access token from smtp_oauth2_token_url using the configured client ID, client secret and refresh token, and logs in with the XOAUTH2 SASL mechanism as smtp_username. There is no fallback to smtp_password. The access token is cached per process, keyed on the token URL, client ID, refresh token and username, and refreshed when less than five minutes remain. It is not cached when the provider gives no expires_in, and it is dropped when the server rejects the login. Token errors report only the HTTP status and the OAuth2 error code. The password path is unchanged. oauth2 needs the new optional smtp_oauth2 feature (Authen::SASL 2.1800, which provides XOAUTH2). Email::Sender 2.601 is required for its sasl_authenticator option.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two commits.
Restore smtp_ssl as a none/starttls/ssl select
smtp_sslto Email::Sender, but the param was notdefined, so
mail_delivery_method=SMTPdied on the transport's Str check.none);nonemaps to 0 for Email::Sender._smtp_transportso it can betested without sending.
update_paramsconverts a 5.x boolean: 1 -> ssl, 0/empty -> none.Support OAuth2 (XOAUTH2) for outbound SMTP
smtp_auth_method(password, oauth2),smtp_oauth2_token_url(https only),
smtp_oauth2_client_id,smtp_oauth2_client_secret,smtp_oauth2_refresh_token.smtp_usernameis the XOAUTH2 user.memcached or the DB; see the smtp_debug note), refreshed with under 5 minutes left, not
cached without
expires_in, dropped on SMTP AUTH failure. No fallback tothe password. Token errors show only the HTTP status and OAuth2 error code.
smtp_oauth2(Authen::SASL 2.1800, which providesXOAUTH2); Email::Sender 2.600 -> 2.601 for
sasl_authenticator.smtp_debugwarning (the debug log of the SMTP session includes the base64-encoded
access token).
Note:
smtp_oauth2_client_secretandsmtp_oauth2_refresh_tokenshould beadded to PARAMETERS_SECRET in whichever of this PR or #193 lands second.
Overlaps: Makefile.PL with #192; docs/en/rst/administering/parameters.rst with
#190 and #191. Will rebase whichever lands later.
Testing
prove -r t/in the dev container: all pass exceptt/bmo/bounced-emails.t (fails the same on main).
docker/run-tests-in-docker.shoption 2 (mysql/BMO): pass.update_params migration (via Bugzilla::Test::MockParams), including reruns.
invalidation, no expires_in, token errors (no secrets in messages), no
password fallback, cache cleared on AUTH failure, param checkers. The
XOAUTH2 transport subtest needs Authen::SASL >= 2.1800 and skips without
it; everything else runs in CI.
(not part of the image) to run the XOAUTH2 subtest and the end-to-end test.
messages delivered with one token request; bad refresh token gives
"SMTP OAuth2 token request failed: 400 Bad Request (invalid_grant)" with
no secrets; empty smtp_username is rejected by Gmail at AUTH and the
cached token is dropped.