Skip to content

Commit

Permalink
archive/tar, archive/zip: revert documentation of ErrInsecurePath
Browse files Browse the repository at this point in the history
CL 452616 disables path security checks by default, enabling them
only when GODEBUG=tarinsecurepath=0 or GODEBUG=zipinsecurepath=0
is set. Remove now-obsolete documenation of the path checks.

For #55356

Change-Id: I4ae57534efe9e27368d5e67773a502dd0e56eff4
Reviewed-on: https://go-review.googlesource.com/c/go/+/458875
Reviewed-by: Russ Cox <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Damien Neil <[email protected]>
  • Loading branch information
neild committed Dec 21, 2022
1 parent 458241f commit 2321abc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
9 changes: 0 additions & 9 deletions src/archive/tar/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ func NewReader(r io.Reader) *Reader {
// Any remaining data in the current file is automatically discarded.
//
// io.EOF is returned at the end of the input.
//
// ErrInsecurePath and a valid *Header are returned if the next file's name is:
//
// - absolute;
// - a relative path escaping the current directory, such as "../a"; or
// - on Windows, a reserved file name such as "NUL".
//
// The caller may ignore the ErrInsecurePath error,
// but is then responsible for sanitizing paths as appropriate.
func (tr *Reader) Next() (*Header, error) {
if tr.err != nil {
return nil, tr.err
Expand Down
11 changes: 0 additions & 11 deletions src/archive/zip/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,6 @@ func OpenReader(name string) (*ReadCloser, error) {

// NewReader returns a new Reader reading from r, which is assumed to
// have the given size in bytes.
//
// ErrInsecurePath and a valid *Reader are returned if the names of any
// files in the archive:
//
// - are absolute;
// - are a relative path escaping the current directory, such as "../a";
// - contain a backslash (\) character; or
// - on Windows, are a reserved file name such as "NUL".
//
// The caller may ignore the ErrInsecurePath error,
// but is then responsible for sanitizing paths as appropriate.
func NewReader(r io.ReaderAt, size int64) (*Reader, error) {
if size < 0 {
return nil, errors.New("zip: size cannot be negative")
Expand Down

0 comments on commit 2321abc

Please sign in to comment.