Add signature caching for individual keys#52
Draft
fryshorts wants to merge 2 commits intosassoftware:masterfrom
Draft
Add signature caching for individual keys#52fryshorts wants to merge 2 commits intosassoftware:masterfrom
fryshorts wants to merge 2 commits intosassoftware:masterfrom
Conversation
added 2 commits
April 4, 2025 19:08
Add a memcached option to keys. When enabled, it allows for caching of signatures in case the same file gets signed multiple times. Signed-off-by: Leonhard Oelke <leonhard@in-verted.de>
When caching for a key is enabled, this will add an additional property to the audit message to show if the signature was fetched from cache. Signed-off-by: Leonhard Oelke <leonhard@in-verted.de>
fryshorts
commented
Apr 4, 2025
| # Optional memcache servers for memoizing signing requests | ||
| #memcache: | ||
| # - 127.0.0.1:11211 | ||
|
|
Contributor
Author
There was a problem hiding this comment.
Should i mention that the cache should be cleared after changing the key configuration?
| } | ||
|
|
||
| func (c *signatureCache) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) { | ||
| cacheKey := fmt.Sprintf("sig-%s-%x", c.keyConf.Name(), digest) |
Contributor
Author
There was a problem hiding this comment.
I'm making the following assumptions here:
- If the key configuration changes for the named key, the user should clear the cache
- Digests from different Hashing-Algorithms will not collide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These patches add the option to cache the signatures generated by keys. We implemented this, because our internal processes are not ... optimal, and thus some binaries are getting signed repeatedly in CI/CD without changing.
Since we pay per signature, this will hopefully help us (and others in the same situation) to save some money.
I added the memcache option to individual keys instead of the key section or anywhere else because:
Since i was not sure if you would want to add the feature, i did not spend time on prometheus metrics. If you are interested in merging this, i can add those as well.