Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: don't follow an infinite number of redirects #39482

Closed
oiooj opened this issue Jun 9, 2020 · 4 comments
Closed

cmd/go: don't follow an infinite number of redirects #39482

oiooj opened this issue Jun 9, 2020 · 4 comments
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done. okay-after-beta1 Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1
Milestone

Comments

@oiooj
Copy link
Member

oiooj commented Jun 9, 2020

What version of Go are you using (go version)?

$ go version
go version go1.14.4 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/data/golang"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build483816322=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go get -d golang.kxv.io/too/many/redirects

golang.kxv.io/too/many/redirects will redirects 15 times now, go cmd will hangs until all redirects finished. It's very dangerous.

What did you expect to see?

success

What did you see instead?

Go cmd hangs

/cc @bcmills @jayconrod @FiloSottile

@oiooj oiooj added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go modules labels Jun 9, 2020
@gopherbot
Copy link

Change https://golang.org/cl/237177 mentions this issue: cmd/go/internal/web: stop after 10 redirects

@jayconrod jayconrod changed the title Go mod cmd should not follow all redirects cmd/go: don't follow an infinite number of redirects Jun 9, 2020
@jayconrod jayconrod added this to the Go1.15 milestone Jun 9, 2020
@jayconrod jayconrod added the okay-after-beta1 Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1 label Jun 9, 2020
@golang golang deleted a comment Jun 10, 2020
@oiooj
Copy link
Member Author

oiooj commented Jun 12, 2020

Should this fix back port to go1.14? @bcmills @ianlancetaylor

@jayconrod
Copy link
Contributor

I'd lean toward not backporting. MinorReleases describes the changes that should be backported: fixes for security issues, serious problems with no workaround, and documentation fixes.

This fix provides a good error message when we send a request to a misconfigured server (as opposed to hanging in a redirect loop). I don't think it's a security issue though.

@bcmills
Copy link
Contributor

bcmills commented Jun 12, 2020

I'm ambivalent on backporting. On the one hand, a hung go command can be very difficult to diagnose. On the other hand, it's easy to terminate such a command to un-stick it.

@golang golang locked and limited conversation to collaborators Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done. okay-after-beta1 Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1
Projects
None yet
Development

No branches or pull requests

4 participants