{"record":{"id":"eb8bbbfb38ed7147","repo":"BerriAI/litellm","slug":"unsolicited-idp-initiated-saml-responses-require","errorCode":null,"errorMessage":"Unsolicited (IdP-initiated) SAML responses require a shared Redis cache so the replay guard is enforced across every worker.","messagePattern":"Unsolicited \\(IdP-initiated\\) SAML responses require a shared Redis cache so the replay guard is enforced across every worker\\.","errorType":"http","errorClass":"HTTPException","httpStatus":401,"severity":"error","filePath":"litellm/proxy/management_endpoints/sso/saml_sso.py","lineNumber":390,"sourceCode":"                    detail=\"SAML response references an unknown or already-used login request.\",\n                )\n            if browser_request_id is None or not secrets.compare_digest(browser_request_id, in_response_to):\n                raise HTTPException(\n                    status_code=status.HTTP_401_UNAUTHORIZED,\n                    detail=\"SAML response is not bound to this browser's login request.\",\n                )\n        elif browser_request_id is not None:\n            raise HTTPException(\n                status_code=status.HTTP_401_UNAUTHORIZED,\n                detail=\"SAML response is not bound to this browser's login request.\",\n            )\n        elif not SAMLAuthHandler._bool_env(\"SAML_ALLOW_UNSOLICITED\", False):\n            raise HTTPException(\n                status_code=status.HTTP_401_UNAUTHORIZED,\n                detail=\"Unsolicited (IdP-initiated) SAML responses are disabled.\",\n            )\n        elif cache.redis_cache is None:\n            raise HTTPException(\n                status_code=status.HTTP_401_UNAUTHORIZED,\n                detail=(\n                    \"Unsolicited (IdP-initiated) SAML responses require a shared Redis cache \"\n                    \"so the replay guard is enforced across every worker.\"\n                ),\n            )\n\n        assertion_id: Final = cast(str | None, auth.get_last_assertion_id())  # cast-ok: untyped python3-saml\n        if assertion_id is None:\n            raise HTTPException(\n                status_code=status.HTTP_401_UNAUTHORIZED,\n                detail=\"SAML assertion is missing the required ID attribute.\",\n            )\n        consumed_key: Final = f\"{_SAML_CONSUMED_ASSERTION_CACHE_PREFIX}:{assertion_id}\"\n        consumed_count: Final = await cache.async_increment_cache(\n            key=consumed_key, value=1, ttl=SAMLAuthHandler._replay_guard_ttl(auth)\n        )\n        if consumed_count is not None and consumed_count > 1:","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/sso/saml_sso.py#L372-L408","documentation":"Unsolicited SAML is allowed, but the cache has no Redis backing (cache.redis_cache is None); the assertion-ID replay guard could then only be enforced per-worker, so the handler fails closed with 401 rather than accept a replayable response.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/sso/saml_sso.py:390 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Configure a shared Redis cache for the proxy so the replay guard works across workers."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}