summaryrefslogtreecommitdiff
path: root/internal/namespace/namespace_test.go
diff options
context:
space:
mode:
authorJames O'Doherty <james@theodohertyfamily.com>2026-05-29 21:07:46 -0400
committerJames O'Doherty <james@theodohertyfamily.com>2026-05-29 21:07:46 -0400
commitd2173cdbc03884ecd9534e9369f8ebe1634f7e9c (patch)
treeeb2dd8e2a47adbb9e6396f16e2cc94be5be074bd /internal/namespace/namespace_test.go
parentb7745456d67f48f56ba94e47946e40805b6ef1ee (diff)
feat: harden bootstrap and optimize network data path
- Security: Eliminate namespace escape risk by removing `HostBind` and enforcing `FDBind` using pre-opened host socket FDs. - Security: Replace unsafe `atoi` with `strtol` and strict validation in the C launcher to prevent malformed PID joins. - Stability: Fix PID wraparound by storing session timestamps in PID files to detect recycled PIDs. - Stability: Resolve DNS mount leaks by implementing proper unmounting of `/etc/resolv.conf` during tunnel shutdown. - Performance: Optimize `FDBind` throughput by implementing batch packet processing in the receive loop. - Deployment: Implement `memfd_create` for the C launcher to support `noexec` temporary directories and reduce disk I/O. - Maintenance: Replace external `ip` CLI dependency with native `netlink` library for robust network configuration. - Quality: Fix all `golangci-lint` errors and replace remaining panics with explicit error handling.
Diffstat (limited to 'internal/namespace/namespace_test.go')
-rw-r--r--internal/namespace/namespace_test.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/internal/namespace/namespace_test.go b/internal/namespace/namespace_test.go
index 54e3c93..5a3fe42 100644
--- a/internal/namespace/namespace_test.go
+++ b/internal/namespace/namespace_test.go
@@ -6,8 +6,19 @@ import (
"testing"
)
-// We move the complex isolation testing to tests/e2e to avoid
-// issues with Go's temporary test binaries and process replacement.
+// TestNamespacePackage is kept for backward compatibility.
func TestNamespacePackage(t *testing.T) {
t.Skip("Namespace isolation tests moved to tests/e2e")
}
+
+// TestBootstrapJoinInvalidPid verifies that BootstrapJoin fails when
+// it attempts to exec a launcher that will eventually fail to join a PID.
+func TestBootstrapJoinInvalidPid(t *testing.T) {
+ // Since BootstrapJoin calls syscall.Exec, the test process is REPLACED.
+ // We cannot test the return value of BootstrapJoin because it only returns
+ // if Exec fails. If Exec succeeds, the launcher starts, and the launcher
+ // is what fails to join the PID.
+
+ // To test this, we must run the binary and check the exit code.
+ t.Skip("BootstrapJoin uses syscall.Exec; must be tested via E2E binary execution")
+}