Repository navigation
✨ feat(v1.5): namespace-sharing gate — close cross-owner container:<ref> hole - #130
Conversation
…pace sharing - allow_host_network/pid/ipc/userns only ever matched HostConfig's literal "host" value on NetworkMode/PidMode/IpcMode/UsernsMode; a container:<ref> value (join another container's namespace) always passed through unchecked, and still does by default. - New request_body.container_create.restrict_namespace_sharing (+ allowed_namespace_sharing_containers allowlist) denies container:<ref> joins across NetworkMode/PidMode/IpcMode/UsernsMode unless the target is allowlisted; empty allowlist denies all. - New deny_namespace_path_mode denies NetworkMode=ns:<path>, Docker's raw host-namespace-file attachment form, which also bypasses the "host"-literal check. - Both knobs default off/empty: zero behavior change unless enabled.
container:<ref> HostConfig.NetworkMode/PidMode/IpcMode/UsernsMode targets were invisible to owner-label isolation: allow_host_network/pid/ipc/userns only ever matched the literal "host" value, so joining another owner's container namespace (shared sockets, process visibility, shared /dev/shm) went unchecked wherever ownership.owner was already configured. POST /containers/create now resolves every container:<ref> target in-band with the existing owner-label injection pass and denies the request if that container belongs to a different owner. Same-owner and unlabeled-target refs are unaffected. This is a deliberate default-behavior change, not opt-in: it only affects ownership.owner deployments already relying on cross-owner container: sharing. Restore the old unchecked behavior with the new ownership.allow_cross_owner_namespace_sharing: true escape hatch.
…r check Cover the new request_body.container_create.restrict_namespace_sharing / allowed_namespace_sharing_containers / deny_namespace_path_mode knobs (sample config, reference table, env-var table) and the ownership.allow_cross_owner_namespace_sharing default-false cross-owner container:<ref> check (sample config, Owner Label Isolation section, env-var table, security.mdx Layer 6 writeup).
…t change Add the three new request_body.container_create knobs to Unreleased/Added, and a new Security subsection calling out ownership.allow_cross_owner_namespace_sharing defaulting to false as this release's one deliberate default-behavior change. Fold the now-shipped container:<id>/ns:<path> audit-backlog line out of README's Post-1.0 preview table into the Shipping in v1.5 table.
Table-driven coverage for the container:<ref>/ns:<path> gate: ContainerNamespaceRef + isNamespacePathMode parsers, restrict_namespace_sharing allow/deny matrix across NetworkMode/PidMode/IpcMode/UsernsMode, deny_namespace_path_mode, filter-options mapping, and blank-entry validation. Ownership: cross-owner deny, same-owner/unlabeled/not-found handling, AllowCrossOwnerNamespaceSharing opt-out, ref dedup, and one-pass label-inject+ref-extract. Corrected one expectation from the generated set: an inspect *error* on a namespace-sharing target fails closed (502 reasonCodeOwnerPolicyLookupFailed), not pass-through — matching the middleware's error convention for every ownership check. Tests written by Codex; this expectation fix + full -race/coverage gate run by review.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds configurable gates for 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
GO-2026-5856 (Encrypted Client Hello privacy leak in crypto/tls) is fixed in go1.26.5. Sockguard reaches crypto/tls via the remote-upstream TLS dialer (internal/upstream/resolver.go) and the hijack read/write paths (internal/proxy/hijack.go), so govulncheck flagged it as reachable on 1.26.4. Bumps the toolchain directive in app/go.mod + benchmarks/go.mod and the Dockerfile builder base to golang:1.26.5-alpine3.23 (new index digest). Pre-existing on dev/v1.5 and main, surfaced by this PR's fresh CI run; verified locally that govulncheck reports 0 vulnerabilities on 1.26.5.
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Dockerfile`:
- Line 4: Replace the Alpine-based image in the builder stage with the approved
Chainguard/Wolfi Go builder image, preserving the existing BUILDPLATFORM
targeting and digest pinning requirements.
In `@README.md`:
- Line 488: The namespace-sharing documentation incorrectly implies that
deny_namespace_path_mode covers all HostConfig namespace fields. Update the
README namespace-sharing gate entry and the corresponding configuration
documentation to state that ns:<path> is restricted only in NetworkMode, while
container:<ref> is checked across NetworkMode, PidMode, IpcMode, and UsernsMode.
- Line 489: Update the README Internals note to qualify the compatibility claim:
replace “No YAML key, env var, CLI flag, or default value changes” with wording
that only existing keys, flags, and default values remain unchanged by the
reflection refactor, while acknowledging that the PR adds new YAML fields and
SOCKGUARD_* variables.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3cb13026-5dd5-4e9b-8912-f762d5564977
⛔ Files ignored due to path filters (1)
CHANGELOG.mdis excluded by!CHANGELOG.md
📒 Files selected for processing (17)
DockerfileREADME.mdapp/go.modapp/internal/cmd/serve.goapp/internal/config/config.goapp/internal/config/filter_options.goapp/internal/config/filter_options_test.goapp/internal/config/validate.goapp/internal/config/validate_test.goapp/internal/filter/container_create.goapp/internal/filter/container_create_test.goapp/internal/ownership/coverage_gap_test.goapp/internal/ownership/middleware.goapp/internal/ownership/middleware_test.gobenchmarks/go.moddocs/content/docs/configuration.mdxdocs/content/docs/security.mdx
CodeRabbit review on #130 flagged that the namespace-sharing docs implied deny_namespace_path_mode (ns:<path>) covers all four HostConfig namespace fields. It only guards NetworkMode; container:<ref> is the form checked across NetworkMode/PidMode/IpcMode/UsernsMode. - README namespace-sharing gate row + configuration.mdx table cell now split the two mechanisms and their scopes. - Qualify the reflection-refactor "no key changes" claim so it doesn't contradict the new namespace-sharing fields added in the same release.
Brings main's v1.4.1 (Go toolchain 1.26.5 / GO-2026-5856) into the active dev branch. The toolchain bump itself was already on dev/v1.5 via #130, so the only new content is the CHANGELOG [1.4.1] Security entry and the README latest-release prose flip to v1.4.1. CHANGELOG conflict resolved keeping [Unreleased] (v1.5 spine) on top, then [1.4.1], then [1.4.0].
The final v1.5 spine item. Closes a real cross-tenant hole and adds structural gates for container-namespace-sharing modes on
POST /containers/create.The hole
allow_host_network/pid/ipc/usernsonly ever matched the literal"host"value onHostConfig.{NetworkMode,PidMode,IpcMode,UsernsMode}. Acontainer:<id-or-name>value — which joins another container's namespace (shared sockets, process visibility,/dev/shm) — always passed through unchecked, invisible to owner-label isolation.ns:<path>onNetworkModebypassed the"host"-literal check the same way.Two independent layers
Filter tier (opt-in, zero behavior change unless enabled):
request_body.container_create.restrict_namespace_sharing(bool) +allowed_namespace_sharing_containers([]string) — structurally deny/scopecontainer:<ref>joins across all four fields.request_body.container_create.deny_namespace_path_mode(bool) — denyns:<path>onNetworkMode.Ownership tier (the maintainer-approved default-behavior change):
ownership.allow_cross_owner_namespace_sharing(bool, defaultfalse). Whenownership.owneris set, everycontainer:<ref>target is resolved and the create is denied if that container belongs to a different owner. Settrueto restore the old pass-through. This is the one v1.5 knob that intentionally changes default behavior — it only affects deployments that already setownership.ownerand relied on cross-ownercontainer:sharing, which is itself the vulnerability. Shipped under a CHANGELOG Security entry.Correctness notes
container:<ref>gating on NetworkMode/PidMode/IpcMode is real Docker syntax. UsernsModecontainer:andns:<path>are belt-and-suspenders (stock Docker doesn't accept those forms) — implemented defensively, not over-claimed in docs, and no false-positive risk (Docker network names can't contain:).reasonCodeOwnerPolicyLookupFailed), matching every other ownership check; not-found passes through (the daemon rejects a nonexistentcontainer:target anyway).Tests & gates (local)
gofmtclean,go build/go vetclean, fullgo test -race ./...green, CI-style production coverage 96.6% (floor 96%). Feature code by a worktree agent; tests by Codex; one generated test expectation (inspect-error → fail-closed) corrected during review.Docs:
configuration.mdx+security.mdxupdated; README audit-backlog line for shared-namespace modes removed (now shipped).Changelog
container:<ref>andns:<path>modes.POST /containers/create.ownership.allow_cross_owner_namespace_sharingescape hatch and configuration mappings.Concerns