vendor: update buildkit with typed errors support

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2020-06-24 22:20:05 -07:00
parent 0269388aa7
commit 2d720a1e0b
619 changed files with 38296 additions and 104947 deletions

View File

@ -6,6 +6,7 @@ import (
"runtime"
"sort"
"strings"
"syscall"
"github.com/pkg/errors"
)
@ -31,10 +32,10 @@ func (v *Validator) HandleChange(kind ChangeKind, p string, fi os.FileInfo, err
p = strings.Replace(p, "\\", "", -1)
}
if p != path.Clean(p) {
return errors.Errorf("invalid unclean path %s", p)
return errors.WithStack(&os.PathError{Path: p, Err: syscall.EINVAL, Op: "unclean path"})
}
if path.IsAbs(p) {
return errors.Errorf("abolute path %s not allowed", p)
return errors.WithStack(&os.PathError{Path: p, Err: syscall.EINVAL, Op: "absolute path"})
}
dir := path.Dir(p)
base := path.Base(p)
@ -42,7 +43,7 @@ func (v *Validator) HandleChange(kind ChangeKind, p string, fi os.FileInfo, err
dir = ""
}
if dir == ".." || strings.HasPrefix(p, "../") {
return errors.Errorf("invalid path: %s", p)
return errors.WithStack(&os.PathError{Path: p, Err: syscall.EINVAL, Op: "escape check"})
}
// find a parent dir from saved records