- Issue created by @shivamitakari
- Status changed to Needs review
almost 2 years ago 8:19am 29 March 2023 - ๐บ๐ธUnited States greggles Denver, Colorado, USA
Thanks for the proposal and patch.
Can you share some of the motivation here? Why would a site want this feature?
- ๐ฎ๐ณIndia shivamitakari
Hello Greg,
Please find the below motivation for the patch.
I usually do production database sanitization before importing it to lower environments (like development and test).
I have TFA setup on a production website and whenever I sanitize the production database, TFA data is getting sanitized as it's not having the option to skip the sanitization. Due to this in lower environments, while testing users need to set up TFA again and they can't use the same TFA which they have set up on production.
- ๐บ๐ธUnited States greggles Denver, Colorado, USA
That is an interesting problem. I wonder what other solutions we could provide. Maybe a drush command could overwrite all the fallback code values with a known set of values that developers could use?
When I used tfa, I've previously just disabled it in development environments in addition to sanitizing the database.
Let's keep thinking of solutions.
- ๐ฎ๐ณIndia shivamitakari
Hello Greg,
Thanks for quickly having look.
Yes disabling can be an option but I do still need users with admin roles to have TFA on non-prod env for safety and with the current TFA module there is no option to skip the TFA sanitizationThis patch just gives an option for users if they want to skip sanitization.
- ๐บ๐ธUnited States greggles Denver, Colorado, USA
The idea of a set of sanitizations to skip seems like an interesting option to have in drush itself. Have you looked about adding that feature there?
- ๐ฎ๐ณIndia shivamitakari
Hello Greg,
Apologies for coming late on this thread. May I please know what do you mean by adding that option in drush itself?
with this patch, I'm adding one parameter, and its used in the sql-sanitize command.
./vendor/bin/drush sql:sanitize --sanitize-tfa=no
This will skip the sanitization.
- ๐บ๐ธUnited States greggles Denver, Colorado, USA
An alternative could be that the drush sql:sanitize could have an argument like --sanitization-to-skip=tfa and it would take a comma separated list of hook names to do the same thing at a more global level. That seems more appropriate to me.
- ๐ต๐นPortugal jcnventura
And to me. If done right, there would be nothing to do from the tfa side, as this would all be handled by drush. Maybe we should create an issue in https://github.com/drush-ops/drush/issues ?
- ๐บ๐ธUnited States cmlara
--sanitization-to-skip=tfa and it would take a comma separated list of hook names to do the same thing at a more global level
A downside of such a method is it implies that a sanitation could be skipped, however there may be some sanitation that may be so critical they should never be allowed to be skipped.
Drush current method of allowing each plugin/hook to supply its own options allows a module to say "ok you can skip that, no you may not skip that"
Theoretically Drush could be modified to accept a hook name and a task name to ignore, however at that point you still need to make changes to modules like TFA to say "These are each of my tasks, and these tasks may be skipped" in which case why not just have TFA provide an option directly and act upon it as Drush currently does?
The above becomes more true when you consider that the current method allows more fine grained control, such as 'skip sanitizing admin users' instead of skipping all sanitation.
That last point point actually brings up a question for this, instead of making this an 'all or nothing' option for TFA perhaps this should be modified to be a more focused exemption and only skip sanitation for a smaller subset of accounts that way the plain text seeds for the majority of accounts are not at risk in a development environment.
- ๐บ๐ธUnited States cmlara
Adding on to my comment in #12:
Since the included plugins encrypt the seed (and all other plugins should be protecting the secret data as well) skipping sanitation to allow Dev environments to log in would either require the Production Secret being shared with the Dev environment or a key rotation.
It is best practice to not share encryption keys between Production and Dev so that leaves key rotation.
Rotation would in generally require a custom process to rotate the encryption key, at which point one could just inject arbitrary tokens post sanitation that if necessary could be standardized as part of the Dev environment setup process.
Perhaps this really should be won't-fix because of cryptographic best practices?
- Issue was unassigned.
- Status changed to Active
over 1 year ago 8:26pm 9 September 2023 - ๐บ๐ธUnited States cmlara
- ๐ฌ๐งUnited Kingdom Alina Basarabeanu
Having the same use case as @shivamitakari. Our clients want to keep their TFA settings when we copy the database from production to the other environments.
A new patch was created for version 2.x. - Status changed to Needs review
10 months ago 1:58pm 22 March 2024 - Status changed to Active
10 months ago 6:05pm 22 March 2024 - ๐ฌ๐งUnited Kingdom somersoft
Rerolled the patch #20 so that if there is a database prefix configured then it is used.
- ๐บ๐ธUnited States cmlara
As this issue keeps attracting re-rolls of a patch that should not be committed and no feedback has been provided on alternative options to redirect the issue in a way that aligns with secure software design Iโm going to close this as wonโt-fix.
If anyone has a suggestion that can be reconciled with #6 or #13 a new targeted issue can be opened.