Skip to content

Commit

Permalink
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>
  • Loading branch information
jakecorrenti committed Aug 21, 2023
1 parent ff26e92 commit 408588c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pkg/types/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -189,5 +185,5 @@ 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()...)
return exec.Command(gvproxyPath, c.ToCmdline()...) // #nosec G204
}

0 comments on commit 408588c

Please sign in to comment.