Skip to content

✨ feat(filter): libpod pod-create, exec, and volume/network/secret inspection (#148) - #190

Merged
scttbnsn merged 10 commits into
dev/v1.6from
feat/148-libpod-pod-exec
Aug 5, 2026
Merged

scttbnsn merged 10 commits into
dev/v1.6from
feat/148-libpod-pod-exec

Conversation

@scttbnsn

@scttbnsn scttbnsn commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

PRs 3+4 of the #148 train (combined), building on the merged routing groundwork (#189).

What's here

  • Pod-create inspector (POST /libpod/pods/create): gates pod-level host network (netns {nsmode:"host"}), pod-wide PID sharing (share containing pid — same blast radius as container-level host PID), and allowed_infra_image_registries for the infra container image. New request_body.libpod_pod_create config block. Cross-owner reference checks intentionally deferred to the ownership PR (TODO anchors in place).
  • Exec extended, not forked: libpod exec create/start delegate to the same execPolicy decode and verdict logic (bodies match Docker's field names), with a libpod-path exec-inspect constructor (GET /libpod/exec/{id}/json). One shared request_body.exec config covers both API families by design — a split config would be an easy way to configure one and silently forget the other. Parity tests assert identical verdicts for identical bodies on both path families.
  • Volume/network/secret inspectors: libpod-specific decode structs reusing the existing VolumeRequestBodyConfig/NetworkRequestBodyConfig/SecretRequestBodyConfig types under request_body.libpod_volume/libpod_network/libpod_secret.
  • Gate tables: bodySensitiveWriteEndpoints gains the libpod write surface including play/kube, generate/kube, kube/apply, and manifest writes — those four get NO config surface, so any allow rule for them requires insecure_allow_body_blind_writes, and the docs warning now names the kube-play blast radius (one request can provision N privileged containers). sensitiveExfilEndpoints gains libpod export/archive/logs/attach and image get/push. Startup-validator tests cover the new coverage (allow rule for play/kube without the ack fails startup).

Verification

go build, go test ./..., golangci-lint green; production coverage above the 96% floor; full pre-push hook suite green.

Part of #148 (does not close it).

Changelog

  • ✨ Added libpod request-body inspectors for pod, volume, network, and secret creation.
  • ✨ Added libpod exec create/start inspection with shared request_body.exec policy.
  • 🔒 Added fail-closed policy gates for host networking, shared PID namespaces, custom drivers, driver options, and infra-image registries.
  • 🔒 Added libpod sensitive-write and read-exfiltration gate tables.
  • 🔧 Added startup validation, filter wiring, parity tests, and configuration documentation.
  • ⚠️ Kept Kubernetes play/apply and manifest writes body-blind. These require insecure_allow_body_blind_writes.
  • ⚠️ Deferred cross-owner pod checks to a later ownership change.

Concerns

  • Verify that all libpod route patterns match the supported Podman API variants.
  • Verify that malformed request bodies preserve the intended fail-closed behavior.
  • Run the complete Go test suite and policy validation tests.
  • Confirm that new exported configuration and filter types follow existing API compatibility conventions.

@vercel

vercel Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sockguard-website Ready Ready Preview Aug 5, 2026 3:07pm

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@scttbnsn, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b42ce4e0-d867-42e8-868b-9e26f2745fe3

📥 Commits

Reviewing files that changed from the base of the PR and between 7e8a502 and 3467e70.

⛔ Files ignored due to path filters (1)
  • CHANGELOG.md is excluded by !CHANGELOG.md
📒 Files selected for processing (18)
  • app/internal/cmd/rules.go
  • app/internal/cmd/rules_test.go
  • app/internal/cmd/serve.go
  • app/internal/config/config.go
  • app/internal/config/filter_options.go
  • app/internal/config/validate.go
  • app/internal/filter/exec.go
  • app/internal/filter/exec_test.go
  • app/internal/filter/libpod_network.go
  • app/internal/filter/libpod_network_test.go
  • app/internal/filter/libpod_pod_create.go
  • app/internal/filter/libpod_pod_create_test.go
  • app/internal/filter/libpod_secret.go
  • app/internal/filter/libpod_secret_test.go
  • app/internal/filter/libpod_volume.go
  • app/internal/filter/libpod_volume_test.go
  • app/internal/filter/middleware.go
  • docs/content/docs/configuration.mdx
📝 Walkthrough

Walkthrough

This change extends libpod coverage in rule validation and runtime inspection. It classifies more libpod write and exfiltration endpoints, keeps libpod pod, volume, network, and secret create paths body-inspected, and leaves play, kube, and manifest writes as body-blind opt-in paths. It adds libpod-specific config fields and validation for pod-create settings. It adds libpod exec-start inspector wiring and shared exec inspection handling for Docker-compatible and libpod routes. It also adds new libpod request inspectors, tests, and configuration docs.

Possibly related PRs

  • CodesWhat/sockguard#145: Shares the request-body policy pipeline in config.go, filter_options.go, validate.go, and serve.go, which this change extends to libpod endpoints.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/148-libpod-pod-exec

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
app/internal/filter/middleware.go (1)

458-472: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the libpod path predicates instead of repeating the literals.

Each of these three matchers duplicates a path literal that the inspector also re-checks: libpodPathPrefix+"volumes/create" in libpod_volume.go line 29, libpodPathPrefix+"networks/create" in libpod_network.go line 44, and libpodPathPrefix+"secrets/create" in libpod_secret.go line 32. The pod-create case already uses a named predicate, isLibpodPodCreatePath. Follow that convention so a future path edit cannot update the matcher and leave the inspector guard behind.

♻️ Proposed refactor
 func matchesLibpodVolumeInspection(normalizedPath string) bool {
-	return normalizedPath == libpodPathPrefix+"volumes/create"
+	return isLibpodVolumeCreatePath(normalizedPath)
 }
 
 func matchesLibpodNetworkInspection(normalizedPath string) bool {
-	return normalizedPath == libpodPathPrefix+"networks/create"
+	return isLibpodNetworkCreatePath(normalizedPath)
 }
 
 func matchesLibpodSecretInspection(normalizedPath string) bool {
-	return normalizedPath == libpodPathPrefix+"secrets/create"
+	return isLibpodSecretCreatePath(normalizedPath)
 }

Define the predicates next to isLibpodPodCreatePath and use them in the inspector guards as well.

🤖 Prompt for 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.

In `@app/internal/filter/middleware.go` around lines 458 - 472, Extract named
predicates for libpod volume, network, and secret create paths alongside
isLibpodPodCreatePath, and update matchesLibpodVolumeInspection,
matchesLibpodNetworkInspection, and matchesLibpodSecretInspection to use them.
Replace the corresponding duplicated path-literal checks in the volume, network,
and secret inspectors with the same predicates.
app/internal/filter/libpod_network_test.go (2)

79-142: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the three gate tests table-driven, and normalize the path consistently.

TestLibpodNetworkInspectLibpodCreateOptionsGate, ...SubnetsGate, and ...IPAMOptionsGate each duplicate a deny/allow pair. The driver gate in the same file already uses a table. Convert these three to the same shape so a new gate is one row.

Line 113 also passes the literal "/libpod/networks/create" while every other call passes NormalizePath(req.URL.Path). The values are equal today, so behavior is unaffected. Use NormalizePath for consistency.

As per coding guidelines: "Prefer table-driven tests with testing.T and httptest."

🤖 Prompt for 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.

In `@app/internal/filter/libpod_network_test.go` around lines 79 - 142, Convert
TestLibpodNetworkInspectLibpodCreateOptionsGate,
TestLibpodNetworkInspectLibpodCreateSubnetsGate, and
TestLibpodNetworkInspectLibpodCreateIPAMOptionsGate into table-driven tests
matching the existing driver-gate pattern, with rows covering denied and allowed
configurations. Iterate each case with testing.T subtests while preserving the
expected reason assertions. In the subnet allowed case, pass
NormalizePath(req.URL.Path) instead of the literal path, consistently with the
other inspectLibpodCreate calls.

Source: Coding guidelines


144-195: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Feed libpod paths into the path-matching fuzz corpus.

FuzzPathMatch feeds NormalizePath output into compiled rules, but it only seeds Docker-style paths. Add libpod seeds (for example /libpod/networks/create, /libpod/exec/{id}/start, /libpod/containers/{name}/exec, and /libpod/volumes/create) so the new matcher behavior remains covered by fuzzing.

🤖 Prompt for 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.

In `@app/internal/filter/libpod_network_test.go` around lines 144 - 195, Update
the seed setup in FuzzPathMatch to include libpod paths alongside the existing
Docker-style seeds, covering /libpod/networks/create, /libpod/exec/{id}/start,
/libpod/containers/{name}/exec, and /libpod/volumes/create so NormalizePath
output for these routes is exercised by compiled-rule matching.

Source: Coding guidelines

🤖 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 `@app/internal/cmd/rules_test.go`:
- Around line 937-1119: The related tests around validateAndCompileRules should
be consolidated into one table-driven test instead of separate standalone
functions. Create a []struct case table covering each allow, reject, and opt-in
scenario, including expected validation success or failure and endpoint/error
assertions, then run each case with t.Run while preserving the existing
validation behavior and checks.

In `@app/internal/cmd/rules.go`:
- Around line 137-144: Update the libpod endpoint classifications to treat
manifest registry pushes as sensitive exfiltration: add sentinels for POST
/libpod/manifests/*/registry/* and POST /libpod/manifests/*/push to
sensitiveExfilEndpoints, then add narrow-rule rejection cases covering both
route patterns so they honor insecure_allow_read_exfiltration.

In `@docs/content/docs/configuration.mdx`:
- Around line 1160-1162: Expand the configuration table entries for
libpod_volume, libpod_network, and libpod_secret to document every active
inherited policy field enforced by their corresponding inspectors, including
custom-driver, IPAM, driver-option, and IPv4 controls. Use the exact
environment-variable and configuration-key symbols defined by the
implementation, rather than listing only the three group-level flags currently
shown.

---

Nitpick comments:
In `@app/internal/filter/libpod_network_test.go`:
- Around line 79-142: Convert TestLibpodNetworkInspectLibpodCreateOptionsGate,
TestLibpodNetworkInspectLibpodCreateSubnetsGate, and
TestLibpodNetworkInspectLibpodCreateIPAMOptionsGate into table-driven tests
matching the existing driver-gate pattern, with rows covering denied and allowed
configurations. Iterate each case with testing.T subtests while preserving the
expected reason assertions. In the subnet allowed case, pass
NormalizePath(req.URL.Path) instead of the literal path, consistently with the
other inspectLibpodCreate calls.
- Around line 144-195: Update the seed setup in FuzzPathMatch to include libpod
paths alongside the existing Docker-style seeds, covering
/libpod/networks/create, /libpod/exec/{id}/start,
/libpod/containers/{name}/exec, and /libpod/volumes/create so NormalizePath
output for these routes is exercised by compiled-rule matching.

In `@app/internal/filter/middleware.go`:
- Around line 458-472: Extract named predicates for libpod volume, network, and
secret create paths alongside isLibpodPodCreatePath, and update
matchesLibpodVolumeInspection, matchesLibpodNetworkInspection, and
matchesLibpodSecretInspection to use them. Replace the corresponding duplicated
path-literal checks in the volume, network, and secret inspectors with the same
predicates.
🪄 Autofix

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: 0d8e797b-3fc6-4b8b-a63b-79c95a3bafa9

📥 Commits

Reviewing files that changed from the base of the PR and between 78aaa2f and be6678c.

⛔ Files ignored due to path filters (1)
  • CHANGELOG.md is excluded by !CHANGELOG.md
📒 Files selected for processing (18)
  • app/internal/cmd/rules.go
  • app/internal/cmd/rules_test.go
  • app/internal/cmd/serve.go
  • app/internal/config/config.go
  • app/internal/config/filter_options.go
  • app/internal/config/validate.go
  • app/internal/filter/exec.go
  • app/internal/filter/exec_test.go
  • app/internal/filter/libpod_network.go
  • app/internal/filter/libpod_network_test.go
  • app/internal/filter/libpod_pod_create.go
  • app/internal/filter/libpod_pod_create_test.go
  • app/internal/filter/libpod_secret.go
  • app/internal/filter/libpod_secret_test.go
  • app/internal/filter/libpod_volume.go
  • app/internal/filter/libpod_volume_test.go
  • app/internal/filter/middleware.go
  • docs/content/docs/configuration.mdx

Comment thread app/internal/cmd/rules_test.go Resolved
Comment thread app/internal/cmd/rules.go Resolved
Comment thread docs/content/docs/configuration.mdx Resolved
scttbnsn added 10 commits August 5, 2026 10:58
…tors

Adds request-body inspection for Podman's libpod-native write endpoints
that had no coverage: POST /libpod/pods/create, POST /libpod/volumes/create,
POST /libpod/networks/create, and POST /libpod/secrets/create.

- libpod_pod_create.go: new inspector gated by allow_host_network (pod-level
  netns {nsmode:"host"}), allow_shared_pid_namespace (shared_namespaces
  containing "pid"), and allowed_infra_image_registries (reuses the
  image_pull registry-allowlist shape). Cross-owner pod-membership checks are
  explicitly deferred to a later PR (see the TODO in libpod_pod_create.go).
- libpod_volume.go / libpod_network.go / libpod_secret.go: libpod-shaped
  decode structs that reuse the EXISTING volume/network/secret config types
  rather than introducing parallel config — libpod's wire shapes differ from
  Docker-compat (volume options live under "Options" not "DriverOpts",
  network options are snake_case with no swarm-mode fields, secret driver is
  a query param not a body field) but the policy question is identical.
- config.go/filter_options.go/validate.go: new
  request_body.libpod_pod_create config surface plus
  request_body.libpod_volume/libpod_network/libpod_secret keys mapped onto
  the pre-existing config types.
- middleware.go: wires the four new inspectors into compileRuntimePolicy,
  and extends matchesExecInspection so the existing shared execPolicy also
  matches the libpod exec create/start paths (no separate libpod_exec
  config — see the follow-up exec.go commit).

All wiring is additive to shared files (config.go, middleware.go, etc.) to
minimize rebase conflict surface with the concurrent libpod container-create
inspector PR.

Refs #148
POST /libpod/containers/{name}/exec and POST /libpod/exec/{id}/start route
to the identical Go handlers the Docker-compat exec paths do (confirmed
against Podman v5.8.1's own route table), so per the #148 design doc
(decision C3) both families now share the SAME execPolicy/ExecOptions and
request_body.exec config — there is no separate libpod_exec block.

- exec.go: execStartIdentifier now also reports which path family (Docker
  vs libpod) matched a given exec-start path; inspectExisting dispatches to
  the new InspectStartLibpod field for libpod paths instead of InspectStart,
  since the two point at different upstream endpoints
  (GET /exec/{id}/json vs GET /libpod/exec/{id}/json) and must stay
  independently configured so setting one never silently satisfies the
  other's fail-closed "no exec inspection configured" guard.
- NewLibpodExecInspector / NewLibpodExecInspectorWithRoundTripper add the
  libpod-path variant of the exec-inspect upstream constructor; both it and
  the existing Docker constructor now delegate to a shared
  newHTTPExecInspector helper.
- serve.go: attachRuntimeInspectors wires
  policy.Exec.InspectStartLibpod alongside the existing InspectStart.

Refs #148
Extends the three startup validators driven by bodySensitiveWriteEndpoints /
sensitiveExfilEndpoints / bodyInspectionConfiguredForEndpoint to cover the
new libpod surface:

- bodySensitiveWriteEndpoints gains libpod pod-create, exec create/start,
  and volume/network/secret create — all of which have real inspectors —
  plus (design doc decision C2) play/kube, its kube/play alias, kube/apply,
  and manifest writes, none of which get any request-body inspector in this
  release (full Kubernetes-YAML/PodSpec modeling is out of scope), so
  admitting them requires insecure_allow_body_blind_writes exactly like any
  other uninspected body-sensitive write.
- sensitiveExfilEndpoints gains libpod's container archive/export/logs/
  attach and image export/get/push read surface, confirmed against Podman
  v5.8.1's route table rather than assumed from naming symmetry with the
  Docker-compat entries (libpod has no /attach/ws variant and no plugin API
  at all). GET /libpod/generate/kube is included here rather than in
  bodySensitiveWriteEndpoints, deliberately deviating from the design doc's
  literal placement: Podman registers it as a GET (libpod.GenerateKube) that
  dumps existing pod/container definitions to YAML, a read/export surface
  that can leak env vars, not a write.
- bodyInspectionConfiguredForEndpoint arms unconditionally true for the four
  libpod endpoints with real fail-closed inspectors, and shares the existing
  exec case (keyed on request_body.exec.allowed_commands) across both the
  Docker-compat and libpod exec paths.

Refs #148
- libpod_pod_create_test.go / libpod_volume_test.go / libpod_network_test.go
  / libpod_secret_test.go: gate tables for each new inspector (default-deny
  behavior, explicit allow, malformed/oversized body handling, path/method
  non-match), plus negative cross-shape tests proving POST /containers/create
  and POST /libpod/pods/create bodies never leak into each other's decode —
  e.g. libpod's netns.nsmode:"host" has zero effect on the Docker-compat
  container-create decision, and Docker's HostConfig.NetworkMode:"host" has
  zero effect on the libpod pod-create decision.
- exec_test.go: exec-parity tests proving identical request bodies produce
  identical allow/deny verdicts on the Docker-compat and libpod exec paths
  through the single shared execPolicy, dispatch tests proving
  inspectExisting calls the InspectStart/InspectStartLibpod function
  matching the request's own path family (and never the other), and
  constructor/round-tripper tests for NewLibpodExecInspector[WithRoundTripper]
  including a mock upstream that only accepts GET /libpod/exec/{id}/json to
  prove the libpod path is actually used.

Refs #148
Covers the additions to internal/cmd/rules.go from #148:

- Allow-with-config success cases for libpod pod-create, exec (shared
  request_body.exec allowlist), and volume/network/secret create.
- Blind-write validator rejection for /libpod/containers/*/exec without a
  configured allowlist, and for /libpod/play/kube (+ its kube/play alias),
  /libpod/kube/apply, and /libpod/manifests/* without
  insecure_allow_body_blind_writes — plus the mirrored allow-with-explicit-
  opt-in case for play/kube.
- Read-exfiltration validator rejection (and explicit-opt-in allow) for the
  new libpod container/image read surface and GET /libpod/generate/kube.
- Direct bodyInspectionConfiguredForEndpoint coverage for every new libpod
  case, including the shared exec config across both libpod exec create and
  exec start.

Refs #148
…/secret inspection

- configuration.mdx: new prose bullets and Request Body Policy Reference /
  environment-variable rows for request_body.libpod_pod_create,
  request_body.libpod_volume, request_body.libpod_network, and
  request_body.libpod_secret; the exec section and reference table now state
  explicitly that request_body.exec governs both the Docker-compat and
  libpod exec paths (no separate libpod_exec config); the
  insecure_allow_body_blind_writes bullet documents the uninspected
  play/kube/kube-apply/manifest surface and its N-privileged-containers
  blast radius; insecure_allow_read_exfiltration documents the new libpod
  read/export surface including GET /libpod/generate/kube.
- CHANGELOG.md: Unreleased Added/Docs/Tests entries for #148 PR3+4.

Refs #148
POST /libpod/manifests/*/registry/* and the backward-compat POST
/libpod/manifests/*/push read local manifest content and hand it to a
caller-chosen registry — an exfiltration surface like the existing
image/plugin push entries, but they weren't in sensitiveExfilEndpoints,
so rules admitting them bypassed insecure_allow_read_exfiltration.
Add both sentinels and narrow-rule rejection cases. #148
Fold the eight standalone allow/reject/opt-in validator tests for
libpod pod-create/exec/volume/network/secret gates into a single
table-driven TestValidateAndCompileRulesLibpodGates, keeping each
case's endpoint assertions and #148 design-decision comments. #148
…secret field

The env-var table listed one variable per libpod_volume/libpod_network/
libpod_secret group, and two of those three (allow_endpoint_config,
allow_template_drivers) aren't actually consulted by the libpod
inspectors. Replace with a row per field each inspector really
enforces (allow_custom_drivers/allow_driver_opts for volume;
allow_custom_drivers/allow_driver_options/allow_custom_ipam_config/
allow_ipam_options for network; allow_custom_drivers for secret) and
call out the inherited fields that have no libpod analog instead of
implying they're enforced. #148
@scttbnsn
scttbnsn force-pushed the feat/148-libpod-pod-exec branch from 3fb15f8 to 3467e70 Compare August 5, 2026 15:07
@scttbnsn
scttbnsn merged commit 06d15fe into dev/v1.6 Aug 5, 2026
46 checks passed
@scttbnsn
scttbnsn deleted the feat/148-libpod-pod-exec branch August 5, 2026 15:13
scttbnsn added a commit that referenced this pull request Aug 5, 2026
* ✨ feat(dockerresource): add KindLibpodPod/KindLibpodNetwork for #148 ownership+visibility wiring

Pods have no Docker-compat equivalent, and libpod network inspect
uses lowercase "labels" (plus an occasional single-element array
wrap) unlike every other Docker-compat-shaped inspect body — both
need their own Kind so ownership/visibility dispatch can route on
Kind alone without threading libpod-ness through every call site.

- LibpodInspectPath: dedicated /libpod/{kind}/{id}/json builder for
  the two new kinds, wired into InspectPath's existing switch
- DecodeLibpodLabels/decodeLibpodNetworkLabels: lowercase-keyed pod
  labels, plus array-unwrap-then-decode for network inspect

* ✨ feat(ownership): stamp owner labels and check pod cross-owner refs on libpod endpoints

Extends mutateOwnershipRequest with libpod cases so POST
/libpod/containers/create, /pods/create, /volumes/create,
/networks/create, and /secrets/create get the owner label injected
when ownership.owner is configured — matching each endpoint's actual
wire shape rather than assuming a single convention:

- container/pod/network create: lowercase top-level "labels"
- volume create: capitalized "Labels" (VolumeCreateOptions has no
  json tag on that field, so it falls back to the Go field name)
- secret create: no JSON body at all — driver/labels are query
  params, reuses the existing addOwnerLabelToBuildQuery helper

Read-side owner filtering (list injection + per-resource inspect/
action dispatch) is extended to every /libpod/ list and inspect path
for containers, pods, networks, volumes, and secrets — not just pods
— so switching a client from Docker-compat to libpod-native paths
can't bypass ownership isolation for reads on existing resources.

Closes the cross-owner pod-membership deferral called out in #190:
POST /libpod/pods/create requests joining another owner's namespaces
are denied, and POST /libpod/containers/create requests targeting
another owner's pod (SpecGenerator "pod" field) are denied, reusing
the existing container:<ref> namespace-sharing and embedded-resource
reference checks against libpod's uniform
{"nsmode":"container","value":"<ref>"} namespace shape.

Deny reasons for libpod-family requests get the "libpod " prefix,
matching the convention libpod's body inspectors already use.

* 🧪 test(ownership): cover libpod owner stamping, pod cross-owner denial, and read dispatch

Table-driven tests mirroring the existing ownership test patterns:
label stamping on every libpod create endpoint (including the
capitalized-Labels volume-create deviation and the secret-create
query-param path), cross-owner pod-membership denial in both
directions (pod-create namespace joins, container-create pod
targeting) plus the same-owner allow counterparts, libpod read-path
owner-filter dispatch across container/pod/network/volume/secret,
exec-identifier resolution, and a negative test proving libpod
predicates never fire on Docker-compat paths.

* ✨ feat(visibility): filter libpod list/inspect paths, including pods and network array-unwrap

Wires every /libpod/ list endpoint into the existing visibility
label-filter injection (needsVisibilityLabelFilter), and every
inspect/action path (containers, pods, networks, volumes, secrets)
into resourceVisible dispatch — pods route through the new
KindLibpodPod since they have no Docker-compat equivalent, the rest
reuse the existing Docker-compat Kind constants since ownership
labels live in the same shape once decoded.

Every libpod inspect endpoint is uniformly suffixed "/json" (unlike
Docker-compat's mixed bare-path/json-suffixed convention), so the
new identifier helpers use suffixedIdentifier rather than
singleSegmentIdentifier.

Network inspect responses are unwrapped from Podman's occasional
single-element-array envelope before label extraction (upstream
Inspector round-trip, dockerresource.DecodeLibpodLabels).

Hidden-resource deny reasons get the "libpod " prefix for requests
under /libpod/, matching the body-inspector convention.

* 🧪 test(visibility): cover libpod list/inspect filtering, pod visibility, and network array-unwrap

Table-driven tests: visibility label-filter injection on every
libpod list endpoint, KindLibpodPod list/inspect visibility
(hidden-pod 404, visible-pod forward, rollout-mode would-deny),
the "libpod " deny-reason prefix across libpod pod/container and
Docker-compat paths, an end-to-end upstreamInspector round-trip for
both bare-object and array-wrapped network inspect responses, and a
negative test proving libpod predicates never fire on Docker-compat
paths.

* 📝 docs(148): document libpod owner-label isolation and cross-owner pod checks

CHANGELOG: new Unreleased/Added entry after the existing #148
entries, and updates the pod-create entry's "deferred to a later PR"
note now that cross-owner pod-membership checks have landed.

configuration.mdx: new paragraph under Owner Label Isolation
covering the libpod-specific label casing/query-param deviations,
KindLibpodPod, and the two-directional cross-owner pod check.

* 🧪 test(visibility): fuzz libpod path identifiers, table-drive pod visibility tests

- Add FuzzLibpodPathIdentifiers covering libpod_paths.go's identifier
  helpers: no match outside /libpod/, collection routes never classify
  as a single-resource identifier, matched identifiers are non-empty
  and (bar the readSubresourceIdentifier-based container helper) never
  contain '/'. Wired into the CI fuzz matrix.
- Convert TestMiddlewareLibpodPodListAndInspectVisibility and
  TestMiddlewareLibpodDoesNotAffectDockerCompatVisibilityPaths to
  table-driven form per repo convention; assertions unchanged.

Addresses CodeRabbit comments 3722497023 and 3722497031 on PR #193.

* 📝 docs(configuration): close the libpod_pod_create cross-owner deferral note

The libpod_pod_create prose bullet and reference table row still said
cross-owner pod-membership checks were deferred to a later release.
This PR implements them (see the Owner Label Isolation section) —
update both to describe the now-enforced behavior instead.

Addresses CodeRabbit comment 3722497036 on PR #193.

This branch was successfully deployed

1 active deployment
Preview — 3467e701 Deployed Aug 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant