Downgrade jwt_reparse from alert to debug log#11759
Merged
Merged
Conversation
tylerwilliams
approved these changes
Apr 1, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts JWT parsing instrumentation in ClaimsFromContext to avoid emitting a monitoring alert on the normal cloud executor authentication path, while still retaining a low-noise diagnostic signal.
Changes:
- Replace
alert.CtxUnexpectedEvent(ctx, "jwt_reparse", ...)with a rate-limited debug log. - Introduce a named, rate-limited sub-logger (
reparseLog) to cap log volume (once per minute).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
228b83a to
be6cfad
Compare
The jwt_reparse alert fires on the normal executor authentication path, not on an actual unexpected reparse. This is the initial (and only) parse of the JWT for every task execution on cloud executors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
be6cfad to
f84a090
Compare
iain-macdonald
added a commit
that referenced
this pull request
Apr 2, 2026
The `jwt_reparse` `alert.UnexpectedEvent` added in #11754 fires on the normal cloud executor authentication path — it's not an actual unexpected reparse, it's the initial (and only) parse of the JWT for every task execution. The call flow: 1. `priority_task_scheduler.go:585` — sets only the raw ES256-signed JWT string in the context 2. `executor.go:200` — calls `interceptors.AddAuthToContext` 3. `interceptors.go:96` — calls `AuthenticatedGRPCContext` 4. `oidc.go:558` — calls `authenticateGRPCRequest(ctx, true)` 5. `oidc.go:501-543` — peer certs, SSL headers, API keys, basic auth, authority all miss (local context, no gRPC metadata) 6. `oidc.go:547` — falls through to `claims.ClaimsFromContext(ctx)` 7. `claims.go:490` — no cached claims (nobody parsed the JWT yet) 8. `claims.go:497` — no auth error (first auth attempt) 9. `claims.go:498` — finds the JWT string 10. `claims.go:503` — fires `jwt_reparse` alert (misleading — this is the first parse) 11. `claims.go:504` — calls `parseClaims` with `DefaultKeyProvider` (no LRU cache) 12. `claims.go:590-591` — tries HS256 key first, fails 13. `claims.go:594-595` — tries ES256 key, expensive elliptic curve verification succeeds 14. `oidc.go:560` — `AuthContextWithJWT` re-assembles a new HS256 JWT from the claims and caches both in context This downgrades the alert back to the rate-limited debug log it was before #11754. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
The
jwt_reparsealert.UnexpectedEventadded in #11754 fires on the normal cloud executor authentication path — it's not an actual unexpected reparse, it's the initial (and only) parse of the JWT for every task execution.The call flow:
priority_task_scheduler.go:585— sets only the raw ES256-signed JWT string in the contextexecutor.go:200— callsinterceptors.AddAuthToContextinterceptors.go:96— callsAuthenticatedGRPCContextoidc.go:558— callsauthenticateGRPCRequest(ctx, true)oidc.go:501-543— peer certs, SSL headers, API keys, basic auth, authority all miss (local context, no gRPC metadata)oidc.go:547— falls through toclaims.ClaimsFromContext(ctx)claims.go:490— no cached claims (nobody parsed the JWT yet)claims.go:497— no auth error (first auth attempt)claims.go:498— finds the JWT stringclaims.go:503— firesjwt_reparsealert (misleading — this is the first parse)claims.go:504— callsparseClaimswithDefaultKeyProvider(no LRU cache)claims.go:590-591— tries HS256 key first, failsclaims.go:594-595— tries ES256 key, expensive elliptic curve verification succeedsoidc.go:560—AuthContextWithJWTre-assembles a new HS256 JWT from the claims and caches both in contextThis downgrades the alert back to the rate-limited debug log it was
before #11754.
🤖 Generated with Claude Code