Skip to content

fix(auth): add configurable HTTP timeout on OIDC discovery and JWKS fetches#246

Draft
remidebette wants to merge 1 commit into
mlflow-oidc:mainfrom
instadeepai:upstream/oidc-http-timeout
Draft

fix(auth): add configurable HTTP timeout on OIDC discovery and JWKS fetches#246
remidebette wants to merge 1 commit into
mlflow-oidc:mainfrom
instadeepai:upstream/oidc-http-timeout

Conversation

@remidebette

Copy link
Copy Markdown
Contributor

Summary

Defensive fix — not observed in production. Surfaced while reviewing the auth path during a broader resilience audit (no related incident).

The bare requests.get calls in _get_oidc_jwks have no timeout, so a slow or hung IdP would block request threads until the OS-level TCP timeout (~2 minutes), turning a brief upstream blip into a wave of authentication failures. This PR adds a bounded, configurable timeout so that failure mode is impossible regardless of IdP health.

Changes

  • Adds `OIDC_HTTP_TIMEOUT_SECONDS` (default `10`) to `AppConfig`.
  • Applies the configured timeout to both `requests.get` calls in `_get_oidc_jwks` (OIDC discovery + JWKS fetch).
  • Tests: extends `test_get_oidc_jwks_success` to assert `timeout=` is forwarded; adds `test_get_oidc_jwks_uses_configured_timeout` proving the config value overrides the default.
  • Documents the new variable in `docs/configuration.md` next to `OIDC_JWKS_CACHE_TTL_SECONDS`.

Test plan

  • Existing JWKS tests still pass (locally: 14/14)
  • Maintainer review

Notes

This was originally bundled with #243 (auth-failure diagnostics) and split out per @kharkevich's review feedback there. Marked as draft since it's defensive — happy to close if maintainers prefer to skip it given there's no production signal.

🤖 Generated with Claude Code

…etches

The bare requests.get calls in _get_oidc_jwks have no timeout, so a slow
or hung IdP blocks request threads until the OS-level TCP timeout
(~2 minutes), turning a brief upstream blip into a wave of authentication
failures.

Adds OIDC_HTTP_TIMEOUT_SECONDS (default: 10) so operators can tune the
timeout per deployment — lower for faster failover when the IdP is
unreachable, higher for slower providers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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