]> Cypherpunks repositories - gostls13.git/commit
cmd/go: add GOVCS setting to control version control usage
authorRuss Cox <rsc@golang.org>
Thu, 29 Oct 2020 14:57:38 +0000 (10:57 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 9 Nov 2020 15:46:56 +0000 (15:46 +0000)
commit979e1376096a4c1c7525f33dd4e76414f63c93fb
treef8c69c4c6e1d539abe6c692d540bcf7803c2a8ca
parentcb4df9833474d36c6e4cb005682215047b5f0979
cmd/go: add GOVCS setting to control version control usage

The go command runs commands like git and hg to download modules.
In the past, we have had problems with security bugs in version
control systems becoming security bugs in “go get”.

The original modules draft design removed use of these commands
entirely, saying:

> We want to move away from invoking version control tools such as bzr,
> fossil, git, hg, and svn to download source code. These fragment the
> ecosystem: packages developed using Bazaar or Fossil, for example, are
> effectively unavailable to users who cannot or choose not to install
> these tools. The version control tools have also been a source of
> exciting security problems. It would be good to move them outside the
> security perimeter.

The removal of these commands was not possible in the end: being able
to fetch directly from Git repos is too important, especially for
closed source. But the security exposure has not gone away.
We remain vulnerable to problems in VCS systems, especially the less
scrutinized ones.

This change adds a GOVCS setting to let users control which version
control systems are allowed by default.

It also changes the default allowed version control systems to git and hg
for public code and any version control system for private code
(import path or module path matched by the GOPRIVATE setting).

See the changes in alldocs.go for detailed documentation.
See #41730 for proposal and discussion.

Fixes #41730.

[Replay of CL 266420. See changes from Patch Set 1 for updates to fix
a few long tests.]

Change-Id: I4fe93804548956c42aea985368b4571bdb220f48
Reviewed-on: https://go-review.googlesource.com/c/go/+/267888
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
15 files changed:
src/cmd/go/alldocs.go
src/cmd/go/go_test.go
src/cmd/go/internal/cfg/cfg.go
src/cmd/go/internal/envcmd/env.go
src/cmd/go/internal/help/helpdoc.go
src/cmd/go/internal/modfetch/fetch.go
src/cmd/go/internal/modget/get.go
src/cmd/go/internal/modload/help.go
src/cmd/go/internal/vcs/vcs.go
src/cmd/go/internal/vcs/vcs_test.go
src/cmd/go/main.go
src/cmd/go/script_test.go
src/cmd/go/testdata/script/govcs.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_auth.txt
src/internal/cfg/cfg.go