Extensions can reach any network host regardless of accepted egress #241
Notifications
Due Date
No due date set.
Blocks
#1305 Store
sam/archie
Reference: sam/archie#241
Reference in new issue
Block a user
Problem
An extension's package declares egressHosts and the operator accepts them at install, but the running extension has unrestricted network access. Declared environment is enforced; declared egress is not.
Done when
[ ] A running extension can reach only the egress hosts the operator accepted for it.
[ ] A connection to any other host fails, whatever the extension's code does.
[ ] Enforcement does not depend on the package update flow.
Design
Design: extension egress confinement via network namespaces
Decision
Kernel network isolation for every extension process, without Docker. Proxy
environment variables alone cannot satisfy "fails whatever the code does" (a
plugin can dial raw TCP past HTTPS_PROXY); Landlock filters by port, not host,
and seccomp cannot see hostnames, so kernel netns is the cheapest option that
meets the done-when criteria. This is a deliberate mechanism addition (re-exec
wrapper + in-netns relay), re-litigating the choice should start from those
rejected alternatives.
The existing egress stack is reused, not extended into new protocols:
egress.Proxysessions with plain CONNECT host filtering (allow list from theaccepted authority) is sufficient for extensions, because they already receive
their real credentials through their environment. Unlike Kits, no MITM CA and
no SSL_CERT_FILE injection; extensions never trust an archie CA.
Mechanism
extension.Host.Startruns in a fresh user +network namespace (
cmd.SysProcAttr.Cloneflags = CLONE_NEWUSER|CLONE_NEWNETwith uid/gid mappings). No exception for extensions that declare no egress:
an extension with no accepted egress hosts simply gets no relay, so its
netns contains only loopback and it cannot reach anything.
__extension-egress)is the plugin's parent inside the netns. It brings loopback up using
CAP_NET_ADMIN in its own user namespace, starts an in-netns relay on
127.0.0.1:3128, and drops capabilities before exec'ing the plugin, so the
plugin never holds CAP_NET_ADMIN or any other capability.
netns; filesystem-scoped) to the host side, which is the egress.Proxy
session registered with NetworkRules{Allow: AcceptedAuthority.EgressHosts}
— reuse sessions and policy matching unchanged.
CONNECT-only to accepted host:port. No DNS inside the netns: proxy clients
hand hostnames to the proxy.
acceptance-record fail-closed semantics.
Platform gate
Fail-closed means fail-closed: refuse to start ANY extension where network
isolation is not available (non-Linux, unprivileged user namespaces disabled),
not only extensions that declare egress. No unconfined fallback.
Wiring
Specgains an Egress field (session token / unix-socket path) ininternal/infrastructure/extension.AcceptedAuthority:internal/infrastructure/secretengine/runner.goandinternal/app/archied/forge_extensions.go.host.Stop.Work slices
egress: session registration from a plain host allow list; proxy envvariant not bound to the Kit relay alias.
extension(linux build tag): Spec.Egress, wrapper Cmd with clone flags +ExtraFiles, relay loop, capability drop.
__-prefixed, of the existingbinary; no new binary).
through Host.Start in a netns; blocked must fail, allowed must pass. A
missing kernel feature FAILS the test run, never skips — a quietly skipped
security test protects nothing, and the same kernel prerequisite makes the
product refuse to start extensions.
Risks
container seccomp). Unavailability is detected and refused, never weakened.
Close reason
Fixed in b512c5fb.
Imported from beads
archie-core-em7s.10· GitHub #1241 · type bug · priority P0 · created 2026-10-05 · closed 2026-10-05sam wrote (originally 2026-10-05):
Landed. Every extension runs in its own user and network namespace (loopback only) under a launcher re-exec'd from the host binary; its only way out is a local proxy relayed to an allow-list filter on the host that splices CONNECT without touching TLS. Accepted hosts named exactly may be on a private network; loopback is always refused. No Linux namespaces means the extension does not start. The host now verifies the binary's checksum itself and the launcher execs that verified descriptor. TestHostLaunch covers accepted host reachable, other host refused, raw dial bypassing the proxy failing, loopback refused.