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

docs: decision record about key management #4736

Conversation

paullatzelsperger
Copy link
Member

What this PR changes/adds

adds a decision record outlining planned changes in key management (remote signing, automatic key rotation)

Why it does that

improved security, centralized key management

Further notes

List other areas of code that have changed but are not necessarily linked to the main feature. This could be method
signature changes, package declarations, bugs that were encountered and were fixed inline, etc.

Linked Issue(s)

Closes # <-- insert Issue number if one exists

Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.

@paullatzelsperger paullatzelsperger added the documentation Improvements or additions to documentation label Jan 17, 2025
@paullatzelsperger paullatzelsperger force-pushed the docs/decision_record-key-management branch from 43805d5 to 77ce586 Compare January 20, 2025 09:10
Comment on lines 29 to 30
- add `byte[] sign(String keyId, byte[] data)` method to `Vault`
- add `boolean verify(String keyId, byte[] signature)` method to `Vault`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this functionalities to the Vault interface will couple the signing process to the Vault instance, maybe it's better to keep them separated, because sign-as-a-service solutions (not provided by vault) could be used.

I would suggest to have a DigitalSignatureService (first name that came to mind), exposing the sign, verify and rotate methods, the default implementation will be the current one, that leverages on the Vault instance to get the keys and sign through nimbus.
Then other implementations could be provided, like for Hashicorp HSM.

Copy link
Member Author

@paullatzelsperger paullatzelsperger Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coupling the signing process to the Vault isn't necessarily a bad thing, because it reflects reality: most Vaults (Azure, AWS, HCV) support facilities to sign, verify and rotate, in addition to be secure Key-Value stores.

So to me that coupling, and introducing a DigitalSignatureService is not mutually exclusive: the DigitalSignatureService would simply be the "client code" that calls methods on the Vault. To do that, the vault would still have to expose sign, verify and rotate methods.

This would mean, there could be one DigitalSignatureService:

  • a VaultSignatureService, that delegates those calls to the Vault if supported, and performs actions locally if not.

If we don't add those methods to the vault, the we'll have pro provide a DigitalSignatureService per Vault, which is unnecessarily complex IMO.

[edit]: it would be the DigitalSignatureService implementation that uses JWSSigner and JWSVerifier objects from Nimbus. IF we went with separate services per Vault, this would introduce a dependency onto Nimbus in each Vault.

Copy link
Member

@ndr-brt ndr-brt Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[edit]: it would be the DigitalSignatureService implementation that uses JWSSigner and JWSVerifier objects from Nimbus. IF we went with separate services per Vault, this would introduce a dependency onto Nimbus in each Vault.

it's the other way around: the "nimbus way" to sign will just need to be implemented once in a "DigitalSignatureService" implementation (registered by default and eventually overridable), instead to need to be provided for every Vault implementation (because the sign, verify and rotate will need separate implementations for different Vault implementation, but, at the end, they will be the same).

TL;DR: it's the Signature service that uses vault, not the other way around

Copy link
Member Author

@paullatzelsperger paullatzelsperger Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nimbus is mainly relevant for JWTs, and for that, it is sufficient to provide custom JWSSigner and JWSVerifier objects that we can plug in. We already have a TokenGenerationService, that can be customized with a JWSSigner, all we need is to do the equivalent for the TokenValidationService.

So in a way, JWSSigner/JWSVerifier combined are the DigitalSignatureService

In cases, where non-JWT content is signed, we could directly call the vault methods, I don't think we have such a case ATM though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was more referring to changing the Vault interface, that doesn't look the best approach, because signature (also if only JWT) is something that "relies" on vault to sign or it can be done by a vault service, but also by a separate service.

An example is how AWS manages this: Secret Manager keeps secrets, while the signature as a service is made by a different product called KMS.

Keeping the interfaces separated will help flexibility and avoid hard coupling between vault and a signature service

Copy link
Member Author

@paullatzelsperger paullatzelsperger Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To sum up:

If we keep this separate, there would have to be a AwsKmsSignatureService, a AzureVaultSignatureService, a HashicorpVaultSignatureService, a GcpSecretsManagerSignatureService, etc., each provided individually.

Combining this, the JWSSigner and JWSVerifier would delegate to the SignatureService (instead of the Vault).

The default implementation of the SignatureService would simply take a vault, pull the keys out and sign/verify locally.

do i have this correct so far?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, looks good 👍

Copy link
Member Author

@paullatzelsperger paullatzelsperger Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the document. wanna give it another look?

Copy link
Contributor

@jimmarino jimmarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added wording suggestions for clarity.

- Custom implementations of `JWSSigner` and `JWSVerifier` (from Nimbus) named `RemoteJwsSigner` and `RemoteJwsVerifier`
respectively, will delegate signing and verifying to the `SigningService`.
These objects are provided by an extension.
- A configuration value `edc.signing.remote.enable` will be added to enable/disable remote signing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit:
Isn't this configuration redundant? If you add a remote signing service to your runtime, you'd expect remote signing to be done.
I could imagine a case where the remote signing service is added, only for the edc operator to find out later it wasn't working because it wasn't activated...

Copy link
Member Author

@paullatzelsperger paullatzelsperger Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, because doing this on the extension level will bake the mode of signing right into the distribution. with a config value, it's up to the user to either sign locally, or remotely.

@paullatzelsperger paullatzelsperger force-pushed the docs/decision_record-key-management branch from dc4bc14 to 8e9e0af Compare January 22, 2025 17:41
@paullatzelsperger paullatzelsperger merged commit f5bead2 into eclipse-edc:main Jan 22, 2025
4 checks passed
@paullatzelsperger paullatzelsperger deleted the docs/decision_record-key-management branch January 22, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants