{"record":{"id":"fb00dd9b64cd1bc4","repo":"jdx/mise","slug":"unsupported-redirect","errorCode":null,"errorMessage":"unsupported redirect","messagePattern":"unsupported redirect","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/github_relay.rs","lineNumber":669,"sourceCode":"        let mut response = req.body(body).send().await?;\n        if broker.audit.options.log_requests {\n            broker.audit.emit(serde_json::json!({\"event\": \"request\", \"operation\": operation, \"status\": response.status().as_u16(), \"headers_ms\": sent_at.elapsed().as_millis()}));\n        }\n        // Only asset redirects are followed. Preserve resume headers, never credentials.\n        for _ in 0..3 {\n            if !response.status().is_redirection() {\n                break;\n            }\n            let location = response\n                .headers()\n                .get(\"location\")\n                .ok_or_else(|| eyre::eyre!(\"missing redirect\"))?\n                .to_str()?;\n            let url = Url::parse(location)?;\n            if target.git\n                || !(asset_redirect(&url) || archive_redirect(&url, target.archive_repo.as_deref()))\n            {\n                bail!(\"unsupported redirect\");\n            }\n            let redirect_host = url.host_str().unwrap_or_default().to_string();\n            let redirected_at = std::time::Instant::now();\n            let mut redirected = broker.client.request(parts.method.clone(), url);\n            for name in [\"range\", \"if-range\"] {\n                if let Some(value) = parts.headers.get(name) {\n                    redirected = redirected.header(name, value);\n                }\n            }\n            response = redirected.send().await?;\n            if broker.audit.options.log_requests {\n                broker.audit.emit(serde_json::json!({\"event\": \"request\", \"operation\": format!(\"{} {redirect_host}/<download>\", parts.method), \"status\": response.status().as_u16(), \"headers_ms\": redirected_at.elapsed().as_millis()}));\n            }\n        }\n        if response.status().is_redirection() {\n            bail!(\"too many redirects\");\n        }\n        let mut builder = Response::builder().status(response.status());","sourceCodeStart":651,"sourceCodeEnd":687,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/github_relay.rs#L651-L687","documentation":"The GitHub relay's `forward` only follows redirects to asset-download or archive endpoints (the `asset_redirect`/`archive_redirect` helpers). When the GitHub API returns a 3xx whose Location is neither (or `target.git` is set), the relay refuses to follow it and bails with \"unsupported redirect\". This is a deliberate security policy: the relay must not be tricked into proxying arbitrary third-party hosts.","triggerScenarios":"A request forwarded through the relay receives a redirect whose Location URL is not an asset or archive redirect; or a redirect Location that fails to parse (handled earlier) or points to a disallowed host/path; or a git-capability target that redirects anywhere at all (target.git short-circuits to bail).","commonSituations":"GitHub changes/changes shape of its release-asset or codeload redirect chain; a redirect to objects.githubusercontent.com variant the allowlist doesn't recognize; requesting a git operation through a relay path that only supports HTTP asset/archive forwarding; a misconfigured proxy or mirrors returning non-standard redirects.","solutions":["Update mise to the latest version so the relay's asset/archive redirect allowlist matches GitHub's current redirect hosts.","Check what the redirect target actually is (curl -sIL <url>) — if it points to an unexpected host, you may be behind a proxy/DNS interception; fix that environment.","If you need git operations, use the git capability path directly instead of routing a git target through the asset relay.","Report the redirect URL/host to mise maintainers if GitHub introduced a new legitimate download host that is being rejected."],"exampleFix":"// before: git targets can never follow redirects, causing the bail\nif target.git || !(asset_redirect(&url) || archive_redirect(&url, target.archive_repo.as_deref())) {\n    bail!(\"unsupported redirect\");\n}\n// after (as a user): don't force git through the asset relay\nlet target = RelayTarget { git: false, ..target }; // or call the git endpoint path","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"match relay_forward(target, parts).await {\n    Err(e) if e.to_string().contains(\"unsupported redirect\") => direct_download(parts).await,\n    other => other,\n}","preventionTips":["Keep mise updated so the redirect allowlist tracks GitHub's current asset/archive hosts","Avoid routing git-capability targets through the asset relay","Inspect unexpected redirect targets with curl -sIL to detect proxy/DNS interception"],"tags":["http","redirect","github","proxy","security"],"backgroundTag":"unsupported-operation","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}