{"record":{"id":"2504be3c2fd57a33","repo":"BerriAI/litellm","slug":"mavvrik-api-endpoint-host-must-be-a-mavvrik-domain","errorCode":null,"errorMessage":"MAVVRIK_API_ENDPOINT host must be a Mavvrik domain (e.g. https://api.mavvrik.dev/<tenant_id>)","messagePattern":"MAVVRIK_API_ENDPOINT host must be a Mavvrik domain \\(e\\.g\\. https://api\\.mavvrik\\.dev/<tenant_id>\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/focus/destinations/mavvrik_destination.py","lineNumber":36,"sourceCode":"    get_async_httpx_client,\n    httpxSpecialProvider,\n)\n\nfrom .base import FocusDestination, FocusTimeWindow\n\n_MAVVRIK_ALLOWED_SUFFIXES: Final = (\".mavvrik.dev\", \".mavvrik.ai\", \".mavvrik.app\")\n\n# GCS requires intermediate chunks to be a multiple of 256 KB.\n# 8 MB gives a good balance between round-trips and memory pressure.\n_GCS_CHUNK_SIZE: Final = 8 * 1024 * 1024  # 8 MB\n\n\ndef _validate_api_endpoint(api_endpoint: str) -> None:\n    if not api_endpoint.startswith(\"https://\"):\n        raise ValueError(\"MAVVRIK_API_ENDPOINT must be an HTTPS URL\")\n    hostname: Final = (urlparse(api_endpoint).hostname or \"\").lower()\n    if not any(hostname.endswith(suffix) for suffix in _MAVVRIK_ALLOWED_SUFFIXES):\n        raise ValueError(\n            \"MAVVRIK_API_ENDPOINT host must be a Mavvrik domain (e.g. https://api.mavvrik.dev/<tenant_id>)\"\n        )\n\n\ndef _validate_gcs_url(url: str, label: str) -> None:\n    parsed: Final = urlparse(url)\n    if parsed.scheme != \"https\":\n        raise ValueError(f\"Mavvrik FOCUS destination: {label} must be HTTPS, got scheme '{parsed.scheme}'\")\n    hostname: Final = (parsed.hostname or \"\").lower()\n    if not (hostname == \"storage.googleapis.com\" or hostname.endswith(\".storage.googleapis.com\")):\n        raise ValueError(\n            f\"Mavvrik FOCUS destination: {label} must be a GCS endpoint (storage.googleapis.com), got '{hostname}'\"\n        )\n\n\nclass FocusMavvrikDestination(FocusDestination):\n    \"\"\"Upload FOCUS CSV exports to Mavvrik via GCS signed URL.\"\"\"\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/focus/destinations/mavvrik_destination.py#L18-L54","documentation":"ValueError raised when the hostname of MAVVRIK_API_ENDPOINT does not end with one of the allowlisted suffixes .mavvrik.dev, .mavvrik.ai, or .mavvrik.app. Because the x-api-key credential is sent to whatever host the endpoint names, this allowlist stops the key from being transmitted to an arbitrary server. Checked after the HTTPS check, still at construction time.","triggerScenarios":"api_endpoint hostnames like 'api.example.com', 'mavvrik.dev' (bare apex: does not end with '.mavvrik.dev'), 'localhost:8080', or any non-Mavvrik domain, passed via config or the MAVVRIK_API_ENDPOINT env var.","commonSituations":"Domain typos (mavvrik.io, mavrik.dev), corporate proxy domains, pointing the destination at a local mock server for integration tests, or internal staging environments not hosted under the allowed suffixes.","solutions":["Use the canonical endpoint https://api.mavvrik.dev/<tenant_id> (or another *.mavvrik.dev/.ai/.app host from your Mavvrik onboarding)","Check for typos and for the missing subdomain (apex 'mavvrik.dev' is rejected)","For local mocks, add a DNS/hosts entry under a .mavvrik.dev subdomain that points at your mock"],"exampleFix":"# before\nMAVVRIK_API_ENDPOINT=https://mavvrik.dev/acme\n\n# after\nMAVVRIK_API_ENDPOINT=https://api.mavvrik.dev/acme","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\n\nhost = (urlparse(os.getenv(\"MAVVRIK_API_ENDPOINT\", \"\")).hostname or \"\").lower()\nif not any(host.endswith(s) for s in (\".mavvrik.dev\", \".mavvrik.ai\", \".mavvrik.app\")):\n    raise SystemExit(f\"MAVVRIK_API_ENDPOINT host must be a Mavvrik domain, got: {host!r}\")","typeGuard":"from urllib.parse import urlparse\n\n_MAVVRIK_SUFFIXES = (\".mavvrik.dev\", \".mavvrik.ai\", \".mavvrik.app\")\n\ndef is_mavvrik_host(url: str) -> bool:\n    \"\"\"True when url is https and its host is on the Mavvrik allowlist.\"\"\"\n    if not url.startswith(\"https://\"):\n        return False\n    host = (urlparse(url).hostname or \"\").lower()\n    return any(host.endswith(s) for s in _MAVVRIK_SUFFIXES)","tryCatchPattern":"try:\n    destination = FocusMavvrikDestination(prefix=\"focus\", config=cfg)\nexcept ValueError as e:\n    raise SystemExit(f\"Mavvrik endpoint rejected: {e}\") from e","preventionTips":["Use the exact onboarding endpoint (https://api.mavvrik.dev/<tenant_id>); the apex 'mavvrik.dev' is rejected","For local mocks, add a hosts-file entry under a .mavvrik.dev subdomain instead of editing the allowlist","Assert the endpoint with a unit test over your deployment config"],"tags":["mavvrik","allowlist","config","validation","ssrf"],"backgroundTag":"url-host-not-allowed","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}