mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-20 16:35:12 +00:00
Bump filepath-securejoin to 0.3.5
This release fixes a race in MkdirAll; the latter isn't currently used in k/k, but it seems safer to upgrade to avoid issues if it starts being used. The latest version is 0.3.6 but that only reduces the Go requirements, which isn't relevant for k/k and adds a couple hundred lines of code. Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
7
vendor/github.com/cyphar/filepath-securejoin/mkdir_linux.go
generated
vendored
7
vendor/github.com/cyphar/filepath-securejoin/mkdir_linux.go
generated
vendored
@@ -119,7 +119,12 @@ func MkdirAllHandle(root *os.File, unsafePath string, mode int) (_ *os.File, Err
|
||||
// NOTE: mkdir(2) will not follow trailing symlinks, so we can safely
|
||||
// create the final component without worrying about symlink-exchange
|
||||
// attacks.
|
||||
if err := unix.Mkdirat(int(currentDir.Fd()), part, uint32(mode)); err != nil {
|
||||
//
|
||||
// If we get -EEXIST, it's possible that another program created the
|
||||
// directory at the same time as us. In that case, just continue on as
|
||||
// if we created it (if the created inode is not a directory, the
|
||||
// following open call will fail).
|
||||
if err := unix.Mkdirat(int(currentDir.Fd()), part, uint32(mode)); err != nil && !errors.Is(err, unix.EEXIST) {
|
||||
err = &os.PathError{Op: "mkdirat", Path: currentDir.Name() + "/" + part, Err: err}
|
||||
// Make the error a bit nicer if the directory is dead.
|
||||
if err2 := isDeadInode(currentDir); err2 != nil {
|
||||
|
||||
Reference in New Issue
Block a user