Skip to content

Commit 663143d

Browse files
committed
Merge branch 'develop' into dane/restore-backups
2 parents f241938 + b7d1c45 commit 663143d

File tree

575 files changed

+6035
-6819
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

575 files changed

+6035
-6819
lines changed

.github/workflows/docker.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
registry: ghcr.io
2626
username: ${{ github.repository_owner }}
2727
password: ${{ secrets.REGISTRY_TOKEN }}
28+
- name: Bump Version
29+
if: "!contains(github.ref, 'develop')"
30+
env:
31+
REF: ${{ github.ref }}
32+
run: |
33+
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:11}',/" config/app.php
2834
- name: Release Production Build
2935
uses: docker/build-push-action@v2
3036
if: "!contains(github.ref, 'develop')"

.github/workflows/tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
- 3306
2020
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
2121
strategy:
22-
fail-fast: true
22+
fail-fast: false
2323
matrix:
24-
php: [7.3, 7.4]
24+
php: [7.4, 8.0]
2525
name: PHP ${{ matrix.php }}
2626
steps:
2727
- name: checkout
@@ -44,14 +44,14 @@ jobs:
4444
with:
4545
php-version: ${{ matrix.php }}
4646
extensions: cli, openssl, gd, mysql, pdo, mbstring, tokenizer, bcmath, xml, curl, zip
47-
tools: composer:v1
47+
tools: composer:v2
4848
coverage: none
4949
- name: configure
5050
run: cp .env.ci .env
5151
- name: install dependencies
5252
run: composer install --prefer-dist --no-interaction --no-progress
5353
- name: run cs-fixer
54-
run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff
54+
run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --rules=psr_autoloading
5555
continue-on-error: true
5656
- name: execute unit tests
5757
run: vendor/bin/phpunit --bootstrap bootstrap/app.php tests/Unit

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/vendor
22
*.DS_Store*
3-
.env
3+
!.env.ci
4+
!.env.dusk
5+
!.env.example
6+
.env*
47
.vagrant/*
58
.vscode/*
69
storage/framework/*

.php_cs

Lines changed: 0 additions & 58 deletions
This file was deleted.

.php_cs.dist

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$finder = (new Finder())->in(__DIR__)->exclude(['vendor', 'node_modules', 'storage', 'bootstrap/cache']);
7+
8+
return (new Config())
9+
->setRiskyAllowed(true)
10+
->setFinder($finder)
11+
->setRules([
12+
'@Symfony' => true,
13+
'@PSR1' => true,
14+
'@PSR2' => true,
15+
'@PSR12' => true,
16+
'align_multiline_comment' => ['comment_type' => 'phpdocs_like'],
17+
'combine_consecutive_unsets' => true,
18+
'concat_space' => ['spacing' => 'one'],
19+
'heredoc_to_nowdoc' => true,
20+
'no_alias_functions' => true,
21+
'no_unreachable_default_argument_value' => true,
22+
'no_useless_return' => true,
23+
'ordered_imports' => [
24+
'sortAlgorithm' => 'length',
25+
],
26+
'random_api_migration' => true,
27+
'ternary_to_null_coalescing' => true,
28+
'yoda_style' => [
29+
'equal' => false,
30+
'identical' => false,
31+
'less_and_greater' => false,
32+
],
33+
]);

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ This file is a running track of new features and fixes to each version of the pa
33

44
This project follows [Semantic Versioning](http://semver.org) guidelines.
55

6+
## v1.2.2
7+
* **[security]** Fixes authentication bypass allowing a user to take control of specific server actions such as executing schedules, rotating database passwords, and viewing or deleting a backup.
8+
69
## v1.2.1
710
### Fixed
811
* Fixes URL-encoding of filenames when working in the filemanager to fix issues when moving, renaming, or deleting files.

app/Console/Commands/Environment/AppSettingsCommand.php

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ class AppSettingsCommand extends Command
1919
{
2020
use EnvironmentWriterTrait;
2121

22-
const ALLOWED_CACHE_DRIVERS = [
22+
public const ALLOWED_CACHE_DRIVERS = [
2323
'redis' => 'Redis (recommended)',
2424
'memcached' => 'Memcached',
2525
'file' => 'Filesystem',
2626
];
2727

28-
const ALLOWED_SESSION_DRIVERS = [
28+
public const ALLOWED_SESSION_DRIVERS = [
2929
'redis' => 'Redis (recommended)',
3030
'memcached' => 'Memcached',
3131
'database' => 'MySQL Database',
3232
'file' => 'Filesystem',
3333
'cookie' => 'Cookie',
3434
];
3535

36-
const ALLOWED_QUEUE_DRIVERS = [
36+
public const ALLOWED_QUEUE_DRIVERS = [
3737
'redis' => 'Redis (recommended)',
3838
'database' => 'MySQL Database',
3939
'sync' => 'Sync',
@@ -77,9 +77,6 @@ class AppSettingsCommand extends Command
7777

7878
/**
7979
* AppSettingsCommand constructor.
80-
*
81-
* @param \Illuminate\Contracts\Config\Repository $config
82-
* @param \Illuminate\Contracts\Console\Kernel $command
8380
*/
8481
public function __construct(ConfigRepository $config, Kernel $command)
8582
{
@@ -102,43 +99,45 @@ public function handle()
10299

103100
$this->output->comment(trans('command/messages.environment.app.author_help'));
104101
$this->variables['APP_SERVICE_AUTHOR'] = $this->option('author') ?? $this->ask(
105-
trans('command/messages.environment.app.author'), $this->config->get('pterodactyl.service.author', 'unknown@unknown.com')
106-
);
102+
trans('command/messages.environment.app.author'),
103+
$this->config->get('pterodactyl.service.author', 'unknown@unknown.com')
104+
);
107105

