{"record":{"id":"72a10bd1392bd14a","repo":"BerriAI/litellm","slug":"mavvrik-focus-destination-label-must-be-a-gcs-e","errorCode":null,"errorMessage":"Mavvrik FOCUS destination: {label} must be a GCS endpoint (storage.googleapis.com), got '{hostname}'","messagePattern":"Mavvrik FOCUS destination: (.+?) must be a GCS endpoint \\(storage\\.googleapis\\.com\\), got '(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/focus/destinations/mavvrik_destination.py","lineNumber":47,"sourceCode":"\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\n    def __init__(\n        self,\n        *,\n        prefix: str,\n        config: dict[str, Any] | None = None,\n    ) -> None:\n        config = config or {}\n        api_key: Final = config.get(\"api_key\")\n        api_endpoint: Final = config.get(\"api_endpoint\")\n        connection_id: Final = config.get(\"connection_id\")\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/focus/destinations/mavvrik_destination.py#L29-L65","documentation":"ValueError from _validate_gcs_url when the hostname of the Mavvrik-provided signed URL or the GCS resumable-session URI is not storage.googleapis.com (or a *.storage.googleapis.com subdomain). This is an SSRF/exfiltration guard: upload traffic containing your FOCUS cost data may only be sent to genuine GCS endpoints. Fires at runtime, before any upload.","triggerScenarios":"During deliver(): the upload-url endpoint returns a url pointing at another host (e.g. an S3 endpoint or internal domain), or the resumable-init Location header names an unexpected host — the destination raises instead of PUTting data there.","commonSituations":"Mavvrik changing its storage provider or API shape, a tampered/hijacked response, new regional GCS hostnames not covered by the allowlist, or a mock server returning non-GCS URLs.","solutions":["Verify with curl what host the upload-url endpoint actually returns; if it is no longer storage.googleapis.com, Mavvrik changed their contract — upgrade litellm for a matching allowlist update","Check whether a corporate proxy or DNS interception is altering the response","If you operate the Mavvrik side, ensure upload URLs are issued for storage.googleapis.com"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"from urllib.parse import urlparse\n\ndef is_gcs_upload_url(url: str) -> bool:\n    \"\"\"True when url targets storage.googleapis.com over https.\"\"\"\n    p = urlparse(url)\n    host = (p.hostname or \"\").lower()\n    return p.scheme == \"https\" and (host == \"storage.googleapis.com\" or host.endswith(\".storage.googleapis.com\"))","tryCatchPattern":"try:\n    await destination.deliver(content=content, time_window=tw, filename=fn)\nexcept ValueError as e:\n    if \"must be a GCS endpoint\" in str(e):\n        logger.error(\"Mavvrik returned a non-GCS upload URL; verify proxy integrity and Mavvrik API version: %s\", e)\n        raise\n    raise","preventionTips":["Do not bypass or monkeypatch _validate_gcs_url — it prevents billing-data exfiltration","Verify Mavvrik API compatibility when upgrading either side","Investigate any occurrence: it means the upstream response named an unexpected host"],"tags":["mavvrik","gcs","allowlist","ssrf","hostname-validation"],"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"}