{"record":{"id":"10566a36bc5ac009","repo":"BerriAI/litellm","slug":"mavvrik-focus-destination-label-must-be-https","errorCode":null,"errorMessage":"Mavvrik FOCUS destination: {label} must be HTTPS, got scheme '{parsed.scheme}'","messagePattern":"Mavvrik FOCUS destination: (.+?) must be HTTPS, got scheme '(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/focus/destinations/mavvrik_destination.py","lineNumber":44,"sourceCode":"# 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\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\")","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/focus/destinations/mavvrik_destination.py#L26-L62","documentation":"ValueError from _validate_gcs_url when a URL the destination is about to upload to is not HTTPS: either the signed URL returned by Mavvrik's upload-url endpoint or the resumable-session URI from GCS. It is a runtime guard against a misbehaving or tampered Mavvrik response sending your billing data (CSV) over plaintext, and it fires before any upload bytes are transmitted.","triggerScenarios":"During deliver(): Mavvrik's GET /metrics/agent/ai/{connection_id}/upload-url returns a 'url' field whose scheme is http://, or the GCS resumable-init response's Location header is an http:// URI. Both then raise immediately.","commonSituations":"Mavvrik API contract change, an intermediary proxy or TLS-terminating middlebox rewriting URLs to http, or a stub/mock Mavvrik server in tests returning http URLs.","solutions":["Reproduce manually: curl -s \"$MAVVRIK_API_ENDPOINT/metrics/agent/ai/$MAVVRIK_CONNECTION_ID/upload-url?name=2026-01-01&type=metrics&datetime=2026-01-01\" -H \"x-api-key: $MAVVRIK_API_KEY\" and inspect the returned url scheme","If a proxy rewrites redirects/URLs, configure it to preserve https","If the real Mavvrik API returns http signed URLs, report it to Mavvrik and pin/upgrade litellm once fixed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"from urllib.parse import urlparse\n\ndef is_https_url(url: str) -> bool:\n    \"\"\"True when the Mavvrik-returned URL is safe to upload to.\"\"\"\n    return urlparse(url).scheme == \"https\"","tryCatchPattern":"try:\n    await destination.deliver(content=content, time_window=tw, filename=fn)\nexcept ValueError as e:\n    if \"must be HTTPS\" in str(e):\n        # Response-side integrity failure: log loudly and do not retry unchanged\n        logger.error(\"Mavvrik returned a non-HTTPS upload URL; possible proxy tampering: %s\", e)\n    raise","preventionTips":["Configure egress proxies to preserve https on responses from the Mavvrik API","Monitor for this error specifically — it indicates a tampered or changed upstream response, not a config mistake","Keep litellm updated so allowlist/validation changes track the Mavvrik API"],"tags":["mavvrik","gcs","https","ssrf","runtime-validation"],"backgroundTag":"insecure-url-scheme","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}