mirror of
https://github.com/containers/gvisor-tap-vsock.git
synced 2025-12-24 13:29:22 +08:00
By design, this wrapper is to be invoked with `qemu-wrapper $cmdline`, so the error reported by gosec is intentional. This commit adds the necessary annotation to silence it. cmd/qemu-wrapper/main.go:19:9: G204: Subprocess launched with function call as argument or cmd arguments (gosec) cmd := exec.Command(os.Args[2], os.Args[3:]...) ^
28 lines
464 B
Go
28 lines
464 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net"
|
|
"os"
|
|
"os/exec"
|
|
)
|
|
|
|
func main() {
|
|
conn, err := net.Dial("unix", os.Args[1])
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fd, err := conn.(*net.UnixConn).File()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
cmd := exec.Command(os.Args[2], os.Args[3:]...) // #nosec G204
|
|
cmd.ExtraFiles = append(cmd.ExtraFiles, fd)
|
|
cmd.Stdin = os.Stdin
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
if err := cmd.Run(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|