perf(artifact-cas): parse the EC public key once instead of per request#3225
Open
matiasinsaurralde wants to merge 1 commit into
Open
perf(artifact-cas): parse the EC public key once instead of per request#3225matiasinsaurralde wants to merge 1 commit into
matiasinsaurralde wants to merge 1 commit into
Conversation
adac11c to
c8794f9
Compare
Contributor
AI Session AnalysisMissing AI Coding SessionsWe detected commits in this PR that were AI-assisted, but the matching Chainloop Trace session(s) could not be found in Chainloop. Please make sure the AI coding session evidence has been sent by the Chainloop CLI, or add the Learn more about Chainloop Trace. Powered by Chainloop and Chainloop Trace |
The JWT verification keyfunc re-parsed the public key PEM on every authenticated request across the unary, stream and HTTP download paths. Parse the EC public key once at server construction and share a single keyfunc closure across all interceptors. A malformed key now fails at startup instead of as a per-request auth error. Signed-off-by: Matías Insaurralde <matias@chainloop.dev>
c8794f9 to
6123f01
Compare
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.
Summary
The JWT verification
keyfuncin the artifact CAS re-parsed the public key PEM on every authenticated request, across the gRPC unary, gRPC stream, and HTTP download paths.This parses the EC public key once at server construction and shares a single
keyfuncclosure across all interceptors. The path resolution and key-loading logic, previously duplicated between the gRPC and HTTP servers, is consolidated into a single helper.A malformed or unreadable key now fails at server startup instead of surfacing as a per-request authentication error. The change is otherwise behavior-preserving: the key was already loaded once at startup, so no runtime key-handling behavior changes.