108106
$this->output->comment(trans('command/messages.environment.app.app_url_help'));
109107
$this->variables['APP_URL'] = $this->option('url') ?? $this->ask(
110-
trans('command/messages.environment.app.app_url'), $this->config->get('app.url', 'http://example.org')
111-
);
108+
trans('command/messages.environment.app.app_url'),
109+
$this->config->get('app.url', 'http://example.org')
110+
);
112111

113112
$this->output->comment(trans('command/messages.environment.app.timezone_help'));
114113
$this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate(
115-
trans('command/messages.environment.app.timezone'),
116-
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
117-
$this->config->get('app.timezone')
118-
);
114+
trans('command/messages.environment.app.timezone'),
115+
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
116+
$this->config->get('app.timezone')
117+
);
119118

120119
$selected = $this->config->get('cache.default', 'redis');
121120
$this->variables['CACHE_DRIVER'] = $this->option('cache') ?? $this->choice(
122-
trans('command/messages.environment.app.cache_driver'),
123-
self::ALLOWED_CACHE_DRIVERS,
124-
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null
125-
);
121+
trans('command/messages.environment.app.cache_driver'),
122+
self::ALLOWED_CACHE_DRIVERS,
123+
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null
124+
);
126125

127126
$selected = $this->config->get('session.driver', 'redis');
128127
$this->variables['SESSION_DRIVER'] = $this->option('session') ?? $this->choice(
129-
trans('command/messages.environment.app.session_driver'),
130-
self::ALLOWED_SESSION_DRIVERS,
131-
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null
132-
);
128+
trans('command/messages.environment.app.session_driver'),
129+
self::ALLOWED_SESSION_DRIVERS,
130+
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null
131+
);
133132

134133
$selected = $this->config->get('queue.default', 'redis');
135134
$this->variables['QUEUE_CONNECTION'] = $this->option('queue') ?? $this->choice(
136-
trans('command/messages.environment.app.queue_driver'),
137-
self::ALLOWED_QUEUE_DRIVERS,
138-
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
139-
);
135+
trans('command/messages.environment.app.queue_driver'),
136+
self::ALLOWED_QUEUE_DRIVERS,
137+
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
138+
);
140139

