Page MenuHomeDevCentral

Ensure APP_KEY is properly defined
Closed, ResolvedPublic

Description

Determine if APP_KEY is defined in the environment.

If so, we're done. But if missing, the setup script should create:

.env
APP_KEY=SomeRandomString

Then, it should run php artisan key:generate to replace it by a custom key.

Some background information is given at rDNOTIFbacf9390fa39 audit.

Event Timeline

SomeRandomString actually won't work.

src/Illuminate/Foundation/Console/KeyGenerateCommand.php
if (file_exists($path)) {
    file_put_contents($path, str_replace(
        'APP_KEY='.$this->laravel['config']['app.key'], 'APP_KEY='.$key, file_get_contents($path)
    ));
}

Actually, the application itself creates a security risk with a default valid key. That will be SomeRandomString.