helper: remove bubblewrap wrapper
All checks were successful
Test / Create distribution (push) Successful in 19s
Test / Fortify (push) Successful in 2m12s
Test / Fpkg (push) Successful in 3m34s
Test / Data race detector (push) Successful in 4m19s
Test / Flake checks (push) Successful in 57s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-25 05:35:02 +09:00
parent 61dbfeffe7
commit b39f3aeb59
13 changed files with 1 additions and 1543 deletions

View File

@@ -6,11 +6,7 @@ import (
"io"
"os"
"strconv"
"strings"
"syscall"
"git.gensokyo.uk/security/fortify/helper/bwrap"
"git.gensokyo.uk/security/fortify/helper/proc"
)
// InternalHelperStub is an internal function but exported because it is cross-package;
@@ -29,11 +25,7 @@ func InternalHelperStub() {
sp = v
}
if len(os.Args) > 3 && os.Args[3] == "bwrap" {
bwrapStub()
} else {
genericStub(flagRestoreFiles(3, ap, sp))
}
genericStub(flagRestoreFiles(3, ap, sp))
os.Exit(0)
}
@@ -112,43 +104,3 @@ func genericStub(argsFile, statFile *os.File) {
<-done
}
}
func bwrapStub() {
// the bwrap launcher does not launch with a typical sync fd
argsFile, _ := flagRestoreFiles(4, "1", "0")
// test args pipe behaviour
func() {
got, want := new(strings.Builder), new(strings.Builder)
if _, err := io.Copy(got, argsFile); err != nil {
panic("cannot read bwrap args: " + err.Error())
}
// hardcoded bwrap configuration used by test
sc := &bwrap.Config{
Net: true,
Hostname: "localhost",
Chdir: "/proc/nonexistent",
Clearenv: true,
NewSession: true,
DieWithParent: true,
AsInit: true,
}
if _, err := MustNewCheckedArgs(sc.Args(nil, new(proc.ExtraFilesPre), new([]proc.File))).
WriteTo(want); err != nil {
panic("cannot read want: " + err.Error())
}
if got.String() != want.String() {
panic("bad bwrap args\ngot: " + got.String() + "\nwant: " + want.String())
}
}()
if err := syscall.Exec(
flag.CommandLine.Args()[0],
flag.CommandLine.Args(),
os.Environ()); err != nil {
panic("cannot start helper stub: " + err.Error())
}
}