Files
hermes-agent/speech
beardthelion aa31bda533 fix(xai): pin every credential-bearing xAI base URL to the xAI origin
resolve_xai_http_credentials documents that both of its branches honour
HERMES_XAI_BASE_URL / XAI_BASE_URL behind the *.x.ai origin pinning, but
three sources still reached a credential-bearing request unvalidated:

- the no-OAuth fallback branch read XAI_BASE_URL raw (and ignored
  HERMES_XAI_BASE_URL), so XAI_API_KEY followed any host;
- the OAuth branch used the pool row's stored runtime_base_url/base_url
  from auth.json as the validated fallback without validating it;
- xAI STT's direct XAI_API_KEY branch built its base URL from a raw
  XAI_BASE_URL read, and its OAuth arm could fall through to the
  XAI_STT_BASE_URL module constant; TTS kept a raw XAI_BASE_URL tail.

Each now goes through _xai_validate_inference_base_url (HTTPS on x.ai or
*.x.ai, warn and fall back to https://api.x.ai/v1). On-origin overrides
are still honoured, and the explicit per-endpoint API-key overrides
(stt.xai.base_url, XAI_STT_BASE_URL, tts.xai.base_url) are unchanged.

Fixes #129950

Co-authored-by: crazyief <8566250+crazyief@users.noreply.github.com>
2026-12-01 15:25:01 -08:00
..