Skip to content

Commit

Permalink
Fixed an RCE vulnerability
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Nov 19, 2024
1 parent 2c91772 commit 82e893f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Craft CMS 4

## Unreleased

- Fixed an RCE vulnerability.

## 4.13.1.1 - 2024-11-18

- Fixed a PHP error. ([#16142](https://github.com/craftcms/cms/issues/16142))
Expand Down
17 changes: 10 additions & 7 deletions bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@
// Determine the paths
// -----------------------------------------------------------------------------

$findConfig = function(string $cliName, string $envName) {
return App::cliOption($cliName, true) ?? App::env($envName);
$findConfig = function(string $cliName, string $envName) use ($appType) {
if ($appType === 'console') {
$value = App::cliOption($cliName, true);
if ($value !== null) {
return $value;
}
}

return App::env($envName);
};

// Set the vendor path. By default assume that it's 4 levels up from here
Expand All @@ -49,11 +56,7 @@
// Set the environment
// -----------------------------------------------------------------------------

$environment = App::cliOption('--env', true)
?? App::env('CRAFT_ENVIRONMENT')
?? App::env('ENVIRONMENT')
?? $_SERVER['SERVER_NAME']
?? null;
$environment = $findConfig('--env', 'CRAFT_ENVIRONMENT') ?? App::env('ENVIRONMENT') ?? $_SERVER['SERVER_NAME'] ?? null;

// Load the general config
// -----------------------------------------------------------------------------
Expand Down

0 comments on commit 82e893f

Please sign in to comment.