Skip to content

Update default encryption mode to GCM #5749

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

Closed
wants to merge 1 commit into from

Conversation

Krisell
Copy link

@Krisell Krisell commented Dec 15, 2021

This has been attempted, and even merged (but reverted), before: #5674

The reason for reverting has been resolved (laravel/framework#38594) since 8.58.0 which is lower than the required version in composer.json.

This means that GCM is now ready to be the default mode.

GCM is preferred due to smaller payload, better performance and built in authenticated encryption instead of having to calculate the mac in application code which is the case for CBC mode (although of course done correctly in Laravel).


My only concern is that I have seen some people blindly updating their configs to the latest version, and changing this is not BC. All sessions will be reset and of course any encrypted data will have to be decrypted using the old mode and then re-encrypted using the new mode.

So, any existing app should either keep using CBC mode, or carefully build a migration plan. We did migrate from CBC to CGM in a production app a few months ago successfully (no sessions invalidated) but we only used encryption for cookies. We built a custom encryptor that attempted both modes for decryption during a short transition period.

@driesvints
Copy link
Member

I feel like it's best that we do this in 9.x and add a note to the upgrade guide about it.

Also pinging @jasonmccreary to make sure Laravel Shift doesn't automatically updates the config for this.

@jasonmccreary
Copy link
Contributor

@driesvints, I can ensure Shift follows any Laravel recommendation. 👍

@taylorotwell
Copy link
Member

I will consider it for the Laravel 9 release.

@mpyw
Copy link

mpyw commented Jul 18, 2022

This looks to be still not released yet

'cipher' => 'AES-256-CBC',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants