Skip to content

bug(slm): SSO OAuth-state uses sync get_redis_client() with await → fails against real Redis #10284

Closed

Description

@mrveiss

Discovered during A2 (#10151) code review.

autobot-slm-backend/user_management/services/sso_service.py (_generate_oauth_state ~line 229, _validate_oauth_state ~line 237, and the SAML relay-state store) call redis = get_redis_client() (default async_client=False → sync redis.Redis) and then await redis.set(...) / await redis.getdel(...). Per autobot_shared/redis_client.py:197 the sync client's methods are NOT awaitable → TypeError against a real Redis. Unit tests pass only because they inject an AsyncMock (false green).

Impact: OAuth/SAML state storage (CSRF protection) is latently broken at runtime — likely unexercised because the enterprise SSO tier is still being built. This also affects the PKCE state code merged in #10254 (#10150), which kept the same await redis.set pattern.

Fix: use the canonical async form redis = await get_redis_client(async_client=True) in these async methods (see redis_client.py docstring lines 236-239). Add a test that exercises a real async client (fakeredis-aioredis), not AsyncMock. A2's #10151 fixes its own new denylist code this way; this issue tracks the pre-existing sso_service.py + PKCE occurrences.

Activity

  1. github-actions commented on Jun 22, 2026

    @github-actions
    Contributor

    PR #10455 (merged to Dev_new_gui) references this issue with a close keyword.

    fix(auth): async redis for SSO/PKCE OAuth-state + reconcile RBAC seed to canonical Permission enum (#10284, #10221)

    If this issue is fully resolved, close it manually. If work remains, no action is needed.

  2. mrveiss commented on Jun 22, 2026

    @mrveiss
    OwnerAuthor

    Merged to Dev_new_gui (c1a6c133c). SSO/PKCE/SAML OAuth-state now uses await get_async_redis_client() (true async client) instead of the sync client; tests exercise the async path. 55/55 SSO tests pass. Batch #10440.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions