Merge pull request #15147 from uberbrady/fix_setup_ssl_check

Fix setup ssl check
This commit is contained in:
snipe 2024-07-23 20:32:13 +01:00 committed by GitHub
commit 09e2c0beab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View file

@ -14,7 +14,6 @@ use App\Models\Asset;
use App\Models\User;
use App\Notifications\FirstAdminNotification;
use App\Notifications\MailTest;
use Illuminate\Http\Client\HttpClientException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Storage;
@ -129,11 +128,11 @@ class SettingsController extends Controller
protected function dotEnvFileIsExposed() : bool
{
try {
return Http::timeout(10)
return Http::withoutVerifying()->timeout(10)
->accept('*/*')
->get(URL::to('.env'))
->successful();
} catch (HttpClientException $e) {
} catch (\Exception $e) {
Log::debug($e->getMessage());
return true;
}

View file

@ -2,6 +2,7 @@
namespace Tests\Feature\Settings;
use App\Http\Controllers\SettingsController;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Http\Client\Request;
@ -301,4 +302,11 @@ class ShowSetUpPageTest extends TestCase
$this->assertSeeDirectoryPermissionError(false);
}
public function testInvalidTLSCertsOkWhenCheckingForEnvFile()
{
//set the weird bad SSL cert place - https://self-signed.badssl.com
$this->markTestIncomplete("Not yet sure how to write this test, it requires messing with .env ...");
$this->assertTrue((new SettingsController())->dotEnvFileIsExposed());
}
}