Skip to content

bug(slm-llm): the provider Test button cannot test a saved cloud provider, and the naive fix would exfiltrate its key #17845

Description

@mrveiss

Problem

The SLM admin LLM settings page's Test button cannot test a saved cloud provider.

autobot-slm-frontend/src/views/settings/admin/LLMSettings.vue testProvider() sends provider.api_key from browser state to POST /settings/admin/llm/test, and autobot-slm-backend/api/llm_config.py test_llm_connection uses request.api_key verbatim as the Bearer token.

Why the obvious fix is wrong

"When api_key is empty, resolve the stored key by provider name" would send a stored secret to a client-supplied endpoint, behind ADMIN_CONFIG_READ (not WRITE). Anyone with read access could point the endpoint at a host they control and receive any provider's key as a Bearer header.

Fix

Testing a saved provider resolves the stored key server-side and uses the stored endpoint, ignoring any client-supplied endpoint for that case. A client-supplied key, used only with the client-supplied endpoint, remains the path for testing an unsaved provider.

Acceptance criteria

  • Testing a saved provider with no key in the request authenticates with the stored key against the stored endpoint
  • A request naming a saved provider with a different endpoint and no key never sends the stored key (test asserts the outbound request carries no Authorization header, or is refused)
  • Testing an unsaved provider with a supplied key still works
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