Skip to content

fix(slm-sso): SSO login passes a stand-in user without is_platform_admin to create_token_response, which raises #18322

Open

Description

@mrveiss

Summary

All three SLM SSO completion paths in autobot-slm-backend/api/sso_auth.py build a stand-in user with type("User", (), {"username": ..., "is_admin": ...})() and pass it to auth_service.create_token_response. That function reads user.is_platform_admin (role_for_user(user.is_platform_admin)). The stand-in has no such attribute, so the call raises AttributeError. None of the surrounding except clauses catch it (SSOAuthenticationError, SSOProviderNotFoundError), so an SSO login cannot complete.

Found by code reading while enumerating role-claim producers for #18263. It has not been reproduced against a running SLM.

Acceptance criteria

  • The SSO paths pass the real User (or an object carrying username and is_platform_admin) to create_token_response. The issued token carries role = admin or user.
  • Test: each SSO completion path issues a token whose role claim matches the user's platform-admin flag.

Refs #18263

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions