diff --git a/doc/go1.20.html b/doc/go1.20.html index 3d49dd2442..c61d308088 100644 --- a/doc/go1.20.html +++ b/doc/go1.20.html @@ -372,18 +372,14 @@ proxyHandler := &httputil.ReverseProxy{
- (*Reader).Next will now return the error ErrInsecurePath
- when opening an archive which contains file names that are absolute,
- refer to a location outside the current directory, contain invalid
- characters, or (on Windows) are reserved names such as NUL.
-
- Programs that want to operate on archives containing insecure file names may - ignore this error. -
-
- Insecure tar file name checks may be entirely disabled by setting the
- GODEBUG=tarinsecurepath=1 environment variable.
+ When the GODEBUG=tarinsecurepath=0 environment variable
+ is set, (*Reader).Next will return the error
+ ErrInsecurePath when opening an archive which contains
+ file names that are absolute, refer to a location outside the current
+ directory, contain invalid characters, or (on Windows) are reserved
+ names such as NUL. Programs that perform their own
+ name sanitization can ignore this error. This behavior will be made
+ the default in a future version of Go.
- NewReader will now return the error ErrInsecurePath
- when opening an archive which contains file names that are absolute,
- refer to a location outside the current directory, contain invalid
- characters, or (on Windows) are reserved names such as NUL.
-
- Programs that want to operate on archives containing insecure file names may - ignore this error. -
-
- Insecure zip file name checks may be entirely disabled by setting the
- GODEBUG=zipinsecurepath=1 environment variable.
+ When the GODEBUG=zipinsecurepath=0 environment variable
+ is set, NewReader will return the error
+ ErrInsecurePath when opening an archive which contains
+ file names that are absolute, refer to a location outside the current
+ irectory, contain invalid characters, or (on Windows) are reserved
+ names such as NUL. Programs that perform their own
+ name sanitization can ignore this error. This behavior will be made
+ the default in a future version of Go.
Reading from a directory file that contains file data will now return an error. diff --git a/src/archive/tar/reader.go b/src/archive/tar/reader.go index 99ba004c9a..a4e35bddb2 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 && tarinsecurepath.Value() != "1" && !filepath.IsLocal(hdr.Name) { + if err == nil && tarinsecurepath.Value() == "0" && !filepath.IsLocal(hdr.Name) { err = ErrInsecurePath } return hdr, err diff --git a/src/archive/zip/reader.go b/src/archive/zip/reader.go index a097d084c6..aa741028cc 100644 --- a/src/archive/zip/reader.go +++ b/src/archive/zip/reader.go @@ -111,7 +111,7 @@ func NewReader(r io.ReaderAt, size int64) (*Reader, error) { // Zip permits an empty file name field. continue } - if zipinsecurepath.Value() == "1" { + if zipinsecurepath.Value() != "0" { continue } // The zip specification states that names must use forward slashes,