fix: prevent auth provider cache staleness#161
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3da6939c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { | ||
| headers: { | ||
| 'Cache-Control': 'public, max-age=300, s-maxage=300', | ||
| 'Cache-Control': 'no-store, max-age=0', |
There was a problem hiding this comment.
Bypass the provider cache for no-store responses
When an external/OIDC provider list has already been fetched, this endpoint still calls getAvailableProviders(), which returns the process-level providersCache until its 5-minute TTL expires (lib/auth/identity-provider.ts:198, with writes at 215-218 and 262-265). In that scenario, toggling or changing providers in the identity service can still leave login/signup serving stale provider data despite the new no-store HTTP header and client fetch option; only browser/proxy caching is bypassed, not the in-memory provider cache.
Useful? React with 👍 / 👎.
Summary
Live finding
The live providers endpoint currently returns Mystira Identity, but it was still serving Cache-Control: public, max-age=300. A prior empty provider response could make the login UI show the stale "Mystira Identity sign-in is not configured" hint even after the App Service config was corrected.
Validation