mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-29 23:22:34 +01:00
Mail: Updated to forked symfony/mailer to allow assurance of tls
Related to #4358
This commit is contained in:
parent
80635144b1
commit
465989efa9
@ -31,7 +31,7 @@ return [
|
||||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'scheme' => ($mailEncryption === 'tls' || $mailEncryption === 'ssl') ? 'smtps' : null,
|
||||
'scheme' => null,
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
@ -39,6 +39,7 @@ return [
|
||||
'verify_peer' => env('MAIL_VERIFY_SSL', true),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||
'tls_required' => ($mailEncryption === 'tls' || $mailEncryption === 'ssl'),
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
|
@ -49,7 +49,8 @@
|
||||
"nunomaduro/larastan": "^2.4",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"squizlabs/php_codesniffer": "^3.7",
|
||||
"ssddanbrown/asserthtml": "^2.0"
|
||||
"ssddanbrown/asserthtml": "^2.0",
|
||||
"ssddanbrown/symfony-mailer": "6.0.x-dev"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
190
composer.lock
generated
190
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "5a066407dfbd1809ffd39114a873333d",
|
||||
"content-hash": "d010cf625b58a0dc43addda7881ea42f",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-crt-php",
|
||||
@ -1945,16 +1945,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v9.52.9",
|
||||
"version": "v9.52.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "c512ece7b1ee393eac5893f37cb2b029a5413b97"
|
||||
"reference": "858add225ce88a76c43aec0e7866288321ee0ee9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/c512ece7b1ee393eac5893f37cb2b029a5413b97",
|
||||
"reference": "c512ece7b1ee393eac5893f37cb2b029a5413b97",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/858add225ce88a76c43aec0e7866288321ee0ee9",
|
||||
"reference": "858add225ce88a76c43aec0e7866288321ee0ee9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2139,7 +2139,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2023-06-08T20:06:23+00:00"
|
||||
"time": "2023-06-27T13:25:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/serializable-closure",
|
||||
@ -3264,16 +3264,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "2.67.0",
|
||||
"version": "2.68.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||
"reference": "c1001b3bc75039b07f38a79db5237c4c529e04c8"
|
||||
"reference": "4f991ed2a403c85efbc4f23eb4030063fdbe01da"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/c1001b3bc75039b07f38a79db5237c4c529e04c8",
|
||||
"reference": "c1001b3bc75039b07f38a79db5237c4c529e04c8",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4f991ed2a403c85efbc4f23eb4030063fdbe01da",
|
||||
"reference": "4f991ed2a403c85efbc4f23eb4030063fdbe01da",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3362,7 +3362,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-05-25T22:09:47+00:00"
|
||||
"time": "2023-06-20T18:29:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nette/schema",
|
||||
@ -3515,16 +3515,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v4.15.5",
|
||||
"version": "v4.16.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e"
|
||||
"reference": "19526a33fb561ef417e822e85f08a00db4059c17"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e",
|
||||
"reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17",
|
||||
"reference": "19526a33fb561ef417e822e85f08a00db4059c17",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3565,9 +3565,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5"
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0"
|
||||
},
|
||||
"time": "2023-05-19T20:20:00+00:00"
|
||||
"time": "2023-06-25T14:52:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nunomaduro/termwind",
|
||||
@ -5427,6 +5427,74 @@
|
||||
],
|
||||
"time": "2022-01-24T20:12:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ssddanbrown/symfony-mailer",
|
||||
"version": "6.0.x-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ssddanbrown/symfony-mailer.git",
|
||||
"reference": "2219dcdc5f58e4f382ce8f1e6942d16982aa3012"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ssddanbrown/symfony-mailer/zipball/2219dcdc5f58e4f382ce8f1e6942d16982aa3012",
|
||||
"reference": "2219dcdc5f58e4f382ce8f1e6942d16982aa3012",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"egulias/email-validator": "^2.1.10|^3|^4",
|
||||
"php": ">=8.0.2",
|
||||
"psr/event-dispatcher": "^1",
|
||||
"psr/log": "^1|^2|^3",
|
||||
"symfony/event-dispatcher": "^5.4|^6.0",
|
||||
"symfony/mime": "^5.4|^6.0",
|
||||
"symfony/service-contracts": "^1.1|^2|^3"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/http-kernel": "<5.4"
|
||||
},
|
||||
"replace": {
|
||||
"symfony/mailer": "^6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/http-client-contracts": "^1.1|^2|^3",
|
||||
"symfony/messenger": "^5.4|^6.0"
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Mailer\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Dan Brown",
|
||||
"homepage": "https://danb.me"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Helps sending emails",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/ssddanbrown/symfony-mailer/tree/6.0"
|
||||
},
|
||||
"time": "2023-07-04T14:10:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v6.0.19",
|
||||
@ -6132,80 +6200,6 @@
|
||||
],
|
||||
"time": "2023-02-01T08:22:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mailer",
|
||||
"version": "v6.0.19",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mailer.git",
|
||||
"reference": "cd60799210c488f545ddde2444dc1aa548322872"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mailer/zipball/cd60799210c488f545ddde2444dc1aa548322872",
|
||||
"reference": "cd60799210c488f545ddde2444dc1aa548322872",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"egulias/email-validator": "^2.1.10|^3|^4",
|
||||
"php": ">=8.0.2",
|
||||
"psr/event-dispatcher": "^1",
|
||||
"psr/log": "^1|^2|^3",
|
||||
"symfony/event-dispatcher": "^5.4|^6.0",
|
||||
"symfony/mime": "^5.4|^6.0",
|
||||
"symfony/service-contracts": "^1.1|^2|^3"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/http-kernel": "<5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/http-client-contracts": "^1.1|^2|^3",
|
||||
"symfony/messenger": "^5.4|^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Mailer\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Helps sending emails",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mailer/tree/v6.0.19"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-11T11:50:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mime",
|
||||
"version": "v6.0.19",
|
||||
@ -8796,16 +8790,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.21",
|
||||
"version": "1.10.23",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5"
|
||||
"reference": "65ab678d1248a8bc6fde456f0d7ff3562a61a4cd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5",
|
||||
"reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/65ab678d1248a8bc6fde456f0d7ff3562a61a4cd",
|
||||
"reference": "65ab678d1248a8bc6fde456f0d7ff3562a61a4cd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -8854,7 +8848,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-06-21T20:07:58+00:00"
|
||||
"time": "2023-07-04T13:32:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
@ -10480,7 +10474,9 @@
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {
|
||||
"ssddanbrown/symfony-mailer": 20
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
|
@ -5,7 +5,6 @@ namespace Tests\Unit;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
|
||||
use Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
@ -125,41 +124,40 @@ class ConfigTest extends TestCase
|
||||
|
||||
public function test_non_null_mail_encryption_options_enforce_smtp_scheme()
|
||||
{
|
||||
$this->checkEnvConfigResult('MAIL_ENCRYPTION', 'tls', 'mail.mailers.smtp.scheme', 'smtps');
|
||||
$this->checkEnvConfigResult('MAIL_ENCRYPTION', 'ssl', 'mail.mailers.smtp.scheme', 'smtps');
|
||||
$this->checkEnvConfigResult('MAIL_ENCRYPTION', 'null', 'mail.mailers.smtp.scheme', null);
|
||||
$this->checkEnvConfigResult('MAIL_ENCRYPTION', 'tls', 'mail.mailers.smtp.tls_required', true);
|
||||
$this->checkEnvConfigResult('MAIL_ENCRYPTION', 'ssl', 'mail.mailers.smtp.tls_required', true);
|
||||
$this->checkEnvConfigResult('MAIL_ENCRYPTION', 'null', 'mail.mailers.smtp.tls_required', false);
|
||||
}
|
||||
|
||||
public function test_smtp_scheme_and_certain_port_forces_tls_usage()
|
||||
{
|
||||
$isMailTlsForcedEnabled = function () {
|
||||
$isMailTlsRequired = function () {
|
||||
/** @var \BookStack\App\Mail\EsmtpTransport $transport */
|
||||
$transport = Mail::mailer('smtp')->getSymfonyTransport();
|
||||
/** @var SocketStream $stream */
|
||||
$stream = $transport->getStream();
|
||||
Mail::purge('smtp');
|
||||
return $stream->isTLS();
|
||||
return $transport->getTlsRequirement();
|
||||
};
|
||||
|
||||
config()->set([
|
||||
'mail.mailers.smtp.scheme' => null,
|
||||
'mail.mailers.smtp.tls_required' => null,
|
||||
'mail.mailers.smtp.port' => 587,
|
||||
]);
|
||||
|
||||
$this->assertFalse($isMailTlsForcedEnabled());
|
||||
$this->assertFalse($isMailTlsRequired());
|
||||
|
||||
config()->set([
|
||||
'mail.mailers.smtp.scheme' => 'smtps',
|
||||
'mail.mailers.smtp.tls_required' => 'tls',
|
||||
'mail.mailers.smtp.port' => 587,
|
||||
]);
|
||||
|
||||
$this->assertTrue($isMailTlsForcedEnabled());
|
||||
$this->assertTrue($isMailTlsRequired());
|
||||
|
||||
config()->set([
|
||||
'mail.mailers.smtp.scheme' => '',
|
||||
'mail.mailers.smtp.tls_required' => null,
|
||||
'mail.mailers.smtp.port' => 465,
|
||||
]);
|
||||
|
||||
$this->assertTrue($isMailTlsForcedEnabled());
|
||||
$this->assertTrue($isMailTlsRequired());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user