Config: Remove default app key value

To avoid scenarios where an instance specific app key is not set, and
therefore avoids the potential of instances using a known key value.

For #6210
This commit is contained in:
Dan Brown
2026-09-13 22:03:30 +01:00
parent 2c22c3bcb8
commit ca205e3ed5
3 changed files with 12 additions and 2 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ return [
'auto_detect_locale' => env('APP_AUTO_LANG_PUBLIC', true),
// Encryption key
'key' => env('APP_KEY', 'AbAZchsay4uBTU33RubBzLKw203yqSqr'),
'key' => env('APP_KEY'),
// Encryption cipher
'cipher' => 'AES-256-CBC',
+1
View File
@@ -17,6 +17,7 @@
<server name="APP_AUTO_LANG_PUBLIC" value="true"/>
<server name="APP_URL" value="http://bookstack.dev"/>
<server name="APP_TIMEZONE" value="UTC"/>
<server name="APP_KEY" value="base64:rt54sY5s5G9+8VmvfI0NIJs2Fzd3qsx4auLjnLE5qw0="/>
<server name="APP_DISPLAY_TIMEZONE" value="UTC"/>
<server name="ALLOWED_STYLE_SOURCES" value=""/>
<server name="ALLOWED_IMAGE_SOURCES" value=""/>
+10 -1
View File
@@ -2,6 +2,7 @@
namespace Tests\Unit;
use Illuminate\Encryption\MissingAppKeyException;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
@@ -212,8 +213,16 @@ class ConfigTest extends TestCase
});
}
public function test_app_errors_if_no_app_key_set()
{
$this->runWithEnv(['APP_KEY' => null], function () {
$this->expectException(MissingAppKeyException::class);
$this->get('/');
});
}
/**
* Set an environment variable of the given name and value
* Set an environment variable of the given name and value,
* then check the given config key to see if it matches the given result.
* Providing a null $envVal clears the variable.
*/