helper: expose extra files to direct
All checks were successful
Test / Create distribution (push) Successful in 42s
Test / Fpkg (push) Successful in 11m23s
Test / Fortify (push) Successful in 5m32s
Test / Data race detector (push) Successful in 2m35s
Test / Flake checks (push) Successful in 56s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-15 02:21:59 +09:00
parent 0f1f0e4364
commit 10a21ce3ef
6 changed files with 40 additions and 40 deletions

View File

@@ -10,6 +10,7 @@ import (
"path/filepath"
"strconv"
"strings"
"syscall"
"git.gensokyo.uk/security/fortify/helper"
"git.gensokyo.uk/security/fortify/helper/bwrap"
@@ -40,13 +41,14 @@ func (p *Proxy) Start(ctx context.Context, output io.Writer, sandbox bool) error
c, cancel := context.WithCancelCause(ctx)
if !sandbox {
h = helper.NewDirect(c, p.name, p.seal, true, argF, func(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
if output != nil {
cmd.Stdout, cmd.Stderr = output, output
}
// xdg-dbus-proxy does not need to inherit the environment
cmd.Env = make([]string, 0)
})
}, nil)
} else {
// look up absolute path if name is just a file name
toolPath := p.name
@@ -117,10 +119,11 @@ func (p *Proxy) Start(ctx context.Context, output io.Writer, sandbox bool) error
}
h = helper.MustNewBwrap(c, toolPath, p.seal, true, argF, func(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
if output != nil {
cmd.Stdout, cmd.Stderr = output, output
}
}, bc, true, nil, nil)
}, nil, bc, nil)
p.bwrap = bc
}