141-
if (! is_null($this->option('settings-ui'))) {
140+
if (!is_null($this->option('settings-ui'))) {
142141
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->option('settings-ui') == 'true' ? 'false' : 'true';
143142
} else {
144143
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm(trans('command/messages.environment.app.settings'), true) ? 'false' : 'true';
@@ -171,28 +170,30 @@ private function checkForRedis()
171170

172171
$this->output->note(trans('command/messages.environment.app.using_redis'));
173172
$this->variables['REDIS_HOST'] = $this->option('redis-host') ?? $this->ask(
174-
trans('command/messages.environment.app.redis_host'), $this->config->get('database.redis.default.host')
175-
);
173+
trans('command/messages.environment.app.redis_host'),
174+
$this->config->get('database.redis.default.host')
175+
);
176176

177177
$askForRedisPassword = true;
178-
if (! empty($this->config->get('database.redis.default.password'))) {
178+
if (!empty($this->config->get('database.redis.default.password'))) {
179179
$this->variables['REDIS_PASSWORD'] = $this->config->get('database.redis.default.password');
180180
$askForRedisPassword = $this->confirm(trans('command/messages.environment.app.redis_pass_defined'));
181181
}
182182

183183
if ($askForRedisPassword) {
184184
$this->output->comment(trans('command/messages.environment.app.redis_pass_help'));
185185
$this->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden(
186-
trans('command/messages.environment.app.redis_password')
187-
);
186+
trans('command/messages.environment.app.redis_password')
187+
);
188188
}
189189

190190
if (empty($this->variables['REDIS_PASSWORD'])) {
191191
$this->variables['REDIS_PASSWORD'] = 'null';
192192
}
193193

194194
$this->variables['REDIS_PORT'] = $this->option('redis-port') ?? $this->ask(
195-
trans('command/messages.environment.app.redis_port'), $this->config->get('database.redis.default.port')
196-
);
195+
trans('command/messages.environment.app.redis_port'),
196+
$this->config->get('database.redis.default.port')
197+
);
197198
}
198199
}

app/Console/Commands/Environment/DatabaseSettingsCommand.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ class DatabaseSettingsCommand extends Command
5757

5858
/**
5959
* DatabaseSettingsCommand constructor.
60-
*
61-
* @param \Illuminate\Contracts\Config\Repository $config
62-
* @param \Illuminate\Database\DatabaseManager $database
63-
* @param \Illuminate\Contracts\Console\Kernel $console
6460
*/
6561
public function __construct(ConfigRepository $config, DatabaseManager $database, Kernel $console)
6662
{
@@ -82,24 +78,28 @@ public function handle()
8278
{
8379
$this->output->note(trans('command/messages.environment.database.host_warning'));
8480
$this->variables['DB_HOST'] = $this->option('host') ?? $this->ask(
85-
trans('command/messages.environment.database.host'), $this->config->get('database.connections.mysql.host', '127.0.0.1')
86-
);
81+
trans('command/messages.environment.database.host'),
82+
$this->config->get('database.connections.mysql.host', '127.0.0.1')
83+
);
8784

8885
$this->variables['DB_PORT'] = $this->option('port') ?? $this->ask(
89-
trans('command/messages.environment.database.port'), $this->config->get('database.connections.mysql.port', 3306)
90-
);
86+
trans('command/messages.environment.database.port'),
87+
$this->config->get('database.connections.mysql.port', 3306)
88+
);
9189

9290
$this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask(
93-
trans('command/messages.environment.database.database'), $this->config->get('database.connections.mysql.database', 'panel')
94-
);
91+
trans('command/messages.environment.database.database'),
92+
$this->config->get('database.connections.mysql.database', 'panel')
93+
);
9594

9695
$this->output->note(trans('command/messages.environment.database.username_warning'));
9796
$this->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask(
98-
trans('command/messages.environment.database.username'), $this->config->get('database.connections.mysql.username', 'pterodactyl')
99-
);
97+
trans('command/messages.environment.database.username'),
98+
$this->config->get('database.connections.mysql.username', 'pterodactyl')
99+
);
100100

101101
$askForMySQLPassword = true;
102-
if (! empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) {
102+
if (!empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) {
103103
$this->variables['DB_PASSWORD'] = $this->config->get('database.connections.mysql.password');
104104
$askForMySQLPassword = $this->confirm(trans('command/messages.environment.database.password_defined'));
105105
}

0 commit comments

Comments
 (0)