Repository navigation
🧪 test(integration): Podman rootful+rootless CI integration for libpod surface (#148) - #192
Conversation
PR6 of the #148 Podman/libpod train: real-daemon coverage for the libpod inspectors built in PR2-PR5, mirroring the existing integration-tagged Docker suite's structure and skip-cleanly convention. - app/integration/podman_libpod_integration_test.go and podman_helpers_test.go (new, //go:build podmanintegration): plain libpod container-create passes; privileged container-create and host-network / disallowed-infra-image-registry pod-create are denied with "libpod "-prefixed reasons; exec create/start honor the shared request_body.exec config via a real create+start+exec round trip; libpod_volume/network/secret driver gates fire. - app/internal/cmd/rules_podman_integration_test.go (new, same tag): proves the POST /libpod/play/kube blind-write acknowledgment gate against a live daemon, not just rules_test.go's synthetic configs. - app/integration/helpers_test.go: broaden the build tag to `integration || podmanintegration` so the podman suite reuses the daemon-agnostic handler/rule-compilation helpers instead of duplicating them. All tests t.Skip cleanly when SOCKGUARD_TEST_PODMAN_SOCKET is unset, so `go test ./...` and the existing dockerd suite are unaffected; the 96% coverage gate excludes nothing new (verified locally at 96.2% after filtering differential/testcert/testhelp).
…man (#148) New workflow .github/workflows/quality-integration-podman.yml runs the podmanintegration-tagged tests added in the prior commit on ubuntu-latest, mirroring quality-integration.yml's real-dockerd structure (harden-runner, pinned action SHAs, pre-pulled pinned sentinel image). Two jobs against the distro-packaged podman: - rootful: required leg, `sudo podman system service` on the well-known root socket, chmod'd so the unprivileged test process can dial it directly. - rootless: continue-on-error. ubuntu-latest has usable newuidmap/newgidmap and /etc/subuid /etc/subgid ranges for the runner user (verified with an explicit prerequisite-check step), but the runner has no logind session, so XDG_RUNTIME_DIR has to be created and chowned by hand rather than relying on pam_systemd. That's more failure-prone than the rootful path most sockguard deployments actually run behind, so a transient rootless-only failure never blocks a PR.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 24 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR adds rootful and rootless Podman GitHub Actions jobs. The jobs validate Podman sockets, pre-pull a digest-pinned BusyBox image, and run Podman-tagged Go integration suites. New helpers handle socket checks, libpod API requests, container polling, and cleanup. New tests exercise real libpod version, container, pod, exec, volume, network, secret, and kube-rule policies. Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Both legs of the new podman integration workflow failed on the real runner (run 31021161589): - Rootful (92357909184): every test hit "stat /run/podman/podman.sock: permission denied". The socket chmod alone wasn't enough — /run/podman itself is root-owned 0700, so the unprivileged test process can't even traverse into the directory to reach the (now world-writable) socket file. chmod the directory too, and add a curl --unix-socket _ping check as the runner user right after starting the service, so a future regression here fails loudly at setup instead of inside the suite. - Rootless (92357909108): "Verify rootless prerequisites" died on `getent subuid runner` with "Unknown database: subuid" — glibc on ubuntu-latest has no subuid/subgid NSS database registered at all, so getent can't answer the question regardless of what /etc/subuid contains. Check the files directly with grep instead.
…#148) Run 31021969781's rootful leg fixed the earlier permission-denied issue but surfaced new failures once tests actually hit real Podman 4.9.3: - Bare (unversioned) libpod routes other than GET /libpod/_ping 404 on real Podman, unlike dockerd. Container-create and exec-create now fetch the daemon's Libpod-Api-Version via _ping and prefix every request that needs to reach Podman with /v<version>/libpod/...; TestProxyReachesRealPodmanVersion (which hit bare /libpod/version) is removed as no longer viable. - Deny-reason assertions used raw strings.Contains against JSON bodies whose %q-quoted values are escaped (\") — switched to decoding filter.DenialResponse and comparing .Reason. - The exec test's denied/allowed Cmd payloads had no explicit User, so isRootUser("") tripped the root-exec-user gate before the command-allowlist gate ever ran; added "User":"nobody" to isolate the allowlist check. - removeLibpodContainer force-removes a RUNNING container, which makes Podman stop it first (SIGTERM + grace period) — that alone exceeds the shared 5s HTTP client timeout. Gave it its own 30s client instead of widening the shared one. - POST /libpod/exec/{id}/start is hijack-capable, and internal/proxy/hijack.go always forwards the version-stripped path upstream by design (pinned by existing hijack tests) — fine for dockerd, currently incompatible with real Podman's non-_ping versioning requirement. Dropped the real exec-start round trip with a comment explaining why; exec's shared-config enforcement is already fully proven by the exec-create deny/allow pair. All changes verified locally against a real `podman machine` socket (macOS, Podman Engine 5.8.1), not just compiled.
…-step for rootless leg
…eam leg (#203) * 🐛 fix(proxy): forward the original versioned path on the hijack upstream leg writeHijackUpstreamRequest built the outbound attach/exec-start request from the filter-normalized (version-stripped) path instead of the client's original path. dockerd tolerates a bare unversioned path, but real Podman requires the version prefix (/v5.x.y/libpod/...) on every libpod route but the bare _ping, so a hijacked POST /libpod/exec/{id}/start proxied through sockguard 404ed against a real daemon even when policy allowed it. The non-hijack reverse-proxy path (proxy.go's Rewrite, which only touches Scheme/Host) never had this bug. - newUpstreamHijackRequest now takes the wire path directly; the production caller passes r.URL.Path. The normalized path is still used for endpoint matching (isHijackEndpointNormalized) and logging. - New internal/proxy/hijack_libpod_test.go regression test (TestHandleHijack_LibpodExecStartPreservesVersionPrefix) reproduces the mangle directly; two existing tests that pinned the old stripped-path behavior (hijack_test.go, internal/cmd/serve_chain_test.go) are updated to assert the fixed contract. - New podmanintegration-tagged acceptance test (TestLibpodExecStartEndToEndHijackAgainstRealPodman) drives a real create -> exec-create -> exec-start round trip through the hijack path against a live Podman daemon, closing the gap PR #192 left open. - Removes the now-resolved "Known Limitations" entry from the Podman guide and records the fix in CHANGELOG.md. Fixes #194 * 🐛 fix(proxy): preserve RawPath on the hijack upstream request newUpstreamHijackRequest built the outbound URL from r.URL.Path alone, which is decoded (%2F becomes a literal /). With no RawPath set, a url.URL re-derives EscapedPath() from the decoded Path, so an encoded segment in a hijacked attach/exec-start target would collapse into a different path on the wire than the client actually sent. Now carries r.URL.RawPath into the constructed upstream URL whenever path equals r.URL.Path (the production caller's case); left unset when a caller substitutes a different path, since a stale RawPath wouldn't describe it. New tests: TestNewUpstreamHijackRequest_PreservesRawPathForEncodedSegments and its negative counterpart (unit level), plus TestHandleHijack_PreservesEncodedPathBytesUpstream, which checks the actual forwarded bytes rather than just the parsed URL struct. CodeRabbit review on #203. * ✅ test(proxy): table-drive the libpod hijack regression tests Convert TestHandleHijack_LibpodExecStartPreservesVersionPrefix and TestLibpodExecStartEndToEndHijackAgainstRealPodman to table-driven tests per repo coding guidelines (t.Run subtests, case table for what varies), matching the existing convention across the suite. hijack_libpod_test.go gains a two-part Docker-style version prefix case alongside the original three-part Podman semver case, plus a case covering the RawPath/%2F fix from the preceding commit — an encoded exec-ID segment must survive onto the wire unchanged. podman_libpod_integration_test.go's acceptance test now runs the full create -> exec-create -> exec-start round trip for two commands (echo, with a trailing newline; printf, without), proving the hijack frame decoding path for both shapes. Re-verified against a real Podman machine (Podman 6.0.2 client / Libpod 5.8.1 server): both subtests pass. CodeRabbit review on #203.
Summary
PR6 of the #148 Podman/libpod train: CI integration tests against a real Podman socket, mirroring the existing
-tags=integrationDocker suite's structure.app/integration/podman_libpod_integration_test.go(new,//go:build podmanintegration) — starts sockguard's real middleware chain in front of a genuinepodman system servicesocket:POST /libpod/containers/createbody is allowed and actually creates a containerprivilegedcontainer-create is denied with a"libpod "-prefixed reasonPOST /libpod/pods/createbodies are denied with"libpod "-prefixed reasonsrequest_body.execconfig (feat(runtime): support Podman Docker-compatible and native libpod APIs #148 design decision C3): a disallowed command is denied before ever reaching Podman, an allowlisted one is forwarded through a real create→start→exec-create→exec-start round triplibpod_volume/libpod_network/libpod_secretdriver gates fire against real create requestsapp/integration/podman_helpers_test.go(new, same tag) — podman-specific pinger/cleanup helpers; reuses the daemon-agnostic handler/rule-compilation helpers fromhelpers_test.go(see below) rather than duplicating them.app/integration/helpers_test.go— build tag broadened tointegration || podmanintegrationso both suites sharenewIntegrationProxyHandlerWithOptions,compileRulesForTest,dockerHTTPClient, etc. (all daemon-agnostic; only the Docker-specific helpers stay underintegrationalone).app/internal/cmd/rules_podman_integration_test.go(new, same tag) — proves thePOST /libpod/play/kubeblind-write acknowledgment gate (feat(runtime): support Podman Docker-compatible and native libpod APIs #148 design decision C2) against a live daemon viavalidateAndCompileRules, not just the synthetic configs already inrules_test.go..github/workflows/quality-integration-podman.yml(new) — runs the suite onubuntu-latestagainst:sudo podman system serviceon the well-known root socket (/run/podman/podman.sock), chmod'd 666 so the unprivileged test process can dial it directly without running the whole Go test binary under sudo.continue-on-error: true): verifiednewuidmap/newgidmapand/etc/subuid//etc/subgidranges exist for the runner user (ubuntu-latest ships both), then creates and chowns/run/user/<uid>by hand before starting a per-userpodman system servicethere — the runner has no logind session, soXDG_RUNTIME_DIRis never auto-created viapam_systemdthe way it would be on an interactive login. That's more failure-prone than the rootful path most sockguard deployments actually run behind, so a transient rootless-only failure never blocks a PR. Full rationale is in the workflow's comments.### Testsentry under## [Unreleased].Tests
t.Skipcleanly whenSOCKGUARD_TEST_PODMAN_SOCKETis unset, so plaingo test ./...and the existing dockerd-tags=integrationsuite are unaffected.Local verification
go build ./.../go vet ./...— clean, no tagsgo build -tags=integration ./...andgo build -tags=podmanintegration ./...— cleango test -tags=podmanintegration ./integration/... ./internal/cmd/...— all new testsSKIPcleanly withoutSOCKGUARD_TEST_PODMAN_SOCKET(verified with-v)go test ./...— green (oneinternal/ownershipflake from a leftover/tmpunix socket from a prior parallel run, confirmed pre-existing/unrelated — passes clean in isolation)go list ./... | grep -v testcert | xargs go test -race -coverprofile=... -covermode=atomic, then filtereddifferential/testcert/testhelpout of the profile beforego tool cover -func→ 96.2% (gate is 96%)golangci-lint run(no tags, matches CI/lefthook exactly) — 0 issues; also re-ran with--build-tags=integration,podmanintegrationfor extra rigor — 0 issueszizmor .github/workflows/— no findingsTest plan
🦭 Quality: Integration (Podman)workflow runs on this PR and the rootful leg passes (required)continue-on-errorwithout blocking the PR✨ Added
podmanintegration-tagged integration tests for realpodman system servicesockets./libpod/play/kubeendpoints.SOCKGUARD_TEST_PODMAN_SOCKETis unset.🔧 Changed
app/integration/helpers_test.goto build withintegrationorpodmanintegration.app/integration/podman_helpers_test.gofor socket discovery, availability checks, version fetch, container polling, and forced removal.app/integration/podman_libpod_integration_test.goto verify real Libpod proxy behavior and denial paths..github/workflows/quality-integration-podman.ymlwith rootful and rootless Podman jobs.🐛 Fixed
Fixed CI environment issues for rootful socket directory permissions.
Fixed rootless validation for
subuidandsubgidsetup.Fixed allow-rule coverage for
/libpod/play/kubewheninsecure_allow_body_blind_writes=trueis required.Rootful Podman CI is required. Confirm it does not expand default socket access.
Rootless Podman CI is non-blocking. Confirm failures cannot hide regressions in tagged tests.
Review the new Podman helpers for overlap with existing Docker integration utilities.
Check that all skip paths fail closed when
SOCKGUARD_TEST_PODMAN_SOCKETis missing.