Add official setpriv-wrapper.sh
which implements gosu
in pure POSIX shell via setpriv
#165
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
schedule: | |
- cron: 0 0 * * 0 | |
defaults: | |
run: | |
shell: 'bash -Eeuo pipefail -x {0}' | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: hack in qemu-binfmt | |
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends binfmt-support qemu-user-static | |
- run: ./build.sh | |
# explicitly test our (native) amd64/i386 binaries | |
- run: ./test.sh gosu-amd64 | |
- run: ./test.sh gosu-i386 | |
- run: ./test.sh --debian gosu-amd64 | |
- run: ./test.sh --debian gosu-i386 | |
# now that we've successfully tested gosu itself, let's hack the test suite a little bit to not use setuid (and to have util-linux's setpriv installed) so we can also smoke test "setpriv-wrapper.sh" | |
- name: hack tests for setpriv | |
run: | | |
sed -ri -e '/^USER /d' Dockerfile.test-* | |
awk '{ print } toupper($1) == "FROM" { print "RUN apk add --no-cache setpriv" }' Dockerfile.test-alpine > Dockerfile.test-alpine.new | |
mv Dockerfile.test-alpine.new Dockerfile.test-alpine | |
- run: ./test.sh setpriv-wrapper.sh | |
- run: ./test.sh --debian setpriv-wrapper.sh | |
# smoke test our Docker image builds | |
- run: docker build --pull --file hub/Dockerfile.alpine hub | |
- run: docker build --pull --file hub/Dockerfile.debian hub | |
# run "govulncheck" automatically to ensure we don't have any new/unknown vulnerabilities | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.18 | |
# https://github.com/golang/vuln/commits/master | |
# https://github.com/golang/vuln/releases | |
# https://github.com/golang/vuln/tags | |
- run: go install golang.org/x/vuln/cmd/govulncheck@v1.0.4 | |
# (update "go-version" above when updating this version; https://github.com/golang/vuln/blob/v1.0.1/go.mod#L3) | |
- run: for gosu in gosu-*; do ./govulncheck-with-excludes.sh -mode=binary "$gosu"; done |