{"record":{"id":"6b277396d8a53a94","repo":"unslothai/unsloth","slug":"network-paths-are-not-supported-for-native-grants","errorCode":null,"errorMessage":"Network paths are not supported for native grants.","messagePattern":"Network paths are not supported for native grants\\.","errorType":"exception","errorClass":"NativePathLeaseError","httpStatus":400,"severity":"error","filePath":"studio/backend/utils/native_path_leases.py","lineNumber":407,"sourceCode":"        if len(_NATIVE_PATH_LABELS) > _MAX_NATIVE_PATH_LABELS:\n            excess = len(_NATIVE_PATH_LABELS) - _MAX_NATIVE_PATH_LABELS\n            for stale_path in list(_NATIVE_PATH_LABELS.keys())[:excess]:\n                _NATIVE_PATH_LABELS.pop(stale_path, None)\n        if path in _NATIVE_PATH_REDACTIONS:\n            return\n        _NATIVE_PATH_REDACTIONS.append(path)\n        del _NATIVE_PATH_REDACTIONS[:-_MAX_NATIVE_PATH_REDACTIONS]\n\n\ndef _reject_network_or_device_path(path: Path) -> None:\n    text = str(path)\n    if os.name == \"nt\":\n        normalized = text.replace(\"/\", \"\\\\\").lower()\n        if normalized.startswith(\"\\\\\\\\?\\\\\"):\n            rest = normalized[4:]\n            is_local_drive = len(rest) >= 3 and rest[0].isalpha() and rest[1:3] == \":\\\\\"\n            if not is_local_drive:\n                raise NativePathLeaseError(\"Network paths are not supported for native grants.\")\n        elif normalized.startswith(\"\\\\\\\\\"):\n            raise NativePathLeaseError(\"Network paths are not supported for native grants.\")\n    if os.name != \"nt\":\n        for root in (\"/dev\", \"/proc\", \"/sys\"):\n            if path.is_relative_to(root):\n                raise NativePathLeaseError(\"Device and virtual filesystem paths are not supported.\")\n    if \"\\x00\" in text:\n        raise NativePathLeaseError(\"Native path contains invalid characters.\")\n\n\ndef _b64decode(value: str) -> bytes:\n    try:\n        padding = \"=\" * (-len(value) % 4)\n        return base64.urlsafe_b64decode((value + padding).encode(\"ascii\"))\n    except (UnicodeEncodeError, binascii.Error, ValueError) as exc:\n        raise NativePathLeaseError(\"Native path grant has an invalid format.\") from exc\n\n","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/native_path_leases.py#L389-L425","documentation":"On Windows, a path with the \\\\?\\ extended-length prefix was rejected because the drive component after the prefix is not a local drive letter (X:\\). The backend refuses network targets (UNC paths, mapped servers, devices exposed via the extended prefix) because native path grants must reference local volumes the backend can stat and pin by identity. _reject_network_or_device_path() normalizes slashes and lowercases before testing.","triggerScenarios":"verify_native_path_lease() on Windows with a signed canonical_path like \\\\?\\UNC\\server\\share\\file.gguf or \\\\?\\Volume{guid}\\... where the segment after \\\\?\\ is not '<letter>:\\'. Mapped network drives are also caught in prefix form.","commonSituations":"User picks a file on a NAS or network share through the desktop picker; WSL paths surfaced as \\\\?\\UNC\\wsl$\\...; iSCSI/network volumes mounted without a drive letter; long-path tooling that rewrites paths into \\\\?\\ form.","solutions":["Copy the file to a local drive (e.g. C:\\Users\\...\\model.gguf) and select the local copy.","Map the network share to a drive letter and re-select via that letter only if the backend truly can stat it locally (preferred: copy local).","If this is a legitimate product gap, add explicit network-share support to both signer and verifier rather than bypassing the check.","Check the normalized path from the grant payload to confirm which prefix form triggered it."],"exampleFix":"# before\nselected: \\\\?\\UNC\\nas\\models\\model.gguf   -> rejected\n\n# after\ncopy \\\\nas\\models\\model.gguf C:\\models\\model.gguf\nselect C:\\models\\model.gguf            -> accepted","handlingStrategy":"validation","validationCode":"import os\n\ndef is_local_windows_prefixed_path(path: str) -> bool:\n    if os.name != 'nt':\n        return True\n    n = path.replace('/', '\\\\').lower()\n    if n.startswith('\\\\\\\\?\\\\'):\n        rest = n[4:]\n        return len(rest) >= 3 and rest[0].isalpha() and rest[1:3] == ':\\\\'\n    return True","typeGuard":"def is_local_drive_path(path: str) -> bool:\n    n = path.replace('/', '\\\\').lower()\n    if n.startswith('\\\\\\\\?\\\\'):\n        rest = n[4:]\n        return len(rest) >= 3 and rest[0].isalpha() and rest[1:3] == ':\\\\'\n    return not n.startswith('\\\\\\\\') and (len(n) < 2 or n[1] == ':')","tryCatchPattern":"try:\n    grant = verify_native_path_lease(lease, operation='read')\nexcept NativePathLeaseError as exc:\n    if 'Network paths are not supported' in str(exc):\n        return respond(400, 'Copy the file to a local drive and re-select it.')\n    raise","preventionTips":["Filter picker/dialog results to local volumes (C:\\ style) before signing.","Auto-copy network-selected files to a local staging directory and select the copy.","Show a clear UI message when a user picks a UNC/share path."],"tags":["native-path-lease","windows","unc","network-path"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}