Skip to content

Commit 4cf0498

Browse files
committed
remove uses of golang.org/x/sys/execabs
the "golang.org/x/sys/execabs" package was introduced to address a security issue on Windows, and changing the default behavior of os/exec was considered a breaking change. go1.19 applied the behavior that was previously implemented in the execabs package; from the release notes: https://go.dev/doc/go1.19#os-exec-path > Command and LookPath no longer allow results from a PATH search to be found > relative to the current directory. This removes a common source of security > problems but may also break existing programs that depend on using, say, > exec.Command("prog") to run a binary named prog (or, on Windows, prog.exe) > in the current directory. See the os/exec package documentation for information > about how best to update such programs. > > On Windows, Command and LookPath now respect the NoDefaultCurrentDirectoryInExePath > environment variable, making it possible to disable the default implicit search > of “.” in PATH lookups on Windows systems. With those changes, we no longer need to use the execabs package, and we can switch back to os/exec. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 5be2139 commit 4cf0498

5 files changed

Lines changed: 5 additions & 9 deletions

File tree

cli-plugins/manager/candidate.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package manager
22

3-
import (
4-
exec "golang.org/x/sys/execabs"
5-
)
3+
import "os/exec"
64

75
// Candidate represents a possible plugin candidate, for mocking purposes
86
type Candidate interface {

cli-plugins/manager/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package manager
33
import (
44
"context"
55
"os"
6+
"os/exec"
67
"path/filepath"
78
"sort"
89
"strings"
@@ -13,7 +14,6 @@ import (
1314
"github.com/fvbommel/sortorder"
1415
"github.com/spf13/cobra"
1516
"golang.org/x/sync/errgroup"
16-
exec "golang.org/x/sys/execabs"
1717
)
1818

1919
// ReexecEnvvar is the name of an ennvar which is set to the command

cli/command/image/build/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"io"
99
"net/http"
1010
"os"
11+
"os/exec"
1112
"path/filepath"
1213
"runtime"
1314
"strings"
@@ -22,7 +23,6 @@ import (
2223
"github.com/docker/docker/pkg/stringid"
2324
"github.com/moby/patternmatcher"
2425
"github.com/pkg/errors"
25-
exec "golang.org/x/sys/execabs"
2626
)
2727

2828
const (

cli/config/credentials/default_store.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package credentials
22

3-
import (
4-
exec "golang.org/x/sys/execabs"
5-
)
3+
import "os/exec"
64

75
// DetectDefaultStore return the default credentials store for the platform if
86
// no user-defined store is passed, and the store executable is available.

cli/connhelper/commandconn/commandconn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"io"
2121
"net"
2222
"os"
23+
"os/exec"
2324
"runtime"
2425
"strings"
2526
"sync"
@@ -28,7 +29,6 @@ import (
2829

2930
"github.com/pkg/errors"
3031
"github.com/sirupsen/logrus"
31-
exec "golang.org/x/sys/execabs"
3232
)
3333

3434
// New returns net.Conn

0 commit comments

Comments
 (0)