summaryrefslogtreecommitdiffstats
path: root/src/cmd/go/testdata/script/mod_sumdb.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/go/testdata/script/mod_sumdb.txt')
-rw-r--r--src/cmd/go/testdata/script/mod_sumdb.txt39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/mod_sumdb.txt b/src/cmd/go/testdata/script/mod_sumdb.txt
new file mode 100644
index 0000000..9a688e1
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_sumdb.txt
@@ -0,0 +1,39 @@
+env GO111MODULE=on
+env sumdb=$GOSUMDB
+env proxy=$GOPROXY
+env GOPROXY GONOPROXY GOSUMDB GONOSUMDB
+env dbname=localhost.localdev/sumdb
+
+# disagreeing with the sumdb produces security errors
+# (this also populates tiles on the sumdb server).
+cp go.mod.orig go.mod
+env GOSUMDB=$sumdb' '$proxy/sumdb-wrong
+! go get -d rsc.io/quote
+stderr 'go get: rsc.io/quote@v1.5.2: verifying module: checksum mismatch'
+stderr 'downloaded: h1:3fEy'
+stderr 'localhost.localdev/sumdb: h1:wrong'
+stderr 'SECURITY ERROR\nThis download does NOT match the one reported by the checksum server.'
+! go get -d rsc.io/sampler
+! go get -d golang.org/x/text
+
+go mod edit -require rsc.io/quote@v1.5.2
+! go mod tidy
+stderr 'go: rsc.io/quote@v1.5.2: verifying go.mod: checksum mismatch'
+stderr 'SECURITY ERROR\n'
+
+rm go.sum
+
+# switching to truthful sumdb detects timeline inconsistency
+cp go.mod.orig go.mod
+env GOSUMDB=$sumdb
+! go get -d rsc.io/fortune
+stderr 'SECURITY ERROR\ngo.sum database server misbehavior detected!'
+stderr 'proof of misbehavior:'
+
+# removing the cached wrong tree head and cached tiles clears the bad data
+rm $GOPATH/pkg/sumdb/$dbname/latest
+go clean -modcache
+go get -d rsc.io/fortune
+
+-- go.mod.orig --
+module m