Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix golangci-lint errors
Browse files Browse the repository at this point in the history
Fixes golangci-lint errors introduced by containers#258

If `gosec` linting is enabled for the return statement in `Cmd`, an
error will be returned: `G204: Subprocess launched with a potential tainted
input or cmd arguments (gosec)`. This error tries to make sure a
user cannot provide a binary that could cause harm to the system.
We can't do much about this since the binary is externally
provided. It is up to the caller to make sure they don't provide a
"dangerous" binary. Therefore, it's ok that we ignore this linting
error.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
jakecorrenti committed Aug 21, 2023
1 parent ff26e92 commit fc1e7fd
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/types/command.go
Original file line number Diff line number Diff line change
@@ -85,11 +85,7 @@ func (c *Command) AddVfkitSocket(socket string) {
}

func (c *Command) addForwardInfo(flag, value string) {
if _, ok := c.forwardInfo[flag]; ok {
c.forwardInfo[flag] = append(c.forwardInfo[flag], value)
} else {
c.forwardInfo[flag] = []string{value}
}
c.forwardInfo[flag] = append(c.forwardInfo[flag], value)
}

func (c *Command) AddForwardSock(socket string) {
@@ -188,6 +184,6 @@ func (c *Command) ToCmdline() []string {

// Cmd converts Command to a commandline format and returns an exec.Cmd which
// can be executed by os/exec
func (c *Command) Cmd(gvproxyPath string) *exec.Cmd {
return exec.Command(gvproxyPath, c.ToCmdline()...)
func (c *Command) Cmd(gvproxyPath string) (*exec.Cmd, error) {
return exec.Command(gvproxyPath, c.ToCmdline()...), nil // #nosec G204
}

0 comments on commit fc1e7fd

Please sign in to comment.