How to Install and Uninstall golang-github-cli-safeexec-dev Package on Ubuntu 21.10 (Impish Indri)

Last updated: May 19,2024

1. Install "golang-github-cli-safeexec-dev" package

Please follow the instructions below to install golang-github-cli-safeexec-dev on Ubuntu 21.10 (Impish Indri)

$ sudo apt update $ sudo apt install golang-github-cli-safeexec-dev

2. Uninstall "golang-github-cli-safeexec-dev" package

Please follow the guidelines below to uninstall golang-github-cli-safeexec-dev on Ubuntu 21.10 (Impish Indri):

$ sudo apt remove golang-github-cli-safeexec-dev $ sudo apt autoclean && sudo apt autoremove

3. Information about the golang-github-cli-safeexec-dev package on Ubuntu 21.10 (Impish Indri)

Package: golang-github-cli-safeexec-dev
Architecture: all
Version: 1.0.0-2
Priority: optional
Section: universe/golang
Source: golang-github-cli-safeexec
Origin: Ubuntu
Maintainer: Ubuntu Developers
Original-Maintainer: Debian Go Packaging Team
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 31
Filename: pool/universe/g/golang-github-cli-safeexec/golang-github-cli-safeexec-dev_1.0.0-2_all.deb
Size: 5276
MD5sum: b731089d0a9efcb1e46110c9105cd9d0
SHA1: 9c171881af1691734183996954d389ca7646eba0
SHA256: 4d49272d7395603bd35397d39b15dda6e0ce9416dc1e40cac487ca5e97a07f1b
SHA512: 87e47c8e93a5601897f37eace92291bdb06edce74160653ce048cc22b1dda7e2be5dee63075100bbe097a72b85eda10ab4ab27183bf3572401d48294df1d8967
Homepage: https://github.com/cli/safeexec
Description-en: safer version of exec.LookPath on Windows
safeexec is a Go module that provides a safer alternative to exec.LookPath()
on Windows.
.
The following, relatively common approach to running external commands
has a subtle vulnerability on Windows:
.
import "os/exec"
.
func gitStatus() error {
// On Windows, this will result in .\git.exe or .\git.bat being executed
// if either were found in the current working directory.
cmd := exec.Command("git", "status") return cmd.Run()
}
.
Searching the current directory (surprising behavior) before searching
folders listed in the PATH environment variable (expected behavior)
seems to be intended in Go and unlikely to be changed:
https://github.com/golang/go/issues/38736
.
Since Go does not provide a version of exec.LookPath() that only searches
PATH and does not search the current working directory, this module provides
a LookPath function that works consistently across platforms.
.
Example use:
.
import (
"os/exec" "github.com/cli/safeexec"
)
.
func gitStatus() error {
gitBin, err := safeexec.LookPath("git")
if err != nil {
return err
}
cmd := exec.Command(gitBin, "status")
return cmd.Run()
}
Description-md5: c843f909ece89cbb9348e9b307e6faa1