Skip to content

perf(artifact-cas): parse the EC public key once instead of per request#3225

Open
matiasinsaurralde wants to merge 1 commit into
chainloop-dev:mainfrom
matiasinsaurralde:perf/cas-parse-public-key-once
Open

perf(artifact-cas): parse the EC public key once instead of per request#3225
matiasinsaurralde wants to merge 1 commit into
chainloop-dev:mainfrom
matiasinsaurralde:perf/cas-parse-public-key-once

Conversation

@matiasinsaurralde

@matiasinsaurralde matiasinsaurralde commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

The JWT verification keyfunc in 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 keyfunc closure 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.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

@matiasinsaurralde matiasinsaurralde requested a review from a team June 22, 2026 16:25
@matiasinsaurralde matiasinsaurralde force-pushed the perf/cas-parse-public-key-once branch from adac11c to c8794f9 Compare June 22, 2026 16:30
@chainloop-platform

Copy link
Copy Markdown
Contributor

AI Session Analysis

Missing AI Coding Sessions

We 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 skip-ai-session label to this PR to bypass this check.

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>
@matiasinsaurralde matiasinsaurralde force-pushed the perf/cas-parse-public-key-once branch from c8794f9 to 6123f01 Compare June 22, 2026 16:37
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.

1 participant