aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper
AgeCommit message (Collapse)Author
2025-02-19helper/bwrap: rename Write to WriteFileOphestra
In case this might want to be an io.Writer. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-16fmsg: implement suspend in writerOphestra
This removes the requirement to call fmsg.Exit on every exit path, and enables direct use of the "log" package. However, fmsg.BeforeExit is still encouraged when possible to catch exit on suspended output. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-16helper/bwrap: expose address of DataConfigOphestra
This allows the caller to defer fulfilling its payload. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-15helper/bwrap: implement file copy flagsOphestra
These are significantly more efficient and less error-prone than mounting an external tmpfile. This should also reduce attack surface as the resulting files are private to its specific sandbox. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-15helper/bwrap: PositionalArg implement fmt.StringerOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-14helper/bwrap: merge Args and FDArgsOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-14helper/bwrap: remove fmsg importOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-13helper: use generic extra files interfaceOphestra
This replaces the pipes object and integrates context into helper process lifecycle. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-13helper/proc: cancel ec on parent ctxOphestra
This allows errors written during a timeout to be received and handled. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-13helper/seccomp: use sync.Once for closeWriteOphestra
This makes the code much cleaner, and eliminates the intermittent ErrInvalid errors. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-13helper/seccomp: benchmark exporterOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-13proc/pipe: implement args and stat fileOphestra
This is a generic implementation of helper/pipe. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-13helper/proc: count dispatched errsOphestra
This helps debug implementation errors of [proc.File]. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-13helper/proc: store file addresses in linked listOphestra
Storing extra files as a slice requires the caller to allocate a large enough slice before initialising any file and never grow the slice. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-13helper/seccomp: eliminate data race on pfdOphestra
Turns out the doc comment on os.File was lying about its methods being safe for concurrent use. The race detector picked up a data race from concurrent use of Fd and Close. This change eliminates that by calling Fd in the prepare routine. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-11helper/proc: declare generic extra files interfaceOphestra
Helpers use extra files for various purposes. This provides a generic interface for implementing the fulfillment of these extra files without having to specifically handle them in the process creation code. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-08helper/proc: move package out of internalOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-07helper/seccomp: panic on invalid closeWrite useOphestra
Returning an error here puts exporter in an invalid state. The caller should guard against this condition instead. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-02-03helper/seccomp: implement reader interface via pipeOphestra
This also does not require the libc tmpfile call. BPF programs emitted by libseccomp seems to be deterministic. The tests would catch regressions as it verifies the program against known good output backed by manual testing. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-25helper/seccomp: do not call F_println if not verboseOphestra
This (slightly) improves performance. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-25helper/seccomp: separate seccomp packageOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-25helper: block more unusual/privileged syscallsOphestra
These are toggled by F_EXT and exposed as SyscallPolicy.Compat in the Go interface. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-22helper/bwrap: integrate seccomp into helper interfaceOphestra
This makes API usage much cleaner, and encapsulates all bwrap arguments in argsWt. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-20helper/bwrap: generic extra file interfaceOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-19helper/bwrap: move sync to helper stateOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-18helper/bwrap: append --sync-fd before --Ophestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-15helper/bwrap: separate sequential/static argsOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-14helper/bwrap: register OverlayConfig with gobOphestra
This is required for copying bwrap configurations across processes. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-05helper/bwrap: implement overlayfs builderOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-05helper/bwrap: move test out of bwrap packageOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-05helper/bwrap: add json struct tag to filesystemOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2024-12-27helper/bwrap: fix typo in --dir config builderOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2024-12-20migrate to git.gensokyo.uk/security/fortifyOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-12-06proc: cleaner extra filesOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-12-06helper/bwrap: implement sync fdOphestra Umiker
This is required by wayland security-context-v1. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-28add package doc commentsOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-26fmsg: support temporarily withholding outputOphestra Umiker
Trying to print to a shared stdout is a terrible idea. This change makes it possible to withhold output for the lifetime of the sandbox. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-25helper/bwrap: register generic PermConfig types with gobOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-20migrate to git.ophivana.moe/security/fortifyOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-15helper/bwrap: add fortify permissive default test caseOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-15helper/bwrap: sort SetEnv argumentsOphestra Umiker
This guarantees consistency of resulting args. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-15helper/bwrap: ordered filesystem argsOphestra Umiker
The argument builder was written based on the incorrect assumption that bwrap arguments are unordered. The argument builder is replaced in this commit to correct that mistake. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-14helper/bwrap: format mode in octalOphestra Umiker
Bubblewrap expects an octal representation of mode. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-13helper/bwrap: allow pushing generic arguments to the end of argument streamOphestra Umiker
Bwrap argument order determines the order their corresponding actions are performed. This allows generic arguments like tmpfs to the end of the stream to override bind mounts. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-12helper: remove unused bwrap config fieldOphestra Umiker
This configuration is not saved anywhere, and does not need to be saved. Bwrap configuration information is already saved into p. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-11helper/bwrap: move interfaceArgs before stringArgsOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-11helper/bwrap: proc, dev and mqueue as string argumentsOphestra Umiker
These flags do not support --chmod. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-09helper/bwrap: pass --unshare-user when unshare everythingOphestra Umiker
Bubblewrap apparently requires --unshare-user even when --unshare-all is set to apply --disable-userns. This behaviour is not clearly documented. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-09helper/bwrap: check args only for internal testsOphestra Umiker
Tests internal to the helper package sets crash-test-dummy as the command whenever a launch is expected to go through, and the hardcoded args are only valid for internal tests, so this characteristic is used here to exclude external tests that pass real program names and custom bwrap configurations. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-10-08helper: implementation of helper.Helper using bwrapOphestra Umiker
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>