Skip to content
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

Allow usage of static encryption key #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Skullsneeze
Copy link

Magento allows you to specify an encryption key during the application installation. This PR aims to provide this same ability during the setup.

The reason behind this is that a client has a specific test case that relies on data generated using an encryption key. This data is partially stored (statically) in an external service. To ensure the correct outcome I need to be able to specify the encryption key so the resulting encrypted value is not random.

@fooman
Copy link
Contributor

fooman commented Apr 3, 2024

Thanks for your pull request. Have you tried changing this with the pre/post install script already? Another thought is that you should be able to mock the encryption key value used in the decoder for your data in the individual integration test itself.

@Skullsneeze
Copy link
Author

Hi @fooman thanks for the quick response.

My initial thought was actually to set this in a post install script using the setup:config:set but that causes issues with serialized values.

I might be able to mock the decryptor, and will give this a go, but I figured that since this is an official setup:install argument it wouldn't hurt adding support for it either way 😊

@jissereitsma
Copy link
Contributor

I agree with @Skullsneeze - the PR is clean and does not seem to break anything, but just add things. And when it is handy, why not? @fooman ?

@Skullsneeze
Copy link
Author

FYI, I found that mocking and encryption are quite tricky (at least in the setup we're running). Alternatively I tried adjusting the config, but that is something which is protected by Magento's own integration test framework as it compares the config before and after each test is ran.

I ended up slightly restructuring my code and using Mockery to create a partial mock for one of the classes I was testing. I then created a specific method that would run the validation which uses the encryption and simply let it return true when called on the partial mock.

While it works I do think being able to test with the actual encryption key would be better so I do still think this PR adds value in that sense, but just letting you know that the pressure from my end is currently off ;)

@fooman
Copy link
Contributor

fooman commented Apr 8, 2024

Good stuff @Skullsneeze

And when it is handy, why not? @fooman ?

@jissereitsma happy for it to get merged, just wanted to make sure we don't add more and more options with things that could already be achieved with the existing options

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.

3 participants