{"record":{"id":"7044f8828ab3c70b","repo":"github/copilot-sdk","slug":"unsafe-runtime-package-path-member-name","errorCode":null,"errorMessage":"Unsafe runtime package path: {member_name}","messagePattern":"Unsafe runtime package path: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/copilot/_cli_download.py","lineNumber":276,"sourceCode":"    \"foundry-local-sdk\",\n    \"index.js\",\n    \"LICENSE.md\",\n    \"napi-oop-runtime\",\n    \"npm-loader.js\",\n    \"package.json\",\n    \"preloads\",\n    \"pvrecorder\",\n    \"queries\",\n    \"README.md\",\n    \"sdk\",\n    \"sea-loader.js\",\n    \"webview\",\n}\n\n\ndef _hostless_runtime_path(member_name: str, runtime_platform: str) -> Path | None:\n    if \"\\\\\" in member_name:\n        raise RuntimeError(f\"Unsafe runtime package path: {member_name}\")\n    parts = PurePosixPath(member_name).parts\n    if not parts or parts[0] != \"package\" or len(parts) < 2:\n        return None\n    relative = parts[1:]\n    top_level = relative[0]\n    file_name = relative[-1]\n    if (\n        top_level in _HOSTLESS_EXCLUDED_TOP_LEVEL\n        or (top_level.startswith(\"tree-sitter\") and top_level.endswith(\".wasm\"))\n        or (top_level.startswith(\"voice-\") and top_level.endswith(\".js\"))\n        or file_name == \"cli-native.node\"\n        or \"mediaremote-adapter\" in relative\n        or file_name.startswith(\"copilot-runtime-bin\")\n    ):\n        return None\n    if top_level == \"prebuilds\":\n        if len(relative) < 3 or relative[1] != runtime_platform:\n            return None","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/_cli_download.py#L258-L294","documentation":"_hostless_runtime_path maps tar members of the runtime package to safe destination paths. This error is raised immediately when a member name contains a backslash, since backslashes are not valid POSIX separators and could be used to smuggle unsafe paths on Windows.","triggerScenarios":"Extracting a runtime release package whose tarball contains a member name with a '\\' character (via _materialize_runtime_bundle), e.g. a maliciously crafted or incorrectly built archive.","commonSituations":"Man-in-the-middle or tampered release packages; a release built on Windows where paths used backslashes; corrupted downloads (mitigated elsewhere by checksum verification).","solutions":["Re-download the package — checksum verification should catch tampering or corruption.","Verify the release's integrity/attestations if this recurs on an official version.","Report the release as malformed if it comes from the official publisher.","Check for a proxy or mirror injecting/replacing the tarball."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import tarfile\nwith tarfile.open(\"pkg.tgz\") as t:\n    bad = [m.name for m in t.getmembers() if \"\\\\\" in m.name]\n    if bad:\n        raise SystemExit(f\"rejecting archive with backslash paths: {bad}\")","typeGuard":null,"tryCatchPattern":"try:\n    ensure_runtime_wrapper()\nexcept RuntimeError as e:\n    if \"Unsafe runtime package path\" in str(e):\n        quarantine_download_and_alert()  # treat as tampered package\n    else:\n        raise","preventionTips":["Only download checksum-verified packages from the official source.","Never disable checksum verification.","Treat this error as a security signal, not a retry case."],"tags":["security","path-traversal","archive-extraction"],"backgroundTag":"path-traversal-blocked","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}