stechstudio / laravel-env-security

Securely manage Laravel .env files for different deployment environments
MIT License
75 stars 9 forks source link

Laravel 9 getKey method not implemented #21

Closed cursosdesarrolloweb closed 2 years ago

cursosdesarrolloweb commented 2 years ago

Hi,

Laravel 9 Encrypter contract need implements the getKey method.](https://laravel.com/docs/9.x/upgrade)

The Illuminate\Contracts\Encryption\Encrypter contract now defines a getKey method. If you are manually implementing this interface, you should update your implementation.

Error: Class STS\EnvSecurity\Drivers\KmsDriver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Illuminate\Contracts\Encryption\Encrypter::getKey).

n0Sp00n commented 2 years ago

I confirm this is still an issue.

Let us know how to resolve that because a Production Application is broken at the moment because of that.

cursosdesarrolloweb commented 2 years ago

@n0Sp00n It seems that the best option at the moment is fork this repository and update it, looks abandoned.

n0Sp00n commented 2 years ago

This should do the work, right?

public function getKey() {

        $key = env('APP_KEY');
        if (Str::startsWith($key, 'base64:')) {
           $key = base64_decode(substr($key, 7));
        }

        return $key;
}
cursosdesarrolloweb commented 2 years ago

Not sure, it works for me:

public function getKey() {
    return $this->keyId;
}
jszobody commented 2 years ago

This package isn't abandoned at all. I'm just not using it in Laravel 9 myself yet and haven't hit this.

I'd welcome a PR, if any of y'all want to submit one. That would be the fastest way to get this resolved. Otherwise it'll be a week or two until I can handle.

n0Sp00n commented 2 years ago

ERROR: Permission to stechstudio/laravel-env-security.git denied to n0Sp00n. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Could you please assist me resolving this issue? @jszobody

jszobody commented 2 years ago

Hi @n0Sp00n. Are you trying to push a change directly to this repository? You won't have permission to do that. You need to submit a Pull Request.

jszobody commented 2 years ago

Are we thinking the getKey() needs to actually return anything?

Both current drivers (AWS KMS, and Google KMS) don't have local keys, there's nothing to return. Returning the APP_KEY as @n0Sp00n suggested doesn't make sense to me, as it doesn't have anything to do with what this package is doing.

Sounds like we need a stub method just to comply with the interface, returning an empty string. Anyone disagree?

n0Sp00n commented 2 years ago

I agree with you. Later on I realized App_key has nothing to do with it.

On Wed, Apr 20, 2022, 23:07 Joseph Szobody @.***> wrote:

Are we thinking the getKey() needs to actually return anything?

Both current drivers (AWS KMS, and Google KMS) don't have local keys, there's nothing to return. Returning the APP_KEY as @n0Sp00n https://github.com/n0Sp00n suggested doesn't make sense to me, as it doesn't have anything to do with what this package is doing.

Sounds like we need a stub method just to comply with the interface, returning an empty string. Anyone disagree?

— Reply to this email directly, view it on GitHub https://github.com/stechstudio/laravel-env-security/issues/21#issuecomment-1104410666, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TY4ZDQAD22WF55YQVKFTVGBPXFANCNFSM5PTX7AJQ . You are receiving this because you were mentioned.Message ID: @.***>

jszobody commented 2 years ago

This is now fixed, upgrade to version 1.14.

n0Sp00n commented 2 years ago

Thanks a lot.

Cheers!

On Thu, Apr 21, 2022, 23:02 Joseph Szobody @.***> wrote:

This is now fixed, upgrade to version 1.14.

— Reply to this email directly, view it on GitHub https://github.com/stechstudio/laravel-env-security/issues/21#issuecomment-1105701309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4TY43XQB4TO7FM76F7FVTVGGX45ANCNFSM5PTX7AJQ . You are receiving this because you were mentioned.Message ID: @.***>