Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decrypt error occurs when php artisan env:decrypt is executed and the key without base64 prefix is used #51464

Closed
TangQingFengPHP opened this issue May 18, 2024 · 1 comment

Comments

@TangQingFengPHP
Copy link

Laravel Version

11.7.0

PHP Version

8.2.0

Database Driver & Version

No response

Description

image image image
    // return $key should be changed to return base64_decode($key);
    protected function parseKey(string $key)
    {
        if (Str::startsWith($key, $prefix = 'base64:')) {
            $key = base64_decode(Str::after($key, $prefix));
        }

        return base64_decode($key);
    }
image

Steps To Reproduce

as mentioned above

@Hussam92
Copy link

I believe it is designed to expect a non-base64-encoded key if it isn't prefixed with base64:

Take a look at the tests EnvironmentDecryptCommandTest.php

These are the test results if I would apply your changes

image

@laravel laravel locked and limited conversation to collaborators May 20, 2024
@crynobone crynobone converted this issue into discussion #51508 May 20, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants