Skip to content

feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698

Closed

Description

@dan-petty

Ready: implementation plan (refined 2026-10-17 at 3dd7fa6)

The plan is in this comment, because the body has no room for it. It supersedes any text below that conflicts with it.


Context & Rationale

Both sandbox runners declare hardening as Docker SDK kwargs — cap_drop ALL, no-new-privileges, pids_limit 256, network_mode none (src/devops_cli/sandbox/engine.py:227-239, src/devops_cli/docker/sandbox.py:260-273); read_only and a noexec tmpfs exist only in the deploy engine (engine.py:234-235; the workload runner's read_only only sets the bind mode, docker/sandbox.py:254,264). Tests check those kwargs at three sites (tests/test_sandbox_lifecycle.py:311-315, tests/test_workload_sandbox.py:78-80,167-179), only against a mocked SDK. Nothing queries the engine: DockerEngineService (src/devops_cli/docker/engine.py:197) has no SecurityOptions accessor, and the two dry-run summaries disagree (commands/sandbox.py:183-188, docker/sandbox.py:155-172). vibes hit this failure: CISPolicyAuditor scored the policy 100.0/100, 8/8, while the engine enforced 0 of 8; the fix scored the engine about to run, named each unapplied control, and tested that the scores differ (examples/ephemeral-container-sandbox/sandbox.py:104,222-262, test_sandbox.py:206-231, observations/systems/19-self-consistency-is-not-conformance.md:27,115,132).

Scope & Deliverables

  • Context & Rationale*: Both sandbox runners declare hardening as Docker SDK kwargs — cap_drop ALL, no-new-privileges, pids_limit 256, network_mode none (src/devops_cli/sandbox/engine.py:227-239, src/devops_cli/docker/sandbox.py:260-273); read_only and a noexec tmpfs exist only in the deploy engine (engine.py:234-235; the workload runner's read_only only sets the bind mode, docker/sandbox.py:254,264). Tests check those kwargs at three sites (tests/test_sandbox_lifecycle.py:311-315, tests/test_workload_sandbox.py:78-80,167-179), only against a mocked SDK. Nothing queries the engine: DockerEngineService (src/devops_cli/docker/engine.py:197) has no SecurityOptions accessor, and the two dry-run summaries disagree (commands/sandbox.py:183-188, docker/sandbox.py:155-172). vibes hit this failure: CISPolicyAuditor scored the policy 100.0/100, 8/8, while the engine enforced 0 of 8; the fix scored the engine about to run, named each unapplied control, and tested that the scores differ (examples/ephemeral-container-sandbox/sandbox.py:104,222-262, test_sandbox.py:206-231, observations/systems/19-self-consistency-is-not-conformance.md:27,115,132).
  • Deliverable*: A devops sandbox audit command and sandbox_audit MCP tool beside sandbox_deploy (src/devops_cli/ai/mcp/server.py:1289,1336), with per-control columns DECLARED, ENGINE, ENFORCED. Three sequential PRs. PR1: DECLARED derives from the production _build_create_kwargs (sandbox/engine.py:207, docker/sandbox.py:252-273); both dry-runs read those kwargs, replacing the literal at commands/sandbox.py:183-188. ENGINE comes from a new DockerEngineService.security_options() calling client.info()['SecurityOptions'] via the docker SDK (pyproject.toml:24); an unreachable daemon reports 0 enforced plus the reason. PR2: --probe runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE (config/defaults.py:641), recording EPERM/ENOSYS/success for io_uring_setup, unshare(CLONE_NEWUSER), ptrace, mount, non-loopback connect, writes outside /tmp//workspace, forks past pids_limit; an unprobed control reads not probed, never enforced. A mocked daemon reporting profile=unconfined must lower ENFORCED with DECLARED constant. PR3: a seccomp_profile field on SandboxDeployConfig (sandbox/models.py:360) and WorkloadSandboxConfig (docker/sandbox.py:46) reading an OCI profile, rejecting a missing or SCMP_ACT_ALLOW defaultAction, passing security_opt: ["seccomp=<profile JSON>"]. Do not port vibes tools/seccomp_synthesizer.py: the engine's builtin profile is the maintained default-deny artifact (Measured); tighter profiles come from a maintained tracer (oci-seccomp-bpf-hook), audit-confirmed. The harness shell tool (ai/harness/shell.py:272, process-group isolation only) is listed enforcing no container control.
  • Constraint*: Reading kwargs and printing ENFORCED is the vibes 8/8 defect renamed; ENFORCED must come from a run against the kernel or say it did not run. Probe under the same network mode: socket() succeeded inside --network none (Measured); test egress by reachability, not syscall. PR1–PR2 land before v0.3.2's Automated Triage & Sandbox Repro Validator, the first to run issue-supplied code here; PR3 may slip to v0.3.4 if milestone load forces a cut. The user's host is rootless Podman; test ENGINE against both option sets via mocked info().
  • Measured*: Re-measured this session: docker info reported server version 29.8.1 with security options name=seccomp,profile=builtin and name=cgroupns, no rootless. grep -c 'def test_' → 37 (tests/test_sandbox_lifecycle.py) + 9 (tests/test_workload_sandbox.py). Run A, docker run --rm --pull=never --network none --cap-drop ALL --security-opt no-new-privileges:true --pids-limit 256 --read-only --tmpfs /tmp:size=64m,noexec debian:sid-slim perl -e '<syscall probe>' → io_uring_setup EPERM, unshare(CLONE_NEWUSER) EPERM, socket(AF_INET) fd 3. Run B, same plus --security-opt seccomp=unconfined → io_uring_setup fd 3, unshare 0. io_uring is closed by an engine default devops-cli neither requests, records nor checks.
  • Source*: vibes examples/ephemeral-container-sandbox/sandbox.py, examples/ephemeral-container-sandbox/syscall_filter.py, examples/ephemeral-container-sandbox/test_sandbox.py, tools/seccomp_synthesizer.py, observations/systems/19-self-consistency-is-not-conformance.md, docs/RETROSPECTIVE.md, AGENTS.md

Strategic Alignment

  • Milestone: v0.2.24 (Reactive Workstation Command Center, Interactive TUI & Unified Operations Hub)
  • Roadmap Reference: docs/ROADMAP.md

Update 2026-10-08: refinement

Both runners now take the policy's controls (sandbox/models.py:382-391; #592), so 'read_only exists only in the deploy engine' no longer holds. The workload dry run (docker/sandbox.py:146-163) still prints no controls; DECLARED comes from _build_create_kwargs in both runners. #1117 plans the same security_options() accessor; whichever lands first adds it. #798's change to the shared policy must keep noexec for the containers.

Proposed design

Problem statement

The sandbox runners declare security hardening as Docker SDK kwargs (cap_drop ALL, no-new-privileges, pids_limit 256, network_mode none), but nothing verifies what the engine actually enforces or what the kernel actually blocks. Tests check those kwargs only against a mocked SDK, the two dry-run summaries disagree, and a CISPolicyAuditor scored a policy 100/100 while the engine enforced 0 of 8 controls. This issue adds a devops sandbox audit command and sandbox_audit MCP tool that report per-control DECLARED (from production code), ENGINE (from docker info SecurityOptions), and ENFORCED (from runtime probes) columns, delivered across three sequential PRs.

Acceptance criteria

  • Criterion 1: devops sandbox audit command exists and prints a table with per-control columns DECLARED, ENGINE, and ENFORCED
    Verification: Run uv run devops sandbox audit and confirm the output contains three column headers and at least one row per declared control (cap_drop, no-new-privileges, pids_limit, network_mode, read_only, noexec tmpfs).
  • Criterion 2: sandbox_audit MCP tool is registered beside sandbox_deploy in the FastMCP server
    Verification: Run uv run devops ai mcp export-schemas (or inspect src/devops_cli/ai/mcp/server.py) and confirm sandbox_audit appears in the tool list adjacent to sandbox_deploy.
  • Criterion 3: DECLARED column derives from the production _build_create_kwargs in both runners (sandbox/engine.py and docker/sandbox.py), not from a hardcoded literal
    Verification: Unit test: patch _build_create_kwargs to return a modified kwarg set, run the audit, and assert the DECLARED column reflects the modified values. Confirm commands/sandbox.py:183-188 no longer contains a literal control list.
  • Criterion 4: Both dry-run summaries (commands/sandbox.py and docker/sandbox.py) read the same kwargs from _build_create_kwargs
    Verification: Run uv run devops sandbox deploy --dry-run and uv run devops docker sandbox --dry-run and confirm both print identical control sets derived from the same source.
  • Criterion 5: ENGINE column comes from a new DockerEngineService.security_options() method that calls client.info()['SecurityOptions'] via the docker SDK
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=builtin', 'name=cgroupns']} and assert the ENGINE column shows seccomp=builtin. Confirm the method exists on DockerEngineService in src/devops_cli/docker/engine.py.
  • Criterion 6: An unreachable daemon reports 0 enforced controls plus the reason for the failure
    Verification: Unit test: mock client.info() to raise a connection error and assert the audit output shows 0 enforced and a human-readable reason string.
  • Criterion 7: A mocked daemon reporting profile=unconfined lowers ENFORCED while DECLARED stays constant
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=unconfined']} and assert the seccomp row shows DECLARED=yes, ENGINE=unconfined, ENFORCED=no (or 0), while other DECLARED rows remain unchanged.
  • Criterion 8: --probe flag runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success for io_uring_setup, unshare(CLONE_NEWUSER), ptrace, mount, non-loopback connect, writes outside /tmp and /workspace, and forks past pids_limit
    Verification: Integration test (skipped when no daemon): run uv run devops sandbox audit --probe against a live daemon and confirm each probed control shows a concrete result (EPERM, ENOSYS, or success) rather than a placeholder.
  • Criterion 9: An unprobed control reads not probed, never enforced
    Verification: Unit test: run the audit without --probe and assert every ENFORCED cell that has no probe result reads exactly not probed.
  • Criterion 10: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reads an OCI profile, rejects a missing or SCMP_ACT_ALLOW defaultAction, and passes security_opt: ["seccomp="]
    Verification: Unit test: set seccomp_profile to a valid OCI profile JSON and assert the create kwargs include security_opt with seccomp= prefix. Set it to a profile with defaultAction: SCMP_ACT_ALLOW and assert a ValidationError is raised. Set it to a missing file and assert a ValidationError.
  • Criterion 11: The harness shell tool (ai/harness/shell.py) is listed in the audit as enforcing no container control
    Verification: Run uv run devops sandbox audit and confirm a row for the harness shell tool shows DECLARED=no, ENGINE=n/a, ENFORCED=no with a note about process-group isolation only.

Key questions

  • How many PRs does this issue split into and what does each deliver?: Three sequential PRs. PR1: devops sandbox audit command and MCP tool with DECLARED (from _build_create_kwargs) and ENGINE (from security_options()) columns, unified dry-run summaries, and the DockerEngineService.security_options() accessor. PR2: --probe flag that runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success per syscall, with unprobed controls reading not probed. PR3: seccomp_profile field on both config models reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt: ["seccomp="]. (proposed) [sources: src/devops_cli/sandbox/engine.py, src/devops_cli/docker/sandbox.py, src/devops_cli/docker/engine.py, src/devops_cli/ai/mcp/server.py]
  • What is the relationship with issue feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117, which plans the same security_options() accessor?: Whichever of feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 and feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117 lands first adds the security_options() accessor; the other reuses it. They are not strictly sequential but must coordinate on the shared method in DockerEngineService. [sources: src/devops_cli/docker/engine.py]
  • What is the relationship with issue fix(security): the host sandbox declares a noexec /tmp it never applies #798 (noexec /tmp policy)?: fix(security): the host sandbox declares a noexec /tmp it never applies #798 is already delivered (Done in v0.2.32). Its change to the shared policy must keep noexec for the containers, which the audit's DECLARED column will reflect. No further work is needed from feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 beyond reading the existing policy. [sources: docs/ROADMAP.md]
  • Should the vibes tools/seccomp_synthesizer.py be ported into devops-cli?: No. The engine's builtin seccomp profile is the maintained default-deny artifact. Tighter profiles come from a maintained tracer (oci-seccomp-bpf-hook), audit-confirmed. PR3 reads an OCI profile file rather than synthesizing one. (proposed) [sources: src/devops_cli/sandbox/models.py, src/devops_cli/docker/sandbox.py]
  • Which image does the --probe flag use?: DEFAULT_SANDBOX_IMAGE from config/defaults.py:641. [sources: src/devops_cli/config/defaults.py]
  • How is network egress tested in the probe?: By reachability, not by syscall. Measured: socket(AF_INET) succeeded inside --network none, so the probe must attempt a non-loopback connect and check whether it reaches a destination, rather than checking whether the socket() syscall itself is blocked. [sources: src/devops_cli/docker/sandbox.py]
  • What is the milestone and timing constraint?: Milestone v0.2.24 (Reactive Workstation Command Center). PR1 and PR2 must land before v0.3.2's Automated Triage & Sandbox Repro Validator, the first feature to run issue-supplied code in the sandbox. PR3 may slip to v0.3.4 if milestone load forces a cut. (proposed) [sources: docs/ROADMAP.md]
  • What is the testing environment constraint?: The user's host is rootless Podman. ENGINE must be tested against both option sets (builtin and unconfined) via mocked info() responses, not against a live daemon, to avoid coupling tests to a specific container runtime. [sources: src/devops_cli/docker/engine.py, tests/test_workload_sandbox.py]

Fit

Needs splitting into 3 items:

  1. PR1: devops sandbox audit command and sandbox_audit MCP tool with DECLARED and ENGINE columns, unified dry-run summaries reading _build_create_kwargs, and DockerEngineService.security_options() accessor
  2. PR2: --probe flag running the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE, recording EPERM/ENOSYS/success per syscall, with unprobed controls reading not probed
  3. PR3: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt: ["seccomp="]

Suspected block

None.

Dependencies

#1117
[end-marker]

Proposed design

Problem statement

The sandbox runners declare security hardening as Docker SDK kwargs (cap_drop ALL, no-new-privileges, pids_limit 256, network_mode none), but nothing verifies what the engine actually enforces or what the kernel actually blocks. Tests check those kwargs only against a mocked SDK, the two dry-run summaries disagree, and a CISPolicyAuditor scored a policy 100/100 while the engine enforced 0 of 8 controls. This issue adds a devops sandbox audit command and sandbox_audit MCP tool that report per-control DECLARED (from production code), ENGINE (from docker info SecurityOptions), and ENFORCED (from runtime probes) columns, delivered across three sequential PRs.

Acceptance criteria

  • Criterion 1: devops sandbox audit command exists and prints a table with per-control columns DECLARED, ENGINE, and ENFORCED
    Verification: Run uv run devops sandbox audit and confirm the output contains three column headers and at least one row per declared control (cap_drop, no-new-privileges, pids_limit, network_mode, read_only, noexec tmpfs).
  • Criterion 2: sandbox_audit MCP tool is registered beside sandbox_deploy in the FastMCP server
    Verification: Run uv run devops ai mcp export-schemas (or inspect src/devops_cli/ai/mcp/server.py) and confirm sandbox_audit appears in the tool list adjacent to sandbox_deploy.
  • Criterion 3: DECLARED column derives from the production _build_create_kwargs in both runners (sandbox/engine.py and docker/sandbox.py), not from a hardcoded literal
    Verification: Unit test: patch _build_create_kwargs to return a modified kwarg set, run the audit, and assert the DECLARED column reflects the modified values. Confirm commands/sandbox.py:183-188 no longer contains a literal control list.
  • Criterion 4: Both dry-run summaries (commands/sandbox.py and docker/sandbox.py) read the same kwargs from _build_create_kwargs
    Verification: Run uv run devops sandbox deploy --dry-run and uv run devops docker sandbox --dry-run and confirm both print identical control sets derived from the same source.
  • Criterion 5: ENGINE column comes from a new DockerEngineService.security_options() method that calls client.info()['SecurityOptions'] via the docker SDK
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=builtin', 'name=cgroupns']} and assert the ENGINE column shows seccomp=builtin. Confirm the method exists on DockerEngineService in src/devops_cli/docker/engine.py.
  • Criterion 6: An unreachable daemon reports 0 enforced controls plus the reason for the failure
    Verification: Unit test: mock client.info() to raise a connection error and assert the audit output shows 0 enforced and a human-readable reason string.
  • Criterion 7: A mocked daemon reporting profile=unconfined lowers ENFORCED while DECLARED stays constant
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=unconfined']} and assert the seccomp row shows DECLARED=yes, ENGINE=unconfined, ENFORCED=no (or 0), while other DECLARED rows remain unchanged.
  • Criterion 8: --probe flag runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success for io_uring_setup, unshare(CLONE_NEWUSER), ptrace, mount, non-loopback connect, writes outside /tmp and /workspace, and forks past pids_limit
    Verification: Integration test (skipped when no daemon): run uv run devops sandbox audit --probe against a live daemon and confirm each probed control shows a concrete result (EPERM, ENOSYS, or success) rather than a placeholder.
  • Criterion 9: An unprobed control reads not probed, never enforced
    Verification: Unit test: run the audit without --probe and assert every ENFORCED cell that has no probe result reads exactly not probed.
  • Criterion 10: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reads an OCI profile, rejects a missing or SCMP_ACT_ALLOW defaultAction, and passes security_opt: ["seccomp="]
    Verification: Unit test: set seccomp_profile to a valid OCI profile JSON and assert the create kwargs include security_opt with seccomp= prefix. Set it to a profile with defaultAction: SCMP_ACT_ALLOW and assert a ValidationError is raised. Set it to a missing file and assert a ValidationError.
  • Criterion 11: The harness shell tool (ai/harness/shell.py) is listed in the audit as enforcing no container control
    Verification: Run uv run devops sandbox audit and confirm a row for the harness shell tool shows DECLARED=no, ENGINE=n/a, ENFORCED=no with a note about process-group isolation only.

Key questions

  • How many PRs does this issue split into and what does each deliver?: Three sequential PRs. PR1: devops sandbox audit command and MCP tool with DECLARED (from _build_create_kwargs) and ENGINE (from security_options()) columns, unified dry-run summaries, and the DockerEngineService.security_options() accessor. PR2: --probe flag that runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success per syscall, with unprobed controls reading not probed. PR3: seccomp_profile field on both config models reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt: ["seccomp="]. (proposed) [sources: src/devops_cli/sandbox/engine.py, src/devops_cli/docker/sandbox.py, src/devops_cli/docker/engine.py, src/devops_cli/ai/mcp/server.py]
  • What is the relationship with issue feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117, which plans the same security_options() accessor?: Whichever of feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 and feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117 lands first adds the security_options() accessor; the other reuses it. They are not strictly sequential but must coordinate on the shared method in DockerEngineService. (proposed) [sources: src/devops_cli/docker/engine.py]
  • What is the relationship with issue fix(security): the host sandbox declares a noexec /tmp it never applies #798 (noexec /tmp policy)?: fix(security): the host sandbox declares a noexec /tmp it never applies #798 is already delivered (Done in v0.2.32). Its change to the shared policy must keep noexec for the containers, which the audit's DECLARED column will reflect. No further work is needed from feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 beyond reading the existing policy. [sources: docs/ROADMAP.md]
  • Should the vibes tools/seccomp_synthesizer.py be ported into devops-cli?: No. The engine's builtin seccomp profile is the maintained default-deny artifact. Tighter profiles come from a maintained tracer (oci-seccomp-bpf-hook), audit-confirmed. PR3 reads an OCI profile file rather than synthesizing one. (proposed) [sources: src/devops_cli/sandbox/models.py, src/devops_cli/docker/sandbox.py]
  • Which image does the --probe flag use?: DEFAULT_SANDBOX_IMAGE from config/defaults.py:641. [sources: src/devops_cli/config/defaults.py]
  • How is network egress tested in the probe?: By reachability, not by syscall. Measured: socket(AF_INET) succeeded inside --network none, so the probe must attempt a non-loopback connect and check whether it reaches a destination, rather than checking whether the socket() syscall itself is blocked. (proposed) [sources: src/devops_cli/docker/sandbox.py]
  • What is the milestone and timing constraint?: Milestone v0.2.34 (per the generated roadmap). PR1 and PR2 must land before v0.3.2's Automated Triage & Sandbox Repro Validator, the first feature to run issue-supplied code in the sandbox. PR3 may slip to v0.3.4 if milestone load forces a cut. [sources: docs/ROADMAP.md]
  • What is the testing environment constraint?: The user's host is rootless Podman. ENGINE must be tested against both option sets (builtin and unconfined) via mocked info() responses, not against a live daemon, to avoid coupling tests to a specific container runtime. [sources: src/devops_cli/docker/engine.py, tests/test_workload_sandbox.py]

Fit

Needs splitting into 3 items:

  1. PR1: devops sandbox audit command and sandbox_audit MCP tool with DECLARED and ENGINE columns, unified dry-run summaries reading _build_create_kwargs, and DockerEngineService.security_options() accessor
  2. PR2: --probe flag running the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE, recording EPERM/ENOSYS/success per syscall, with unprobed controls reading not probed
  3. PR3: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt: ["seccomp="]

Suspected block

None.

Dependencies

#1117
[end-marker]

Proposed design

Problem statement

The sandbox runners declare security hardening as Docker SDK kwargs (cap_drop ALL, no-new-privileges, pids_limit 256, network_mode none), but nothing verifies what the engine actually enforces or what the kernel actually blocks. Tests check those kwargs only against a mocked SDK, the two dry-run summaries disagree, and a CISPolicyAuditor scored a policy 100/100 while the engine enforced 0 of 8 controls. This issue adds a devops sandbox audit command and sandbox_audit MCP tool that report per-control DECLARED (from production code), ENGINE (from docker info SecurityOptions), and ENFORCED (from runtime probes) columns, delivered across three sequential PRs.

Acceptance criteria

  • Criterion 1: devops sandbox audit command exists and prints a table with per-control columns DECLARED, ENGINE, and ENFORCED
    Verification: Run uv run devops sandbox audit and confirm the output contains three column headers and at least one row per declared control (cap_drop, no-new-privileges, pids_limit, network_mode, read_only, noexec tmpfs).
  • Criterion 2: sandbox_audit MCP tool is registered beside sandbox_deploy in the FastMCP server
    Verification: Run uv run devops ai mcp export-schemas (or inspect src/devops_cli/ai/mcp/server.py) and confirm sandbox_audit appears in the tool list adjacent to sandbox_deploy.
  • Criterion 3: DECLARED column derives from the production _build_create_kwargs in both runners, not from a hardcoded literal
    Verification: Unit test: patch _build_create_kwargs to return a modified kwarg set, run the audit, and assert the DECLARED column reflects the modified values. Confirm commands/sandbox.py no longer contains a literal control list.
  • Criterion 4: Both dry-run summaries (commands/sandbox.py and docker/sandbox.py) read the same kwargs from _build_create_kwargs
    Verification: Run uv run devops sandbox deploy --dry-run and uv run devops docker sandbox --dry-run and confirm both print identical control sets derived from the same source.
  • Criterion 5: ENGINE column comes from a new DockerEngineService.security_options() method that calls client.info()['SecurityOptions'] via the docker SDK
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=builtin', 'name=cgroupns']} and assert the ENGINE column shows seccomp=builtin. Confirm the method exists on DockerEngineService in src/devops_cli/docker/engine.py.
  • Criterion 6: An unreachable daemon reports 0 enforced controls plus the reason for the failure
    Verification: Unit test: mock client.info() to raise a connection error and assert the audit output shows 0 enforced and a human-readable reason string.
  • Criterion 7: A mocked daemon reporting profile=unconfined lowers ENFORCED while DECLARED stays constant
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=unconfined']} and assert the seccomp row shows DECLARED=yes, ENGINE=unconfined, ENFORCED=no, while other DECLARED rows remain unchanged.
  • Criterion 8: --probe flag runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success for io_uring_setup, unshare(CLONE_NEWUSER), ptrace, mount, non-loopback connect, writes outside /tmp and /workspace, and forks past pids_limit
    Verification: Integration test (skipped when no daemon): run uv run devops sandbox audit --probe against a live daemon and confirm each probed control shows a concrete result (EPERM, ENOSYS, or success) rather than a placeholder.
  • Criterion 9: An unprobed control reads 'not probed', never 'enforced'
    Verification: Unit test: run the audit without --probe and assert every ENFORCED cell that has no probe result reads exactly 'not probed'.
  • Criterion 10: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reads an OCI profile, rejects a missing or SCMP_ACT_ALLOW defaultAction, and passes security_opt with seccomp= prefix
    Verification: Unit test: set seccomp_profile to a valid OCI profile JSON and assert the create kwargs include security_opt with seccomp= prefix. Set it to a profile with defaultAction SCMP_ACT_ALLOW and assert a ValidationError is raised. Set it to a missing file and assert a ValidationError.
  • Criterion 11: The harness shell tool (ai/harness/shell.py) is listed in the audit as enforcing no container control
    Verification: Run uv run devops sandbox audit and confirm a row for the harness shell tool shows DECLARED=no, ENGINE=n/a, ENFORCED=no with a note about process-group isolation only.

Key questions

  • How many PRs does this issue split into and what does each deliver?: Three sequential PRs. PR1: devops sandbox audit command and MCP tool with DECLARED (from _build_create_kwargs) and ENGINE (from security_options()) columns, unified dry-run summaries, and the DockerEngineService.security_options() accessor. PR2: --probe flag that runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success per syscall, with unprobed controls reading 'not probed'. PR3: seccomp_profile field on both config models reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt with seccomp= prefix. (proposed) [sources: src/devops_cli/sandbox/engine.py, src/devops_cli/docker/sandbox.py, src/devops_cli/docker/engine.py, src/devops_cli/ai/mcp/server.py]
  • What is the relationship with issue feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117, which plans the same security_options() accessor?: Whichever of feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 and feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117 lands first adds the security_options() accessor; the other reuses it. They are not strictly sequential but must coordinate on the shared method in DockerEngineService. (proposed) [sources: src/devops_cli/docker/engine.py]
  • What is the relationship with issue fix(security): the host sandbox declares a noexec /tmp it never applies #798 (noexec /tmp policy)?: fix(security): the host sandbox declares a noexec /tmp it never applies #798 is already delivered (Done in v0.2.32). Its change to the shared policy must keep noexec for the containers, which the audit's DECLARED column will reflect. No further work is needed from feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 beyond reading the existing policy. [sources: docs/ROADMAP.md]
  • Should the vibes tools/seccomp_synthesizer.py be ported into devops-cli?: No. The engine's builtin seccomp profile is the maintained default-deny artifact. Tighter profiles come from a maintained tracer (oci-seccomp-bpf-hook), audit-confirmed. PR3 reads an OCI profile file rather than synthesizing one. (proposed) [sources: src/devops_cli/sandbox/models.py, src/devops_cli/docker/sandbox.py]
  • Which image does the --probe flag use?: DEFAULT_SANDBOX_IMAGE from config/defaults.py:641. [sources: src/devops_cli/config/defaults.py]
  • How is network egress tested in the probe?: By reachability, not by syscall. Measured: socket(AF_INET) succeeded inside --network none, so the probe must attempt a non-loopback connect and check whether it reaches a destination, rather than checking whether the socket() syscall itself is blocked. (proposed) [sources: src/devops_cli/docker/sandbox.py]
  • What is the milestone and timing constraint?: Milestone v0.2.34 (per the generated roadmap). PR1 and PR2 must land before v0.3.2's Automated Triage & Sandbox Repro Validator, the first feature to run issue-supplied code in the sandbox. PR3 may slip to v0.3.4 if milestone load forces a cut. [sources: docs/ROADMAP.md]
  • What is the testing environment constraint?: The user's host is rootless Podman. ENGINE must be tested against both option sets (builtin and unconfined) via mocked info() responses, not against a live daemon, to avoid coupling tests to a specific container runtime. (proposed) [sources: src/devops_cli/docker/engine.py, tests/test_workload_sandbox.py]

Fit

Needs splitting into 3 items:

  1. PR1: devops sandbox audit command and sandbox_audit MCP tool with DECLARED and ENGINE columns, unified dry-run summaries reading _build_create_kwargs, and DockerEngineService.security_options() accessor
  2. PR2: --probe flag running the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE, recording EPERM/ENOSYS/success per syscall, with unprobed controls reading 'not probed'
  3. PR3: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt with seccomp= prefix

Suspected block

None.

Dependencies

#1117
[end-marker]

Proposed design

Problem statement

The sandbox runners declare security hardening as Docker SDK kwargs (cap_drop ALL, no-new-privileges, pids_limit 256, network_mode none), but nothing verifies what the engine actually enforces or what the kernel actually blocks. Tests check those kwargs only against a mocked SDK, the two dry-run summaries disagree, and a CISPolicyAuditor scored a policy 100/100 while the engine enforced 0 of 8 controls. This issue adds a devops sandbox audit command and sandbox_audit MCP tool that report per-control DECLARED (from production code), ENGINE (from docker info SecurityOptions), and ENFORCED (from runtime probes) columns, delivered across three sequential PRs.

Acceptance criteria

  • Criterion 1: devops sandbox audit command exists and prints a table with per-control columns DECLARED, ENGINE, and ENFORCED
    Verification: Run uv run devops sandbox audit and confirm the output contains three column headers and at least one row per declared control (cap_drop, no-new-privileges, pids_limit, network_mode, read_only, noexec tmpfs).
  • Criterion 2: sandbox_audit MCP tool is registered beside sandbox_deploy in the FastMCP server
    Verification: Run uv run devops ai mcp export-schemas (or inspect src/devops_cli/ai/mcp/server.py) and confirm sandbox_audit appears in the tool list adjacent to sandbox_deploy.
  • Criterion 3: DECLARED column derives from the production _build_create_kwargs in both runners, not from a hardcoded literal
    Verification: Unit test: patch _build_create_kwargs to return a modified kwarg set, run the audit, and assert the DECLARED column reflects the modified values. Confirm commands/sandbox.py no longer contains a literal control list.
  • Criterion 4: Both dry-run summaries (commands/sandbox.py and docker/sandbox.py) read the same kwargs from _build_create_kwargs
    Verification: Run uv run devops sandbox deploy --dry-run and uv run devops docker sandbox --dry-run and confirm both print identical control sets derived from the same source.
  • Criterion 5: ENGINE column comes from a new DockerEngineService.security_options() method that calls client.info()['SecurityOptions'] via the docker SDK
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=builtin', 'name=cgroupns']} and assert the ENGINE column shows seccomp=builtin. Confirm the method exists on DockerEngineService in src/devops_cli/docker/engine.py.
  • Criterion 6: An unreachable daemon reports 0 enforced controls plus the reason for the failure
    Verification: Unit test: mock client.info() to raise a connection error and assert the audit output shows 0 enforced and a human-readable reason string.
  • Criterion 7: A mocked daemon reporting profile=unconfined lowers ENFORCED while DECLARED stays constant
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=unconfined']} and assert the seccomp row shows DECLARED=yes, ENGINE=unconfined, ENFORCED=no, while other DECLARED rows remain unchanged.
  • Criterion 8: --probe flag runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success for io_uring_setup, unshare(CLONE_NEWUSER), ptrace, mount, non-loopback connect, writes outside /tmp and /workspace, and forks past pids_limit
    Verification: Integration test (skipped when no daemon): run uv run devops sandbox audit --probe against a live daemon and confirm each probed control shows a concrete result (EPERM, ENOSYS, or success) rather than a placeholder.
  • Criterion 9: An unprobed control reads 'not probed', never 'enforced'
    Verification: Unit test: run the audit without --probe and assert every ENFORCED cell that has no probe result reads exactly 'not probed'.
  • Criterion 10: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reads an OCI profile, rejects a missing or SCMP_ACT_ALLOW defaultAction, and passes security_opt with seccomp= prefix
    Verification: Unit test: set seccomp_profile to a valid OCI profile JSON and assert the create kwargs include security_opt with seccomp= prefix. Set it to a profile with defaultAction SCMP_ACT_ALLOW and assert a ValidationError is raised. Set it to a missing file and assert a ValidationError.
  • Criterion 11: The harness shell tool (ai/harness/shell.py) is listed in the audit as enforcing no container control
    Verification: Run uv run devops sandbox audit and confirm a row for the harness shell tool shows DECLARED=no, ENGINE=n/a, ENFORCED=no with a note about process-group isolation only.

Key questions

  • How many PRs does this issue split into and what does each deliver?: Three sequential PRs. PR1: devops sandbox audit command and MCP tool with DECLARED (from _build_create_kwargs) and ENGINE (from security_options()) columns, unified dry-run summaries, and the DockerEngineService.security_options() accessor. PR2: --probe flag that runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success per syscall, with unprobed controls reading 'not probed'. PR3: seccomp_profile field on both config models reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt with seccomp= prefix. (proposed) [sources: src/devops_cli/sandbox/engine.py, src/devops_cli/docker/sandbox.py, src/devops_cli/docker/engine.py, src/devops_cli/ai/mcp/server.py]
  • What is the relationship with issue feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117, which plans the same security_options() accessor?: Whichever of feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 and feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117 lands first adds the security_options() accessor; the other reuses it. They are not strictly sequential but must coordinate on the shared method in DockerEngineService. (proposed) [sources: src/devops_cli/docker/engine.py]
  • What is the relationship with issue fix(security): the host sandbox declares a noexec /tmp it never applies #798 (noexec /tmp policy)?: fix(security): the host sandbox declares a noexec /tmp it never applies #798 is already delivered (Done in v0.2.32). Its change to the shared policy must keep noexec for the containers, which the audit's DECLARED column will reflect. No further work is needed from feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 beyond reading the existing policy. [sources: docs/ROADMAP.md]
  • Should the vibes tools/seccomp_synthesizer.py be ported into devops-cli?: No. The engine's builtin seccomp profile is the maintained default-deny artifact. Tighter profiles come from a maintained tracer (oci-seccomp-bpf-hook), audit-confirmed. PR3 reads an OCI profile file rather than synthesizing one. (proposed) [sources: src/devops_cli/sandbox/models.py, src/devops_cli/docker/sandbox.py]
  • Which image does the --probe flag use?: DEFAULT_SANDBOX_IMAGE from config/defaults.py:641. [sources: src/devops_cli/config/defaults.py]
  • How is network egress tested in the probe?: By reachability, not by syscall. Measured: socket(AF_INET) succeeded inside --network none, so the probe must attempt a non-loopback connect and check whether it reaches a destination, rather than checking whether the socket() syscall itself is blocked. (proposed) [sources: src/devops_cli/docker/sandbox.py]
  • What is the milestone and timing constraint?: Milestone v0.2.34 (per the generated roadmap). PR1 and PR2 must land before v0.3.2's Automated Triage & Sandbox Repro Validator, the first feature to run issue-supplied code in the sandbox. PR3 may slip to v0.3.4 if milestone load forces a cut. [sources: docs/ROADMAP.md]
  • What is the testing environment constraint?: The user's host is rootless Podman. ENGINE must be tested against both option sets (builtin and unconfined) via mocked info() responses, not against a live daemon, to avoid coupling tests to a specific container runtime. [sources: src/devops_cli/docker/engine.py, tests/test_workload_sandbox.py]

Fit

Needs splitting into 3 items:

  1. PR1: devops sandbox audit command and sandbox_audit MCP tool with DECLARED and ENGINE columns, unified dry-run summaries reading _build_create_kwargs, and DockerEngineService.security_options() accessor
  2. PR2: --probe flag running the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE, recording EPERM/ENOSYS/success per syscall, with unprobed controls reading 'not probed'
  3. PR3: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt with seccomp= prefix

Suspected block

None.

Dependencies

#1117
[end-marker]

Proposed design

Problem statement

The sandbox runners declare security hardening as Docker SDK kwargs (cap_drop ALL, no-new-privileges, pids_limit 256, network_mode none), but nothing verifies what the engine actually enforces or what the kernel actually blocks. Tests check those kwargs only against a mocked SDK, the two dry-run summaries disagree, and a CISPolicyAuditor scored a policy 100/100 while the engine enforced 0 of 8 controls. This issue adds a devops sandbox audit command and sandbox_audit MCP tool that report per-control DECLARED (from production code), ENGINE (from docker info SecurityOptions), and ENFORCED (from runtime probes) columns, delivered across three sequential PRs.

Acceptance criteria

  • Criterion 1: devops sandbox audit command exists and prints a table with per-control columns DECLARED, ENGINE, and ENFORCED
    Verification: Run uv run devops sandbox audit and confirm the output contains three column headers and at least one row per declared control (cap_drop, no-new-privileges, pids_limit, network_mode, read_only, noexec tmpfs).
  • Criterion 2: sandbox_audit MCP tool is registered beside sandbox_deploy in the FastMCP server
    Verification: Run uv run devops ai mcp export-schemas (or inspect src/devops_cli/ai/mcp/server.py) and confirm sandbox_audit appears in the tool list adjacent to sandbox_deploy.
  • Criterion 3: DECLARED column derives from the production _build_create_kwargs in both runners, not from a hardcoded literal
    Verification: Unit test: patch _build_create_kwargs to return a modified kwarg set, run the audit, and assert the DECLARED column reflects the modified values. Confirm commands/sandbox.py no longer contains a literal control list.
  • Criterion 4: Both dry-run summaries (commands/sandbox.py and docker/sandbox.py) read the same kwargs from _build_create_kwargs
    Verification: Run uv run devops sandbox deploy --dry-run and uv run devops docker sandbox --dry-run and confirm both print identical control sets derived from the same source.
  • Criterion 5: ENGINE column comes from a new DockerEngineService.security_options() method that calls client.info()['SecurityOptions'] via the docker SDK
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=builtin', 'name=cgroupns']} and assert the ENGINE column shows seccomp=builtin. Confirm the method exists on DockerEngineService in src/devops_cli/docker/engine.py.
  • Criterion 6: An unreachable daemon reports 0 enforced controls plus the reason for the failure
    Verification: Unit test: mock client.info() to raise a connection error and assert the audit output shows 0 enforced and a human-readable reason string.
  • Criterion 7: A mocked daemon reporting profile=unconfined lowers ENFORCED while DECLARED stays constant
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=unconfined']} and assert the seccomp row shows DECLARED=yes, ENGINE=unconfined, ENFORCED=no, while other DECLARED rows remain unchanged.
  • Criterion 8: --probe flag runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success for io_uring_setup, unshare(CLONE_NEWUSER), ptrace, mount, non-loopback connect, writes outside /tmp and /workspace, and forks past pids_limit
    Verification: Integration test (skipped when no daemon): run uv run devops sandbox audit --probe against a live daemon and confirm each probed control shows a concrete result (EPERM, ENOSYS, or success) rather than a placeholder.
  • Criterion 9: An unprobed control reads 'not probed', never 'enforced'
    Verification: Unit test: run the audit without --probe and assert every ENFORCED cell that has no probe result reads exactly 'not probed'.
  • Criterion 10: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reads an OCI profile, rejects a missing or SCMP_ACT_ALLOW defaultAction, and passes security_opt with seccomp= prefix
    Verification: Unit test: set seccomp_profile to a valid OCI profile JSON and assert the create kwargs include security_opt with seccomp= prefix. Set it to a profile with defaultAction SCMP_ACT_ALLOW and assert a ValidationError is raised. Set it to a missing file and assert a ValidationError.
  • Criterion 11: The harness shell tool (ai/harness/shell.py) is listed in the audit as enforcing no container control
    Verification: Run uv run devops sandbox audit and confirm a row for the harness shell tool shows DECLARED=no, ENGINE=n/a, ENFORCED=no with a note about process-group isolation only.

Key questions

  • How many PRs does this issue split into and what does each deliver?: Three sequential PRs. PR1: devops sandbox audit command and MCP tool with DECLARED (from _build_create_kwargs) and ENGINE (from security_options()) columns, unified dry-run summaries, and the DockerEngineService.security_options() accessor. PR2: --probe flag that runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success per syscall, with unprobed controls reading 'not probed'. PR3: seccomp_profile field on both config models reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt with seccomp= prefix. (proposed) [sources: src/devops_cli/sandbox/engine.py, src/devops_cli/docker/sandbox.py, src/devops_cli/docker/engine.py, src/devops_cli/ai/mcp/server.py]
  • What is the relationship with issue feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117, which plans the same security_options() accessor?: Whichever of feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 and feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117 lands first adds the security_options() accessor; the other reuses it. They are not strictly sequential but must coordinate on the shared method in DockerEngineService. (proposed) [sources: src/devops_cli/docker/engine.py]
  • What is the relationship with issue fix(security): the host sandbox declares a noexec /tmp it never applies #798 (noexec /tmp policy)?: fix(security): the host sandbox declares a noexec /tmp it never applies #798 is already delivered (Done in v0.2.32). Its change to the shared policy must keep noexec for the containers, which the audit's DECLARED column will reflect. No further work is needed from feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 beyond reading the existing policy. [sources: docs/ROADMAP.md]
  • Should the vibes tools/seccomp_synthesizer.py be ported into devops-cli?: No. The engine's builtin seccomp profile is the maintained default-deny artifact. Tighter profiles come from a maintained tracer (oci-seccomp-bpf-hook), audit-confirmed. PR3 reads an OCI profile file rather than synthesizing one. (proposed) [sources: src/devops_cli/sandbox/models.py, src/devops_cli/docker/sandbox.py]
  • Which image does the --probe flag use?: DEFAULT_SANDBOX_IMAGE from config/defaults.py:641. [sources: src/devops_cli/config/defaults.py]
  • How is network egress tested in the probe?: By reachability, not by syscall. Measured: socket(AF_INET) succeeded inside --network none, so the probe must attempt a non-loopback connect and check whether it reaches a destination, rather than checking whether the socket() syscall itself is blocked. (proposed) [sources: src/devops_cli/docker/sandbox.py]
  • What is the milestone and timing constraint?: Milestone v0.2.34 (per the generated roadmap). PR1 and PR2 must land before v0.3.2's Automated Triage & Sandbox Repro Validator, the first feature to run issue-supplied code in the sandbox. PR3 may slip to v0.3.4 if milestone load forces a cut. [sources: docs/ROADMAP.md]
  • What is the testing environment constraint?: The user's host is rootless Podman. ENGINE must be tested against both option sets (builtin and unconfined) via mocked info() responses, not against a live daemon, to avoid coupling tests to a specific container runtime. (proposed) [sources: src/devops_cli/docker/engine.py, tests/test_workload_sandbox.py]

Fit

Needs splitting into 3 items:

  1. PR1: devops sandbox audit command and sandbox_audit MCP tool with DECLARED and ENGINE columns, unified dry-run summaries reading _build_create_kwargs, and DockerEngineService.security_options() accessor
  2. PR2: --probe flag running the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE, recording EPERM/ENOSYS/success per syscall, with unprobed controls reading 'not probed'
  3. PR3: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt with seccomp= prefix

Suspected block

None.

Dependencies

#1117
[end-marker]

Proposed design

Problem statement

The sandbox runners declare security hardening as Docker SDK kwargs (cap_drop ALL, no-new-privileges, pids_limit 256, network_mode none), but nothing verifies what the engine actually enforces or what the kernel actually blocks. Tests check those kwargs only against a mocked SDK, the two dry-run summaries disagree, and a CISPolicyAuditor scored a policy 100/100 while the engine enforced 0 of 8 controls. This issue adds a devops sandbox audit command and sandbox_audit MCP tool that report per-control DECLARED (from production code), ENGINE (from docker info SecurityOptions), and ENFORCED (from runtime probes) columns, delivered across three sequential PRs.

Acceptance criteria

  • Criterion 1: devops sandbox audit command exists and prints a table with per-control columns DECLARED, ENGINE, and ENFORCED
    Verification: Run uv run devops sandbox audit and confirm the output contains three column headers and at least one row per declared control (cap_drop, no-new-privileges, pids_limit, network_mode, read_only, noexec tmpfs).
  • Criterion 2: sandbox_audit MCP tool is registered beside sandbox_deploy in the FastMCP server
    Verification: Run uv run devops ai mcp export-schemas (or inspect src/devops_cli/ai/mcp/server.py) and confirm sandbox_audit appears in the tool list adjacent to sandbox_deploy.
  • Criterion 3: DECLARED column derives from the production _build_create_kwargs in both runners (sandbox/engine.py and docker/sandbox.py), not from a hardcoded literal
    Verification: Unit test: patch _build_create_kwargs to return a modified kwarg set, run the audit, and assert the DECLARED column reflects the modified values. Confirm commands/sandbox.py no longer contains a literal control list.
  • Criterion 4: Both dry-run summaries (commands/sandbox.py and docker/sandbox.py) read the same kwargs from _build_create_kwargs
    Verification: Run uv run devops sandbox deploy --dry-run and uv run devops docker sandbox --dry-run and confirm both print identical control sets derived from the same source.
  • Criterion 5: ENGINE column comes from a new DockerEngineService.security_options() method that calls client.info()['SecurityOptions'] via the docker SDK
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=builtin', 'name=cgroupns']} and assert the ENGINE column shows seccomp=builtin. Confirm the method exists on DockerEngineService in src/devops_cli/docker/engine.py.
  • Criterion 6: An unreachable daemon reports 0 enforced controls plus the reason for the failure
    Verification: Unit test: mock client.info() to raise a connection error and assert the audit output shows 0 enforced and a human-readable reason string.
  • Criterion 7: A mocked daemon reporting profile=unconfined lowers ENFORCED while DECLARED stays constant
    Verification: Unit test: mock client.info() to return {'SecurityOptions': ['name=seccomp,profile=unconfined']} and assert the seccomp row shows DECLARED=yes, ENGINE=unconfined, ENFORCED=no, while other DECLARED rows remain unchanged.
  • Criterion 8: --probe flag runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success for io_uring_setup, unshare(CLONE_NEWUSER), ptrace, mount, non-loopback connect, writes outside /tmp and /workspace, and forks past pids_limit
    Verification: Integration test (skipped when no daemon): run uv run devops sandbox audit --probe against a live daemon and confirm each probed control shows a concrete result (EPERM, ENOSYS, or success) rather than a placeholder.
  • Criterion 9: An unprobed control reads 'not probed', never 'enforced'
    Verification: Unit test: run the audit without --probe and assert every ENFORCED cell that has no probe result reads exactly 'not probed'.
  • Criterion 10: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reads an OCI profile, rejects a missing or SCMP_ACT_ALLOW defaultAction, and passes security_opt with seccomp= prefix
    Verification: Unit test: set seccomp_profile to a valid OCI profile JSON and assert the create kwargs include security_opt with seccomp= prefix. Set it to a profile with defaultAction SCMP_ACT_ALLOW and assert a ValidationError is raised. Set it to a missing file and assert a ValidationError.
  • Criterion 11: The harness shell tool (ai/harness/shell.py) is listed in the audit as enforcing no container control
    Verification: Run uv run devops sandbox audit and confirm a row for the harness shell tool shows DECLARED=no, ENGINE=n/a, ENFORCED=no with a note about process-group isolation only.

Key questions

  • How many PRs does this issue split into and what does each deliver?: Three sequential PRs. PR1: devops sandbox audit command and MCP tool with DECLARED (from _build_create_kwargs) and ENGINE (from security_options()) columns, unified dry-run summaries, and the DockerEngineService.security_options() accessor. PR2: --probe flag that runs the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE and records EPERM/ENOSYS/success per syscall, with unprobed controls reading 'not probed'. PR3: seccomp_profile field on both config models reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt with seccomp= prefix. (proposed) [sources: src/devops_cli/sandbox/engine.py, src/devops_cli/docker/sandbox.py, src/devops_cli/docker/engine.py, src/devops_cli/ai/mcp/server.py]
  • What is the relationship with issue feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117, which plans the same security_options() accessor?: Whichever of feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 and feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117 lands first adds the security_options() accessor; the other reuses it. They are not strictly sequential but must coordinate on the shared method in DockerEngineService. (proposed) [sources: src/devops_cli/docker/engine.py]
  • What is the relationship with issue fix(security): the host sandbox declares a noexec /tmp it never applies #798 (noexec /tmp policy)?: fix(security): the host sandbox declares a noexec /tmp it never applies #798 is already delivered (Done in v0.2.32). Its change to the shared policy must keep noexec for the containers, which the audit's DECLARED column will reflect. No further work is needed from feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 beyond reading the existing policy. [sources: docs/ROADMAP.md]
  • Should the vibes tools/seccomp_synthesizer.py be ported into devops-cli?: No. The engine's builtin seccomp profile is the maintained default-deny artifact. Tighter profiles come from a maintained tracer (oci-seccomp-bpf-hook), audit-confirmed. PR3 reads an OCI profile file rather than synthesizing one. (proposed) [sources: src/devops_cli/sandbox/models.py, src/devops_cli/docker/sandbox.py]
  • Which image does the --probe flag use?: DEFAULT_SANDBOX_IMAGE from config/defaults.py:641. [sources: src/devops_cli/config/defaults.py]
  • How is network egress tested in the probe?: By reachability, not by syscall. Measured: socket(AF_INET) succeeded inside --network none, so the probe must attempt a non-loopback connect and check whether it reaches a destination, rather than checking whether the socket() syscall itself is blocked. (proposed) [sources: src/devops_cli/docker/sandbox.py]
  • What is the milestone and timing constraint?: Milestone v0.2.34 (per the generated roadmap). PR1 and PR2 must land before v0.3.2's Automated Triage & Sandbox Repro Validator, the first feature to run issue-supplied code in the sandbox. PR3 may slip to v0.3.4 if milestone load forces a cut. [sources: docs/ROADMAP.md]
  • What is the testing environment constraint?: The user's host is rootless Podman. ENGINE must be tested against both option sets (builtin and unconfined) via mocked info() responses, not against a live daemon, to avoid coupling tests to a specific container runtime. (proposed) [sources: src/devops_cli/docker/engine.py, tests/test_workload_sandbox.py]

Fit

Needs splitting into 3 items:

  1. PR1: devops sandbox audit command and sandbox_audit MCP tool with DECLARED and ENGINE columns, unified dry-run summaries reading _build_create_kwargs, and DockerEngineService.security_options() accessor
  2. PR2: --probe flag running the runner's identical kwargs on DEFAULT_SANDBOX_IMAGE, recording EPERM/ENOSYS/success per syscall, with unprobed controls reading 'not probed'
  3. PR3: seccomp_profile field on SandboxDeployConfig and WorkloadSandboxConfig reading an OCI profile, rejecting SCMP_ACT_ALLOW defaultAction, passing security_opt with seccomp= prefix

Suspected block

None.

Dependencies

#1117
[end-marker]

Reopened on 2026-10-23 after an early close

devops roadmap close closed this issue on 2026-10-22 after the first part (#1831). The text of that pull request held the words "the pull request that" followed by a closing keyword and this issue number, and the parser read the sentence as a closing link. The pull request itself said Part of. The closing was wrong, because the first part builds only the data sources.

Delivered in v0.2.39 (#1831):

  • DockerEngineService.security_info() returns the security facts of the daemon, and the error of an unreachable daemon is no longer cached as an empty list.
  • Each runner declares its controls without an engine call, and the two dry runs print the same data.

Not delivered. These parts stay open and carry no milestone until the roadmap jobs place them:

  1. devops sandbox audit and the sandbox_audit MCP tool, with the columns DECLARED, ENGINE and ENFORCED.
  2. The --probe flag, which runs the identical kwargs on the default sandbox image and reads not probed for anything unproven.
  3. The seccomp profile PR. The owner dropped it from v0.2.39 into a follow-up issue.

The pull request that finishes this issue adds changelog.d/698.md.

Activity

  1. added this to the v0.2.24 milestone on Sep 28, 2026
  2. added
    type/feature
    scope/cli
    priority/p1-high
    on Sep 28, 2026
  3. modified the milestones: v0.2.24, v0.2.25, v0.2.26 on Sep 30, 2026
  4. dan-petty commented on Sep 30, 2026

    @dan-petty
    OwnerAuthor

    Moved from v0.2.25 to v0.2.26. v0.2.25 is capped at 12 items (#740): it keeps #739-#742, their dependency #704, and the oldest P1 items. This P1 item is next in line.

  5. removed this from the v0.2.26 milestone on Oct 1, 2026
  6. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Moved from v0.2.26 to the backlog. After the v0.2.23 P1 leftovers were retargeted (they were committed earlier), v0.2.25 and v0.2.26 are full at 12 items each, and the roadmap-service items placed in v0.2.26 stay. It is next in line for a planned release.

  7. added
    scope/security
    on Oct 2, 2026
  8. added this to the v0.2.34 milestone on Oct 9, 2026
  9. 18 remaining items

  10. dan-petty commented on Oct 17, 2026

    @dan-petty
    OwnerAuthor

    Ready: implementation plan (refined 2026-10-17 at 3dd7fa6)

    This section supersedes any text below that conflicts with it.

    Decisions

    • Criteria 7 and 9 (ENFORCED without --probe): ENFORCED reads yes only from a probe result. It reads no from a probe, or without a probe from a definite negative: the engine reports profile=unconfined for seccomp, the engine reports PidsLimit: false, or the runner has no way to apply the control. Everything else reads not probed: <reason>, so a positive engine answer such as profile=builtin still reads not probed: run with --probe. A negative needs no kernel run to be true, and a positive one is the vibes 8/8 defect if printed as yes.
    • Where ENGINE comes from: one cached info() call. SecurityOptions feeds the seccomp row and an informational rootless row, and PidsLimit feeds the pids row; a key the engine omits (Podman's compat API may omit some) reads not reported, which is not a negative. These are the only engine facts that bear on the declared controls.
    • The swallowed error in security_options(): a new DockerEngineService.security_info() returns a frozen model with the options, PidsLimit and an error string (bounded to 256 characters). It never raises, caches a success for the normal TTL and a failure for 2 s, as ping() does. security_options() and is_rootless() read it, so one call backs all three. The audit needs the reason; the other callers keep their behaviour.
    • Side effects in _build_create_kwargs: each runner gets a pure declared_controls(): no engine call, no _ensure_internal_network(), no trace injection. _build_create_kwargs starts from it, and deploy() and run() perform the side effects afterwards. The user string (which asks the engine whether it is rootless) stays out of the declared controls. The audit and the dry-runs must not touch the engine (tests/test_sandbox_lifecycle.py:524 already pins that for the deploy dry-run).
    • What the audit audits: the default configuration of each runner (isolated network, DEFAULT_SANDBOX_POLICY), so a whitelist without a proxy never reaches the builder. There are no flags besides --probe and --json. Auditing user configs can come later; every sandbox command starts from these defaults.
    • Rows: per runner, one row each for cap_drop ALL, no-new-privileges, seccomp, pids_limit, read-only root, /tmp noexec, network isolation and read-only workspace mount. A control with no meaning for a runner is left out rather than shown as n/a.
    • The host bubblewrap sandbox (src/devops_cli/sandbox/host.py) gets its own rows. DECLARED reads what HostSandbox.build_bwrap_args passes. cap_drop and no-new-privileges read bubblewrap default, because bubblewrap drops capabilities and sets no_new_privs on its own; a probe confirms that. pids_limit, /tmp noexec and seccomp read not applied, so ENFORCED is no: bubblewrap has no pids or noexec option (the comment at host.py:34-35), and devops-cli passes no seccomp filter. ENGINE reads n/a plus whether bwrap is executable. The policy object declares controls this runner never applies, which is exactly what the audit exists to show.
    • The harness shell tool gets one informational row: DECLARED none (process-group isolation only), ENGINE n/a, ENFORCED no. Criterion 11 asks for it, and it costs one row.
    • Exit status: the command exits 0 whenever it renders, and non-zero only on a usage error. Automation reads the --json rows. A report that fails on the host rows' permanent no would always fail.
    • The probe program: a stdlib-only Python script run with python3 -I -c. DEFAULT_SANDBOX_IMAGE is python:3.14-slim, which has no perl. It calls io_uring_setup through ctypes syscall(425, ...) (the same number on x86_64 and arm64), and calls unshare and mount through the libc wrappers. Capabilities, no_new_privs and the seccomp mode are read from /proc/self/status (CapEff, CapBnd, NoNewPrivs, Seccomp) rather than tried one syscall per capability, so ptrace needs no probe of its own. The kernel's own report is exact and needs no extra tooling.
    • How egress is probed: a UDP connect() to 192.0.2.1:9 (RFC 5737). ENETUNREACH means no route, so the row is enforced; success means a route exists, so it is not enforced. A UDP connect only selects a route and sends no packet. The body measured that socket() succeeds under --network none, so the test must be about reachability, and it must stay offline.
    • The fork probe: it forks at most pids_limit + 1 children, which block on a pipe and are reaped. It never runs on the host runner, where no pids limit applies. The integration test audits a policy with pids_limit=16. That keeps it bounded and avoids anything like a fork bomb (AGENTS.md).
    • --probe offline: the probe never pulls. images.get(image) runs first, and on ImageNotFound every row of that runner reads not probed: image absent (pull <image> to probe), with no container created. An unreachable engine reads not probed: engine unreachable: <reason>, and an absent bwrap reads not probed: bwrap absent. So the probe never needs network access, like the body's --pull=never measurement.
    • Probe containers: they are created from the runner's own _build_create_kwargs, with only command replaced, and force-removed in finally. The workspace is a fresh empty temporary directory, never the current directory. The probe calls the engine's create, start, wait and remove directly, not deploy(), so nothing is registered and no host port is allocated. The run is bounded by a new DEFAULT_SANDBOX_AUDIT_PROBE_TIMEOUT_SECONDS in src/devops_cli/config/defaults.py. Identical kwargs are the whole point; a probe must expose no user file, leave no state behind, and never hang the CLI.
    • Where seccomp_profile lives: one field on SandboxPolicy (src/devops_cli/sandbox/models.py:408), not two on the configs. Both runners already render the policy through to_docker_security_kwargs, so one field reaches both. A path is read and validated at load. The profile is refused when the file is missing, is not JSON, or has no defaultAction. It is also refused when defaultAction is not one of the denying OCI actions SCMP_ACT_ERRNO, SCMP_ACT_KILL, SCMP_ACT_KILL_PROCESS, SCMP_ACT_KILL_THREAD or SCMP_ACT_TRAP, so SCMP_ACT_ALLOW and SCMP_ACT_LOG (which also allows) are refused. That set is a closed enum from the OCI runtime spec, declared in src/devops_cli/config/constants.py. It is rendered as security_opt: ["seccomp=<compact JSON>"]. The host runner shows it as not applied. Stricter than the body, which refused only SCMP_ACT_ALLOW.
    • Porting vibes' seccomp_synthesizer.py: no. The engine's builtin profile is the maintained default; a tighter profile is a user-supplied OCI file.
    • declared_security_summary: deleted. Its two callers (commands/sandbox.py:185 and the tests) move to declared_controls(). Pre-1.0, so there is no alias.
    • Timing text below (v0.2.24, v0.3.2, v0.3.4, "six refine blocks"): obsolete. The roadmap tooling places the item; the only order that matters is PR 1, then PR 2, then PR 3.

    Delivery

    1. PR 1 (M): security_info(); declared_controls() on WorkloadSandboxEngine and WorkloadSandboxRunner, with both dry-runs printing it; the row model and audit builder in a new src/devops_cli/sandbox/enforcement_audit.py (DECLARED, ENGINE, and ENFORCED limited to the no-probe rules); host and harness rows; devops sandbox audit [--json]; the sandbox_audit MCP tool; help strings; regenerated CLI docs; and a new changelog.d/698.md fragment (PR 2 and PR 3 each add their own line to it). Refs feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698. Tests first: mocked info() returning builtin, unconfined, rootless, PidsLimit: false, missing keys, and raising; a parity test per runner that the create kwargs passed to the mocked SDK contain exactly declared_controls(); the deploy and workload dry-runs printing the same controls for the same policy; declared_controls() with get_engine, _ensure_internal_network and inject_trace_env patched to fail; no cell reading yes without --probe; host rows from build_bwrap_args; the MCP tool's command line. Files: src/devops_cli/docker/engine.py, src/devops_cli/sandbox/engine.py, src/devops_cli/docker/sandbox.py, src/devops_cli/sandbox/models.py, src/devops_cli/sandbox/host.py, src/devops_cli/sandbox/enforcement_audit.py (new), src/devops_cli/commands/sandbox.py, src/devops_cli/commands/docker.py, src/devops_cli/commands/test_cmd.py, src/devops_cli/ai/mcp/server.py, src/devops_cli/lang/en/help.py, tests/test_sandbox_enforcement_audit.py (new), tests/test_docker_engine.py, tests/test_sandbox_lifecycle.py, tests/test_workload_sandbox.py, changelog.d/698.md, and the existing task file docs/agent/tasks/task-698-sandbox-enforcement-audit-declared-vs-engine-vs-enforced-dev.md, rewritten to this plan, with its stale v0.2.24 milestone line and old line references removed (PR 3 sets **Status**: Done).
    2. PR 2 (M): --probe, with the probe script, the evidence-to-row mapping, the image-absent, engine-unreachable and bwrap-absent paths, the timeout default and an engine pytest marker. Refs feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698. Tests first: canned probe output (JSON lines) for each errno turning into the expected yes/no per row; ImageNotFound giving not probed: image absent with containers.create never called; the container force-removed when the probe times out; the host fork probe never scheduled; the probe's command and workspace bind being the only kwargs that differ from _build_create_kwargs; no registry entry written; an integration test marked engine (skipped without a reachable engine or without the image locally, registered the way bwrap is at tests/conftest.py:1188-1191 and pyproject.toml:157-159) that probes the workload runner with pids_limit=16. Files: src/devops_cli/sandbox/enforcement_probe.py (new, the in-container script), src/devops_cli/sandbox/enforcement_audit.py, src/devops_cli/commands/sandbox.py, src/devops_cli/ai/mcp/server.py, src/devops_cli/config/defaults.py, src/devops_cli/lang/en/help.py, tests/conftest.py, pyproject.toml, tests/test_sandbox_enforcement_audit.py, tests/test_sandbox_enforcement_probe.py (new), the task file, changelog.d/698.md.
    3. PR 3 (S): SandboxPolicy.seccomp_profile, its validation, its rendering in to_docker_security_kwargs, and its DECLARED cell. Closes feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698. Tests first: a valid SCMP_ACT_ERRNO profile renders seccomp=<compact JSON> in both runners' create kwargs; a missing file, invalid JSON, a missing defaultAction, SCMP_ACT_ALLOW and SCMP_ACT_LOG each raise a validation error naming the field; the audit's DECLARED seccomp cell names the profile path and the first 12 hex digits of its sha256; the host seccomp row stays not applied. Files: src/devops_cli/sandbox/models.py, src/devops_cli/config/constants.py, src/devops_cli/sandbox/enforcement_audit.py, tests/test_sandbox_lifecycle.py, tests/test_sandbox_enforcement_audit.py, the task file, changelog.d/698.md.

    Acceptance criteria

    • uv run devops sandbox audit prints, per runner (deploy engine, workload runner, host bubblewrap, harness shell), one row per control with the columns DECLARED, ENGINE and ENFORCED, and a summary line "Enforced: N of M"; --json emits the same rows.
    • The sandbox_audit MCP tool sits beside sandbox_deploy (src/devops_cli/ai/mcp/server.py:1564), runs devops sandbox audit --json, adds --probe when probe=True, and is annotated readOnlyHint: False because a probe starts and removes a container.
    • DECLARED comes from declared_controls(). For each runner, the create kwargs sent to a mocked SDK contain exactly those controls. commands/sandbox.py holds no literal control list, and declared_security_summary is gone.
    • Both dry-runs (devops sandbox deploy --dry-run and devops docker sandbox --dry-run) print the same controls for the same policy, and neither touches the engine.
    • With a mocked info(): profile=builtin gives seccomp ENGINE builtin and ENFORCED not probed: run with --probe; profile=unconfined gives ENFORCED no, with DECLARED unchanged; PidsLimit: false gives pids ENFORCED no; a missing key gives ENGINE not reported; a raising info() gives ENGINE unreachable: <reason> (at most 256 characters), no yes anywhere, and the reason in the summary.
    • Without --probe, no ENFORCED cell reads yes.
    • Host rows: cap_drop and no-new-privileges read DECLARED bubblewrap default; pids_limit, /tmp noexec and seccomp read DECLARED not applied and ENFORCED no.
    • --probe builds the probe container from the runner's own create kwargs (only command and the empty temporary workspace differ), never pulls, registers nothing, and removes the container even on timeout. Absent image, unreachable engine and absent bwrap each produce their not probed: <reason> rows.
    • Probe evidence maps to rows: CapEff and CapBnd of 0, plus mount failing → cap_drop; NoNewPrivs: 1 → no-new-privileges; Seccomp: 2, plus io_uring_setup and unshare(CLONE_NEWUSER) failing with EPERM or ENOSYS → seccomp; a fork failing with EAGAIN at or before pids_limit + 1 → pids_limit; a file create under / failing with EROFS → read-only root; exec of a file written to /tmp failing with EACCES → noexec; UDP connect to 192.0.2.1:9 failing with ENETUNREACH → network; a write under /workspace failing with EROFS → read-only workspace.
    • The fork probe never runs on the host runner and never forks more than pids_limit + 1 children.
    • SandboxPolicy.seccomp_profile refuses a missing file, invalid JSON, a missing defaultAction and any non-denying action (SCMP_ACT_ALLOW, SCMP_ACT_LOG included), and renders seccomp=<compact JSON> in both runners.
    • Every new command and pipeline stage has a trace_span. uv run devops ci passes, uv run devops docs check passes, and changelog.d/698.md exists; CHANGELOG.md and docs/ROADMAP.md are not edited.
    • Pending a person: run uv run devops sandbox audit --probe on the rootless Podman workstation, with python:3.14-slim already pulled, and paste the table into PR 2.

    Current references

    • WorkloadSandboxEngine._build_create_kwargs (deploy engine): src/devops_cli/sandbox/engine.py:255; whitelist-without-proxy raise :297-300; trace injection :311; _resolve_user_string :71; _ensure_internal_network :78
    • WorkloadSandboxRunner (workload runner): src/devops_cli/docker/sandbox.py:140; build_dry_run_details :160; _network_create_kwargs :201, internal-network side effect :209; _build_create_kwargs :231, trace injection :240; resolve_sandbox_user (engine call) :50-61; WorkloadSandboxConfig :64
    • DockerEngineService: src/devops_cli/docker/engine.py:242; client() :404; ping() short failure TTL :439-450; security_options() (swallows and caches the error) :454-466; is_rootless() :468
    • CONST_SECURITY_OPT_ROOTLESS: src/devops_cli/config/constants.py:1899
    • SandboxPolicy: src/devops_cli/sandbox/models.py:408; to_docker_security_kwargs :425; declared_security_summary :436; SandboxDeployConfig :460
    • Deploy dry-run security summary: src/devops_cli/commands/sandbox.py:185; deploy command :102
    • Workload dry-run callers: src/devops_cli/commands/docker.py:564, src/devops_cli/commands/test_cmd.py:411
    • MCP: sandbox_deploy src/devops_cli/ai/mcp/server.py:1564; the read-only tool pattern sandbox_status :1671-1684
    • Help strings: SandboxCommandHelp src/devops_cli/lang/en/help.py:1640
    • Host sandbox: DEFAULT_HOST_SANDBOX_POLICY and the noexec comment src/devops_cli/sandbox/host.py:34-38; HostSandbox :414; build_bwrap_args :503-535
    • Harness shell process group: src/devops_cli/ai/harness/shell.py:317
    • DEFAULT_SANDBOX_IMAGE (python:3.14-slim): src/devops_cli/config/defaults.py:741; DEFAULT_SANDBOX_PIDS_LIMIT: :744
    • Tests pinning kwargs today: tests/test_sandbox_lifecycle.py:656-660, tests/test_workload_sandbox.py:90-92 and :188-202; deploy dry-run makes no engine lookup: tests/test_sandbox_lifecycle.py:524; engine rootless: tests/test_docker_engine.py:859
    • Live-tool marker pattern: tests/conftest.py:1188-1191, pyproject.toml:157-159

    Dependencies and order

  11. modified the milestones: , v0.2.39 on Oct 20, 2026
  12. dan-petty commented on Oct 22, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1831, merged into release/v0.2.39 as 63f3655.

    Summary

    A sandbox declares its hardening (dropped capabilities, no-new-privileges, a pids limit, a read-only root, a noexec /tmp, an isolated network) as Engine API kwargs. Nothing compares those declarations with what the engine reports. This is the first part of #698. It builds the two data sources the planned devops sandbox audit reads, and it makes the two dry runs print the same data.

    • The engine's answer. DockerEngineService.security_info() returns a frozen EngineSecurityInfo with the daemon's security options, whether it supports a pids limit, and an error bounded to 256 characters. It makes one info() call. When the socket, the SDK or the engine fails, it returns the reason instead of raising. A fact the daemon omits stays None, so the audit can say "not reported" rather than report a negative. A success is cached for the normal cache lifetime. A failure is cached for DEFAULT_DOCKER_FAILURE_CACHE_TTL_SECONDS (2 s), the lifetime ping() already gave a failure. security_options() and is_rootless() read this one answer. Before, security_options() swallowed its error and cached an empty list, so an unreachable daemon looked like a daemon with no security options.
    • The declared controls. WorkloadSandboxEngine.declared_controls(config) and WorkloadSandboxRunner.declared_controls() return the policy's security kwargs, the Docker network of the network mode, and the workspace mount mode (workspace_mount_mode, ro or rw). They are pur…

    14 file(s) changed.

    How it was verified

    Check runs at 39a949d:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • devops-cli: pass
    • zizmor: pass
    • bandit: pass
    • CodeQL: pass
    • Rule Pack Tests: pass
    • Changed-Test Independence: pass
    • Tests & Coverage: pass
    • Fail-to-Pass Check: pass
    • Static Analysis: pass
    • Fail-to-Pass Self-Check: pass
    • Analyze (python): pass
    • Analyze (actions): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-698-sandbox-enforcement-audit.md:

    • security_info() reports builtin and unconfined seccomp, a rootless engine, PidsLimit: false, omitted keys as unreported, and an unreachable daemon as a bounded reason, without raising (tests/test_docker_engine.py).
    • One info() call backs security_info(), security_options() and is_rootless(); a failed answer is asked again after 2 s and a good one after the normal cache lifetime (tests/test_docker_engine.py).
    • Each runner creates its container with every declared control unchanged, the workspace mount mode (read-only or writable) among them, and the two runners declare identical controls for the same policy and network mode (tests/test_sandbox_lifecycle.py).
    • declared_controls() makes no engine request, and a whitelist mode without an egress proxy declares its network while creating the container still refuses it (tests/test_sandbox_lifecycle.py).
    • Every network mode maps to one Docker network (tests/test_sandbox_networking.py).
    • Both dry runs print the same declared controls for the same flags and make no engine request (tests/test_sandbox_lifecycle.py, tests/test_workload_sandbox.py).
    • The devops sandbox audit [--json] command, its sandbox_audit MCP tool and the DECLARED, ENGINE and ENFORCED columns, with the host bubblewrap and harness shell rows: the next Part of #698 pull request.
    • devops sandbox audit --probe, which runs the runner's own kwargs against the kernel to turn not probed cells into yes or no, and the person-run check of it on the rootless Podman workstation: the pull request that closes feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698.
    • SandboxPolicy.seccomp_profile: dropped from feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 on the owner's decision. No command or setting builds a custom container SandboxPolicy, so the field would be unreachable until one does. It is tracked as #1822.
  13. removed this from the v0.2.39 milestone on Oct 23, 2026
  14. dan-petty commented on Oct 23, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1831, merged into release/v0.2.39 as 63f3655.

    Summary

    A sandbox declares its hardening (dropped capabilities, no-new-privileges, a pids limit, a read-only root, a noexec /tmp, an isolated network) as Engine API kwargs. Nothing compares those declarations with what the engine reports. This is the first part of #698. It builds the two data sources the planned devops sandbox audit reads, and it makes the two dry runs print the same data.

    • The engine's answer. DockerEngineService.security_info() returns a frozen EngineSecurityInfo with the daemon's security options, whether it supports a pids limit, and an error bounded to 256 characters. It makes one info() call. When the socket, the SDK or the engine fails, it returns the reason instead of raising. A fact the daemon omits stays None, so the audit can say "not reported" rather than report a negative. A success is cached for the normal cache lifetime. A failure is cached for DEFAULT_DOCKER_FAILURE_CACHE_TTL_SECONDS (2 s), the lifetime ping() already gave a failure. security_options() and is_rootless() read this one answer. Before, security_options() swallowed its error and cached an empty list, so an unreachable daemon looked like a daemon with no security options.
    • The declared controls. WorkloadSandboxEngine.declared_controls(config) and WorkloadSandboxRunner.declared_controls() return the policy's security kwargs, the Docker network of the network mode, and the workspace mount mode (workspace_mount_mode, ro or rw). They are pur…

    14 file(s) changed.

    How it was verified

    Check runs at 39a949d:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • devops-cli: pass
    • zizmor: pass
    • bandit: pass
    • CodeQL: pass
    • Rule Pack Tests: pass
    • Changed-Test Independence: pass
    • Tests & Coverage: pass
    • Fail-to-Pass Check: pass
    • Static Analysis: pass
    • Fail-to-Pass Self-Check: pass
    • Analyze (python): pass
    • Analyze (actions): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-698-sandbox-enforcement-audit.md:

    • security_info() reports builtin and unconfined seccomp, a rootless engine, PidsLimit: false, omitted keys as unreported, and an unreachable daemon as a bounded reason, without raising (tests/test_docker_engine.py).
    • One info() call backs security_info(), security_options() and is_rootless(); a failed answer is asked again after 2 s and a good one after the normal cache lifetime (tests/test_docker_engine.py).
    • Each runner creates its container with every declared control unchanged, the workspace mount mode (read-only or writable) among them, and the two runners declare identical controls for the same policy and network mode (tests/test_sandbox_lifecycle.py).
    • declared_controls() makes no engine request, and a whitelist mode without an egress proxy declares its network while creating the container still refuses it (tests/test_sandbox_lifecycle.py).
    • Every network mode maps to one Docker network (tests/test_sandbox_networking.py).
    • Both dry runs print the same declared controls for the same flags and make no engine request (tests/test_sandbox_lifecycle.py, tests/test_workload_sandbox.py).
    • The devops sandbox audit [--json] command, its sandbox_audit MCP tool and the DECLARED, ENGINE and ENFORCED columns, with the host bubblewrap and harness shell rows: the next Part of #698 pull request.
    • devops sandbox audit --probe, which runs the runner's own kwargs against the kernel to turn not probed cells into yes or no, and the person-run check of it on the rootless Podman workstation: the pull request that closes feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698.
    • SandboxPolicy.seccomp_profile: dropped from feat(cli): sandbox enforcement audit declared vs engine vs enforced (devops sandbox audit) #698 on the owner's decision. No command or setting builds a custom container SandboxPolicy, so the field would be unreachable until one does. It is tracked as #1822.
  15. added a commit that references this issue on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/cliscope/securitytype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions