Conversation
…ult, presets Harden container invocation without breaking agent usability: - Drop all Linux capabilities (--cap-drop ALL), add back NET_ADMIN only for network allowlist mode - Prevent privilege escalation (--security-opt no-new-privileges) - Limit PID count to 4096 (--pids-limit, prevents fork bombs) - Change default network from host to bridge (isolated from host services) - Remove stopped containers after interactive sessions (prevents credential persistence in podman inspect) - Add network presets (--network-preset dev/registries) with built-in allowlists for common development destinations - Add interactive network selection prompt on first run when no network config is set, with option to save preference - Drop CAP_NET_ADMIN via capsh after iptables setup in allowlist mode - Add libcap to base Dockerfile for capsh binary
- Fix misleading --network help text: "host (default)" -> "bridge (default)" to match actual config default changed in this feature branch - Fix stale NetworkMode::Host doc comment that still said "default" - Consolidate push_container_args/push_podman_args into ContainerConfig::push_args (removes duplicate implementations from NativePodmanRuntime and OrbStackRuntime) - Remove now-redundant cap_drop/security_opt/pids_limit tests from runtime files (tests live in podman.rs where the shared implementation is)
Code Review: Container Security Hardening (Consensus from 4 reviewers)Status: REQUEST_CHANGES — 3 blocking issues, 5 should-fix items The security hardening direction is correct and well-executed. 🔴 BLOCKING ISSUES1. capsh fallback silently retains CAP_NET_ADMIN —
|
| Finding | Reviewers | Confidence |
|---|---|---|
| capsh fallback bypass | Security, Architecture, Quality | HIGH (3/4) |
--network host preset override |
Security, Quality, Architecture | HIGH (3/4) |
| TOML config write duplication | Quality, Architecture, Security | HIGH (3/4) |
| Missing Local save option | Quality, Architecture | HIGH (2/4) |
resolve_network_mode signature |
Architecture, Quality | HIGH (2/4) |
| Test gaps | Quality | MEDIUM (1/4) |
Scores
| Reviewer | Score | Rec |
|---|---|---|
| Security | 6/10 | CHANGES_REQUESTED |
| Architecture | 6/10 | CHANGES_REQUESTED |
| Performance | 8/10 | APPROVED |
| Quality | 5/10 | CHANGES_REQUESTED |
Fix the 3 blocking issues and address code quality concerns, then this is ready to merge.
- Fail hard when capsh is missing instead of silently retaining CAP_NET_ADMIN (security: prevents iptables flush bypass) - Add warning when --network host is overridden by --network-preset - Refactor resolve_network_mode to use NetworkResolutionInput struct (eliminates 6 positional params of similar types) - Update module docstring to reflect four network modes + presets - Eliminate duplicated command iteration in generate_iptables_wrapper - Add clap value_parser for --network-preset validation - Add TODO for detached container credential cleanup - Wire project_dir through to prompt_save_network for .mino.toml support
Summary
Hardens container invocation without breaking agent usability. The
developeruser (UID 1000) never needs Linux capabilities, so all hardening targets root-level operations the agent shouldn't be doing.--cap-drop ALL+ selective--cap-add NET_ADMINonly for allowlist mode--security-opt no-new-privilegesprevents privilege escalation--pids-limit 4096prevents fork bombs (agent workloads fit comfortably)hosttobridge— isolates container from host services while preserving full internet accesspodman inspect--network-preset dev/registries) with built-in allowlists for GitHub, npm, crates.io, PyPI, AI APIscapsh --drop=cap_net_adminafter iptables setup in allowlist mode — agent can't flush firewall ruleslibcapadded to base Dockerfile forcapshbinaryAgent operation impact
npm install,cargo build,git push--network host)iptables -Fin allowlist modeMigration from v1.x
Network default changed
The default network mode is now
bridge(previouslyhost). Bridge still provides full internet access —npm install,cargo build,git push, AI API calls all work identically. The only difference is localhost isolation.If your workflow requires access to host
localhostservices, restore previous behavior with:Or permanently:
mino config set container.network hostCapability restrictions
All containers now run with
--cap-drop ALL. If you use custom images that require specific Linux capabilities, you may see permission errors. Allowlist mode (--network-allow,--network-preset) automatically addsCAP_NET_ADMIN.Container cleanup
Interactive sessions now remove containers after exit. Use
mino logs <session>for session history instead ofpodman logs.PID limits
Container processes are limited to 4096 PIDs. This is generous for all normal agent workloads but may affect pathological fork patterns.
Files changed (8)
src/orchestration/podman.rsContainerConfig+cap_drop,security_opt,pids_limitsrc/orchestration/native_podman.rspush_container_argswith cap-drop before cap-add orderingsrc/orchestration/orbstack_runtime.rssrc/cli/commands/run.rssrc/config/schema.rsbridge,network_presetfieldsrc/cli/args.rs--network-presetflagsrc/network.rsresolve_network_mode, capsh dropimages/base/DockerfilelibcappackageTest plan
cargo fmt -- --checkpassesmino run -- npm installsucceeds with bridge networkingmino run --network-preset dev -- curl -I https://registry.npmjs.orgsucceedsmino run --network-preset dev -- curl -I https://evil.comblockedpodman ps -ashows no stopped containermino run --network host -- curl http://localhost:8080restores host access