Skip to content

[auth] Don't panic on transient failures when refreshing JWKS keys - #1634

Merged
mickmis merged 1 commit into
interuss:masterfrom
Orbitalize:fix_1632
Aug 13, 2026
Merged

[auth] Don't panic on transient failures when refreshing JWKS keys#1634
mickmis merged 1 commit into
interuss:masterfrom
Orbitalize:fix_1632

Conversation

@the-glu

@the-glu the-glu commented Aug 13, 2026

Copy link
Copy Markdown
Member

This PR contributes to #1632 by implementing a retry mechanism for transient JWKS key refresh failures.

The service will still panic when receiving a valid reply where, e.g., the required key is not found.

Implementing it via the CodeRetryable system had the positive side effect of applying the same retry behavior on startup in case of issues - similar to the datastore - which makes sense instead of directly crashing, so I kept it.

No documentation changes are included as none currently exist. I will create follow-up PRs for that along with deployment changes.

@mickmis mickmis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not exactly what is described in #1632 (comment), but I think that is OK as a first step. To be seen if that warrants a follow-up issue though, notably fro the dynamic adaptation depending on the incoming tokens expiration.

Comment thread pkg/errors/errors.go Outdated
Comment thread pkg/auth/auth.go
Comment thread cmds/core-service/main.go Outdated
jwksEndpoint = flag.String("jwks_endpoint", "", "URL pointing to an endpoint serving JWKS")
jwksKeyIDs = flag.String("jwks_key_ids", "", "IDs of a set of key in a JWKS, separated by commas")
keyRefreshTimeout = flag.Duration("key_refresh_timeout", 1*time.Minute, "Timeout for refreshing keys for JWT verification")
jwksMaxCacheAge = flag.Duration("jwks_max_cache_age", 1*time.Hour, "Maximum duration during which keys that could not be refreshed are still used before shutting down the service")

@mickmis mickmis Aug 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

#1636 add some general documentation, for the second point would that be enough to put it there (PR may need some improvement for that) ? I would try to avoid lengthy explanations there.

First point done.

@the-glu

the-glu commented Aug 13, 2026

Copy link
Copy Markdown
Member Author

To be seen if that warrants a follow-up issue though, notably fro the dynamic adaptation depending on the incoming tokens expiration.

Yes, it probably since dynamic adaptation is a bit 'tricky' and is probably worth a dedicated PR

@mickmis mickmis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM
I will remove however from the description the fact that it fixes the issue and let @BenjaminPelletier assess what to do with it (close it, leave it open, and/or open a follow-up issue).

@mickmis
mickmis merged commit 0642018 into interuss:master Aug 13, 2026
12 checks passed
@mickmis
mickmis deleted the fix_1632 branch August 13, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants