Skip to content

Commit

Permalink
Merge pull request from GHSA-vg6w-8w9v-xxqc
Browse files Browse the repository at this point in the history
  • Loading branch information
cydrobolt authored Jan 28, 2021
1 parent 10be1cb commit b198170
Show file tree
Hide file tree
Showing 3 changed files with 367 additions and 287 deletions.
12 changes: 10 additions & 2 deletions app/Http/Controllers/SetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Illuminate\Http\Request;
use Illuminate\Http\Redirect;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;

use App\Helpers\CryptoHelper;
use App\Models\User;
Expand Down Expand Up @@ -218,8 +219,8 @@ public static function performSetup(Request $request) {
}

public static function finishSetup(Request $request) {
// get data from cookie, decode JSON
if (!isset($_COOKIE['setup_arguments'])) {
// Abort if setup arguments are missing.
abort(404);
}

Expand All @@ -229,12 +230,19 @@ public static function finishSetup(Request $request) {
// unset cookie
setcookie('setup_arguments', '', time()-3600);

$transaction_authorised = env('TMP_SETUP_AUTH_KEY') == $setup_finish_args->setup_auth_key;
$transaction_authorised = env('TMP_SETUP_AUTH_KEY') === $setup_finish_args->setup_auth_key;

if ($transaction_authorised != true) {
abort(403, 'Transaction unauthorised.');
}

$usersTableExists = Schema::hasTable('users');

if ($usersTableExists) {
// If the users table exists, then the setup process may have already been completed before.
abort(403, 'Setup has been completed already.');
}

$database_created = self::createDatabase();
if (!$database_created) {
return redirect(route('setup'))->with('error', 'Could not create database. Perhaps your credentials were incorrect?');
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"torann/geoip": "^1.0",
"geoip2/geoip2": "^2.4",
"nesbot/carbon": "^1.22",
"doctrine/dbal": "^2.5",
"doctrine/dbal": "2.5.11",
"google/recaptcha": "~1.1",
"symfony/http-foundation": "2.7.51"
},
Expand Down
Loading

0 comments on commit b198170

Please sign in to comment.