feat: add support for decryption scheme from properties in senhasegura Devops Secrets Management (DSM) provider#3895
Conversation
|
For testing, mock the attached files on Postman and apply the YAML configuration below. However, make sure to change the URL to your Postman mock first. |
|
Hmmm... So I can see the appeal of extending ExternalSecrets to use a decryption scheme, but honestly, I find this a premature optimization kind of approach? Like, NONE of the other providers have anything NEAR such a feature so extending the base type to do this seems overkill. I would suggest expanding only the Senhasegura provider's type. We follow the least friction path here. Don't add if it's not needed. :) Meaning, we keep changes localised to providers. For example, even CAProvider additions was refactored only after several more providers where using it. Than it was standardised. If we see more than one provider needing decryption we'll add something for that. For now, please keep the changes local to Senhasegura. Thanks 🙇 |
|
Ok, thanks for your feedback. I just wanted to explain my reasoning: changing the external secrets type to a decryption schema will impact other providers, even if they are not currently in use. However, this change will make it easier to implement similar functionality if other providers need it in the future.
As a matter of fact, I will develop it in such a way that only senhasegura will have this feature.
Regarding this change - decryptingStrategy:
- remoteRef:
conversionStrategy: Default
decodingStrategy: Base64
decryptingStrategy:
hash: SHA1
privateKeyType: PKCS8
scheme: RSA-OAEP
key: dip_app-cripto_dev
property: PASS_01
Do you have any considerations? I need to check if the property must be decrypted.
Considering that only senhasegura has this feature, how could we define the type?
|
These could be defined in the metadata section of the external secret object. And use a Key to define which key you are targeting with this setting. So like, you could have a section as such: metadata:
decryption:
keyname:
decryptingStrategy:
hash: SHA1
privateKeyType: PKCS8
scheme: RSA-OAEP
anotherKeyName:
decryptingStrategy:
hash: SHA1
privateKeyType: PKCS8
scheme: RSA-OAEPDoing this, the key would be the map key so you could lookup quickly if a decoding strategy is defined for a specific key. This way, there is no need to change the ref type. |
|
ah, I honestly though that ES would have a metadata field similar to what PushSecret has. But I can see that it doesn't. Okay, how about this. You could create a template method that can have certain arguments that let's you decode the given value? And if you do that, that would be something that EVERY provider could use. :) WDYT? |
|
Talked it over with the rest of the team, and the Template idea can be a really nice one to allow this feature for the other providers as well. :) 👍 |
9b32e72 to
092914a
Compare
|
I implemented a new solution without the need to refactor other providers. I created a new interface that "extends" the v1beta1.SecretsClient interface. This way, only those who implement the new interface will have the feature to decrypt sensitive data. I will conduct new tests with another provider to see the behavior. WDYT? |
|
But you are still extending remoteRef with a capability that is only supported by a single provider. 🤔 |
|
The idea is to have it work like the base64 feature. In this process, I need this feature too. I honestly don't see any problem with this format; the only difference between these features is how the private key is retrieved by the provider. I will still need to understand how the template works to try implementing your suggestion |
|
|
@felipeosantos Are you doing the template stuff then? :) |
|
Sorry, @Skarlso, but I still haven't had time to implement the template. However, in my company, we are already using many microservices with this format. I need to think about how to migrate to the template format as well. That's why I'm maintaining this fork. In fact, I intend to implement the template format ASAP. Do you prefer to close this PR, and I’ll open a new one when I implement the feature this way? |
|
It's fine, you can leave this open and go from here I think. |
|
This pr is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
|
Hello @Skarlso, I will start an implementation with the template. Could you please remove the Stale tag? |
|
Sure! |
|
|
…vanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com>
…cryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com>
|
This looks okay now, I'm waiting for @felipeosantos to put that back that test with a different name and some explanation that it's not an exploit. :D |
|
IMO if this is an encrypted file only, it should be created as part of the test setup, and available only in memory. |
… decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com>
About the rsaDecrypt function unit test - it was implemented. But for the template function unit test, I used a similar approach that involved complex data (e.g., a PFX file), and in my case, purely encrypted data. However, if you prefer that I generate the data dynamically, I can do that without any problem - though it will involve writing some helper functions, which might make the template test more complex. |
|
Hmmm, I don't know. I don't want an entire encryption suit in the tests just to test decryption. But I also don't really want a file that could potentially be flagged as insecure or malicious data just because it's unreadable and looks like garbage. Argh. How much code would be involved with the encryption library? Because I also don't really want to " just test it in production " :D |
counter argument to implement the helper functions needed - if something breaks / a user complain its not working, we have a contract test to refer to. It will be easier to simulate with "their data" |
I will adjust this point. |
|
@felipeosantos Please ping me when I can continue. |
… decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com>
Done! |
|
|
Thank you so much for all the effort you've put into this! |
…a Devops Secrets Management (DSM) provider (external-secrets#3895) * Initial Commit Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * Building an RSA-Based Sensitive Data Decryption Feature with Advanced Templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * reviewable: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * chore(license): building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: remove bin data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: add encrypted data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: add encrypted data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> --------- Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> Signed-off-by: Olumide Ogundele <olumideralph@gmail.com>
* chore(lint): fix revive lint errors in providers package Signed-off-by: Olumide Ogundele <olumideralph@gmail.com> * feat: add support for decryption scheme from properties in senhasegura Devops Secrets Management (DSM) provider (#3895) * Initial Commit Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * Building an RSA-Based Sensitive Data Decryption Feature with Advanced Templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * reviewable: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * chore(license): building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: remove bin data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: add encrypted data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: add encrypted data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> --------- Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> Signed-off-by: Olumide Ogundele <olumideralph@gmail.com> * chore(lint): fix dot error Signed-off-by: Olumide Ogundele <olumideralph@gmail.com> --------- Signed-off-by: Olumide Ogundele <olumideralph@gmail.com> Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> Signed-off-by: Gergely Brautigam <skarlso777@gmail.com> Co-authored-by: Felipe Oliveira <felipeoliveira.s.br@gmail.com> Co-authored-by: Gergely Brautigam <skarlso777@gmail.com>
…a Devops Secrets Management (DSM) provider (external-secrets#3895) * Initial Commit Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * Building an RSA-Based Sensitive Data Decryption Feature with Advanced Templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * reviewable: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * chore(license): building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: remove bin data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: add encrypted data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: add encrypted data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> --------- Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> Signed-off-by: Samuel Molling <samuelmolling@gmail.com>
…ts#5362) * chore(lint): fix revive lint errors in providers package Signed-off-by: Olumide Ogundele <olumideralph@gmail.com> * feat: add support for decryption scheme from properties in senhasegura Devops Secrets Management (DSM) provider (external-secrets#3895) * Initial Commit Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * Building an RSA-Based Sensitive Data Decryption Feature with Advanced Templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * reviewable: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * docs: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * chore(license): building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: building an rsa-based sensitive data decryption feature with advanced templating v2 Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: remove bin data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: add encrypted data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> * test: add encrypted data test on building an rsa-based sensitive data decryption feature Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> --------- Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> Signed-off-by: Olumide Ogundele <olumideralph@gmail.com> * chore(lint): fix dot error Signed-off-by: Olumide Ogundele <olumideralph@gmail.com> --------- Signed-off-by: Olumide Ogundele <olumideralph@gmail.com> Signed-off-by: Felipe Oliveira dos Santos <felipeoliveira.s.br@gmail.com> Signed-off-by: Gergely Brautigam <skarlso777@gmail.com> Co-authored-by: Felipe Oliveira <felipeoliveira.s.br@gmail.com> Co-authored-by: Gergely Brautigam <skarlso777@gmail.com> Signed-off-by: Samuel Molling <samuelmolling@gmail.com>








Problem Statement
The Senhasegura provider has a feature to encrypt sensitive data when returning information. However, External Secrets does not decrypt this sensitive data when creating a secret in Kubernetes.
Related Issue
Feature #3582
Proposed Changes
Implemented a feature to decrypt sensitive data in External Secrets using a private key, designed in a way that allows other providers to also use this feature. Modified the External Secrets type to accept the configuration of a private key (specific to each provider), options such as encryption scheme, private key type, and hash algorithm.
Checklist
git commit --signoffmake testmake reviewable