To support #1896006: Encrypt stored database credentials, and any other sensitive information we may wish to store in migration or group arguments, we will add static encrypt/decrypt convenience functions to MigrationBase.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

See attached patchfile.

Anonymous’s picture

Status: Active » Needs review
moshe weitzman’s picture

Those look simple enough. If we ever have more advanced needs, the encrypt module is pretty solid. It is maintained by Greg Knaddison who is lead of security team. See http://groups.drupal.org/node/258513

Anonymous’s picture

I agree. Mike and I discussed this quickly, for now our needs our simple. I had seen the encrypt module, looked like a great way to support more advanced encryption needs without adding mcrypt library (or similar) requirements.

mikeryan’s picture

Status: Needs review » Active

Right - encrypt does look helpful, but I'm reluctant to add a module dependency that benefits relatively few Migrate users.

mikeryan’s picture

Status: Active » Needs review
mikeryan’s picture

Status: Needs review » Needs work

Nate and I have discussed this some more - while we don't want a hard module dependency, we do want to leverage the encrypt module when we need encryption. Also, I'd like to make the DX as simple as possible - what I'd like to do is have a standard migration/group argument 'encrypted_arguments', which would be an array of argument names that should be encrypted/decrypted. Documentation for the argument will make clear that the encrypt module is required to make use of this functionality. Thoughts?

moshe weitzman’s picture

Sounds good to me.

mikeryan’s picture

Issue tags: +Migrate 2.6

I would like to get this in to Migrate 2.6 - the wizard API is going to support configuring migrations (including credentials) through the UI which will need to be saved, so we should do what we can to protect those credentials.

Anonymous’s picture

Assigned: Unassigned »

I'll take it - assigning to myself.

Anonymous’s picture

Status: Needs work » Needs review
FileSize
3.28 KB

Here is a patch that provides logic for encryption as well as detecting the presence of encrypt.module (the same as from a patch for migrate_d2d.module). This patch only addresses the original issue of providing convenience functions - the functionality Mike outlined in comment #7 should probably be logged as a discrete ticket?

Relatedly, I'll be deprecating the (now) duplicate functions from this issue patch: http://drupal.org/node/1896006

Status: Needs review » Needs work

The last submitted patch, migrate-encryption-convenience-functions-1901980-11.patch, failed testing.

mikeryan’s picture

I would like to see the 'encrypted_arguments' support as part of this patch.

Thanks.

mikeryan’s picture

Status: Needs work » Needs review
mikeryan’s picture

OK, added automated encryption/decryption - by passing an array argument in $arguments, named 'encrypted_arguments', any arguments named in that array will be encrypted before being saved and decrypted when retrieved from the db. I also made the functions public static so the MigrateGroup class could use them as well.

Patch attached if anyone else wants to try it - I still need to test it in a real-world case (migrate_d2d_ui database credentials).

mikeryan’s picture

Status: Needs review » Fixed

Did some real-world testing and it looks OK, committed.

Automatically closed -- issue fixed for 2 weeks with no activity.