Potential fix for code scanning alert no. 38: Bad redirect check
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Yechan Kim committed
Mar 26, 2026 at 00:43 UTC
2822c9c777321ff1a29518a3b28c32cc2b4b7993
1 file changed
+1
-1
cmd/portal-tunnel/http_routes.go
+1
-1
@@ -193,7 +193,7 @@ func (r *httpRoute) rewriteLocation(header http.Header, publicHost, publicScheme
193
}
194
parsed.Scheme = publicScheme
195
parsed.Host = publicHost
196
- case strings.HasPrefix(location, "/") && parsed.Host == "" && (len(location) == 1 || location[1] != '\\'):
196
+ case strings.HasPrefix(location, "/") && parsed.Host == "" && (len(location) == 1 || (location[1] != '\\' && location[1] != '/')):
197
// server-relative redirect
198
default:
199
return