aboutsummaryrefslogtreecommitdiff
path: root/src/archive/tar/reader.go
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2022-11-21 11:32:39 -0800
committerDamien Neil <dneil@google.com>2022-11-21 21:14:38 +0000
commit85a2c19b328081c3fbcd1fa3db9a56d708a25c68 (patch)
tree64a79901e3237069743bf38998d2485d2c651803 /src/archive/tar/reader.go
parentf60c77026bb47db984c5da7e6f0590010e7e1a6f (diff)
downloadgo-85a2c19b328081c3fbcd1fa3db9a56d708a25c68.tar.xz
archive/tar, archive/zip: disable insecure file name checks with GODEBUG
Add GODEBUG=tarinsecurepath=1 and GODEBUG=zipinsecurepath=1 settings to disable file name validation. For #55356. Change-Id: Iaacdc629189493e7ea3537a81660215a59dd40a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/452495 Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
Diffstat (limited to 'src/archive/tar/reader.go')
-rw-r--r--src/archive/tar/reader.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/archive/tar/reader.go b/src/archive/tar/reader.go
index 3495f083e3..99ba004c9a 100644
--- a/src/archive/tar/reader.go
+++ b/src/archive/tar/reader.go
@@ -60,7 +60,7 @@ func (tr *Reader) Next() (*Header, error) {
}
hdr, err := tr.next()
tr.err = err
- if err == nil && !filepath.IsLocal(hdr.Name) {
+ if err == nil && tarinsecurepath.Value() != "1" && !filepath.IsLocal(hdr.Name) {
err = ErrInsecurePath
}
return hdr, err