Repository navigation
Conversation
…IDC mode Previously, the 3 TypeScript initializers (openai/anthropic/custom) gated their OIDC override on '&& refreshOIDCAccessToken', so any future caller that dropped the DI param would silently send the env service key for OIDC users — a latent privilege boundary inversion with no log signal. Changed to: when isLLMOIDCForwardingEnabled() and user is OIDC, missing DI is an explicit error. Adds 3 regression tests, one per initializer, asserting the throw. Existing tests already inject the dep where required, so no other test changes needed. The 2 JS initializers (azureAssistants, assistants) require the bridge directly via require() so this issue doesn't apply to them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The previous logger.error call captured only error.message, collapsing invalid_grant / invalid_client / network errors / JWKS failures / IdP 5xx into indistinguishable log lines. openid-client carries category info on error.code / cause / response.status / error_description — preserve them so production operators can distinguish 'IdP outage' from 'expired refresh_token' from 'JWKS rotation' without re-deriving context from request timestamps. error.response.data is deliberately NOT logged — that field carries the failed tokenset and would leak secrets. Adds a regression test asserting the structured fields are present AND that response.data contents never leak through any logger call. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The combination silently de-syncs the openid_user_id cookie: every LLM-side token refresh (via refreshOIDCAccessToken bridge) passes res=null to setOpenIDAuthTokens, which (correctly, per C2) skips all res.cookie writes. The session-side expiry updates but the cookie stays at the OLD expiry. Once the cookie expires, image fetches silently fail while the user's session is still active. Pragmatic fix: extend assertOIDCForwardingCompatible() to reject the combination at boot, with a message pointing operators at the design doc. The structural alternative (threading req.res through the bridge so cookies CAN be written during refresh) is a larger change deferred to a future PR. Adds 2 regression tests + .env.example warning. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
resolveSummarizationProvider built its own apiKey from customEndpointConfig.apiKey (env-expanded) and passed it to getOpenAIConfig directly, bypassing initializeCustom and therefore the OIDC bearer override added in C4. With OIDC_FORWARD_TO_LLM=true, summarization sub-calls leaked the env service key instead of the user's OIDC JWT — gateway saw mixed identities for one conversation. Plumbs refreshOIDCAccessToken through createRun → buildAgentContext → resolveSummarizationProvider, gates on the same flag/provider check the initializers use, and overrides apiKey with the OIDC accessToken. Same fail-loud pattern as F1: missing DI in OIDC mode throws. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ld asymmetry T-3: ensureLLMBearer's inflightRefresh map is keyed by String(req.user._id). Add a regression test asserting two concurrent calls for DIFFERENT users trigger 2 refreshes (not 1) and produce 2 distinct tokens (no cross- contamination). A future regression that keys the map on shared input (e.g., openidId truncation) would silently swap tokens between users — a real security issue. T-4: req.session.openidTokens.expiresAt (ms, REFRESH_TOKEN_EXPIRY relative) vs req.user.federatedTokens.expires_at (seconds, IdP-issued exp claim) are deliberately different fields with different units. A future cleanup PR that 'unifies' them would silently break the 60s pre-refresh leeway check in ensureLLMBearer. Lock the asymmetry in with explicit assertions on units and magnitude. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ants initializers T-1 (azureAssistants): the JS initializer updates BOTH apiKey AND opts.defaultHeaders['api-key'] — a different SDK path from the TS openai initializer's clientOptions.azure.azureOpenAIApiKey. Without a direct spec, regressions on either rewrite would be invisible. T-2 (assistants): adds tests for the userProvidesURL security guard (prevents OIDC bearer exfiltration to user-controlled baseURL). The custom initializer has the same guard with its own test; this file needs its own coverage because copy-paste regressions in either direction would not surface in the other spec. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
Follow-up to #19 (OIDC LLM forwarding). Post-merge review identified 5 Critical findings and several Important test gaps. This PR addresses all 4 Critical findings that can be fixed at the server layer (the 5th, client-side AUTH_FAILED rendering, requires a separate frontend PR) plus the 2 critical test gaps that lock current correct behavior against future regression.
Commits
Fixes
Tests
Deferred to PR-4 (frontend + polish)
Verification
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Generated with Claude Code