Currently if i choose the provider "Configuration" the key value is stored as plain text. It would be safer if the value was stored encrypted using an Encrypt profile. Suggestion to have a submodule that requires encrypt module and allows the stored value to be encrypted.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | key-encrypt-2980072-4.patch | 4.47 KB | pookmish |
| #3 | interdiff_2-3.txt | 960 bytes | pookmish |
| #3 | key-encrypt-2980072-3.patch | 4.47 KB | pookmish |
Issue fork key-2980072
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pookmish commentedAttached patch adds a submodule for this request.
Comment #3
pookmish commentedadding check for encryption profile to prevent error.
Comment #4
pookmish commentedbroken semicolon
Comment #5
rlhawkThis is an interesting idea that has been raised before. My inclination is to remove the Configuration key provider from a future version of Key. I can imagine wanting to be able to commit keys (encrypted) in the repo, so that only one key (the encryption key) needs to be stored in a more secure fashion, but can you tell me more about your use case?
Comment #6
pookmish commentedWhat you mentioned is basically the idea. I have multisite installation that contains an encryption key for each site (to protect each site in the even of corruption). Then each site contains multiple keys stored in config with encrypted values. This way we can use config read-only module and prevent altering of those keys outside of version control.
I like the use of an unencrypted key in config for use when I need to do a config override. I'm using that method to change urls for migrate plus. So there is no concern to have that particular key encrypted.
Comment #7
rlhawkComment #9
aaronbaumanWorks like a charm, and meets my use case perfectly.
My only point of feedback: why put this in a new module?
Seems like it could be super useful to add directly to key module core plugin set.
Comment #10
rlhawkThe main reason to have it in a separate module, I think, is to be able to avoid having a dependency on Encrypt, if you're not using encryption.
Comment #11
aaronbaumanRight, duh, that makes sense.
What about folding this directly into encrypt module then?
Comment #12
rlhawkThat's a really good idea. Can anyone think of a reason this issue should not be moved to Encrypt?
Comment #13
rlhawkI've thought about this some more and I think we should not move the functionality to Encrypt, since that module is supposed to focus on being an API, without implementing encryption of any specific data. So we could add it to Key, but another option would be to make Key Encrypt its own project.
Comment #14
pookmish commentedI could see benefits from both a sub module and a stand alone project. I'd lean towards a sub module personally only because it's such a small addition.
But either way I'm comfortable and can spin up a project if that's the route we choose. Glad to see more need of the feature like my own.
Comment #15
aaronbauman+1 for keeping it in Key
and +1 vote for RTBC
Comment #16
imclean commentedThis works well, very useful. For an extra layer of separation I've overridden the AES key in
settings.phpso it isn't stored in config files or the database. This can also use environment variables.Comment #17
imclean commentedComment #20
akalam commentedI created a MR with the patch from @pookmish and a small change on the .info.yml file to be compatible with D9
Comment #21
akalam commentedI created a MR with the patch from @pookmish and a small change on the .info.yml file to be compatible with D9
Comment #22
tijsdeboeckI've tested MR3, and it works perfectly. Would be awesome to have it merged into the stable release.
It's a very useful addition for the key module, I found it very strange that it stored the keys as plain text in config...
I know that it's not best practice to store them in config, but it is possible now, so it makes perfect sense to allow them at least to be stored encrypted.
Comment #23
tijsdeboeckAny update? Would be great to have this merged... Thanks!
Comment #24
rlhawkI like the idea of encrypting keys. Here are my thoughts:
I will wait a few days for feedback and then create a new project for this feature and we can address the other bullet points in that project's issue queue.
Comment #25
rlhawk@pookmish - I don't want to ignore your offer to create the project, so if you're still willing to do it, please go ahead. I think the name you've already given the module, "Key Encrypt", is a good name for it, especially if we end up using it for encrypting key values more broadly, not just in configuration.
Comment #26
tijsdeboeckI've made a small tweak so the code works for D10.
Comment #27
joseph.olstadMR doesn't explicitly support D11
Comment #28
tijsdeboeck@joseph.olstad, I've updated the core_version_requirement to match the parent module, this adds support for D11.
Comment #29
ptmkenny commentedThis MR will not be accepted as described in #24. Instead of updating the MR, a new module should be created.
Comment #30
rlhawkI did create a module called Key Encrypt, but it's currently empty. Let's bring this work over there.
Comment #31
rajeshreeputraAdding this work in new module Key Encrypt.
Please refer issue - #3520440: Encrypt key value
Hello @rlhawk, please create branch in key_encrypt project.
Comment #32
japerryQuestion--why make a new project and not just make this feature a sub module of key?
Comment #33
mrweiner commented@japerry see #24
Comment #34
mxr576I came across this issue while working on ideas for #3559052: [META] Improve security of AI and VDB provider credential storage. I see that there has not been any recent activity on the Key Encrypt project. Are there any plans to move this forward, or is the expectation that work on Key Encrypt will only resume (or be reconsidered) after Key 2.x is released?