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

Do not require key vault at start up time #442

Merged
merged 6 commits into from
Jan 24, 2024

Conversation

lukpueh
Copy link
Collaborator

@lukpueh lukpueh commented Jan 24, 2024

This PR allows starting the worker without key vault configuration. Unlike a previous attempt (#441), it does not change any specific key vault initialisation code, but instead skips key vault initialisation altogether, if the configuration is not provided.

In addition, the repository is updated to retrieve signers from a newly added signer store, instead of calling the key vault directly. Under the hood, the signer store does use the existing key vault, but only when needed. Moreover, this design makes it easier to provide a meaningful error message about missing config, again, only when needed.

Also note that in the future the signer store can easily be extended to fetch signers from other locations, e.g. URIs provided via public key metadata.

See commits for details!

Previously a public key was used to fetch the related signer from
keyvault to then extract that same public key from the signer and pass
it to add_key.

This can be shortened by passing the original public_key directly to
add_key.

Signed-off-by: Lukas Puehringer <[email protected]>
Add class to load and cache arbitrary securesystemslib Signer instances.
Currently, signers are loaded from the configured KEYVAULT only.

Compared to IKeyVault, SignerStore has a few advantages:
- does not need to be subclassed to support different signer types
- can easily be changed to load signers from other locations, than
  KEYVAULT, e.g. from a URI
  (see repository-service-tuf/repository-service-tuf#580)
- supports lazy loading of signers

Signed-off-by: Lukas Puehringer <[email protected]>
- Init IKeyVault only if RSTUF_KEYVAULT_BACKEND is set
- Add meaningful error message, if RSTUF_KEYVAULT_BACKEND is needed (at
  signing time) but unset.

Signed-off-by: Lukas Puehringer <[email protected]>
Signed-off-by: Lukas Puehringer <[email protected]>
@lukpueh lukpueh requested a review from kairoaraujo January 24, 2024 11:54
Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (486e98c) 100.00% compared to head (7be0a4f) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #442   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           14        15    +1     
  Lines         1009      1025   +16     
=========================================
+ Hits          1009      1025   +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

kairoaraujo
kairoaraujo previously approved these changes Jan 24, 2024
@kairoaraujo kairoaraujo merged commit 73ddfd4 into repository-service-tuf:main Jan 24, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants