]> 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>
Thu, 5 Nov 2020 00:21:39 +0000 (00:21 +0000)
commitc018eec1f3ab3af28dae0bdf588e25d5e2ba3418
tree36b675aae18493cfb1ec44f1a620f078cb070b79
parent63fd764502e08d067293a93d6d1a566951255ce5
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.

Change-Id: I1999ddf7445b36a7572965be5897c7a1ff7f4265
Reviewed-on: https://go-review.googlesource.com/c/go/+/266420
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
12 files changed:
src/cmd/go/alldocs.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/testdata/script/govcs.txt [new file with mode: 0644]
src/internal/cfg/cfg.go