diff options
author | Bryan C. Mills <bcmills@google.com> | 2021-07-01 12:32:05 -0400 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2021-07-01 17:10:57 +0000 |
commit | 770899f7e11e32ee8500fc033a0aad369a6a5f7b (patch) | |
tree | c7b92014fbe035e7b84f755fb999b88574bfd60f | |
parent | 835d86a17ebf32a3cb081f66119c74363dbd8825 (diff) | |
download | go-770899f7e11e32ee8500fc033a0aad369a6a5f7b.tar.gz go-770899f7e11e32ee8500fc033a0aad369a6a5f7b.zip |
cmd/go: add a regression test for 'go mod vendor' path traversal
For #46867
Change-Id: I1547ebf7b91e9ddd7b67fd2f20e91391d79fa35d
Reviewed-on: https://go-review.googlesource.com/c/go/+/332250
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
-rw-r--r-- | src/cmd/go/testdata/script/mod_vendor_issue46867.txt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/mod_vendor_issue46867.txt b/src/cmd/go/testdata/script/mod_vendor_issue46867.txt new file mode 100644 index 0000000000..38ae87b44a --- /dev/null +++ b/src/cmd/go/testdata/script/mod_vendor_issue46867.txt @@ -0,0 +1,31 @@ +# Regression test for golang.org/issue/46867: +# 'go mod vendor' on Windows attempted to open and copy +# files from directories outside of the module. + +cd subdir +go mod vendor +! exists vendor/example.net/NOTICE +exists vendor/example.net/m/NOTICE + +-- subdir/go.mod -- +module golang.org/issue46867 + +go 1.17 + +replace example.net/m v0.1.0 => ./m + +require example.net/m v0.1.0 +-- subdir/issue.go -- +package issue + +import _ "example.net/m/n" +-- subdir/m/go.mod -- +module example.net/m + +go 1.17 +-- subdir/m/n/n.go -- +package n +-- subdir/m/NOTICE -- +This notice is in module m and SHOULD be vendored. +-- subdir/NOTICE -- +This notice is outside of module m and SHOULD NOT be vendored. |