Skip to content

Allow container stop and restart in container-runtime profile - #21

Merged
axellpadilla merged 2 commits into
logxel:mainfrom
axellpadilla:fix/container-runtime-allow-stop
Aug 14, 2026
Merged

Allow container stop and restart in container-runtime profile#21
axellpadilla merged 2 commits into
logxel:mainfrom
axellpadilla:fix/container-runtime-allow-stop

Conversation

@axellpadilla

@axellpadilla axellpadilla commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The container-runtime profile claims to support DockerRunLauncher lifecycle calls, but it denied POST /containers/{id}/stop — the exact endpoint DockerRunLauncher.terminate() uses to cancel runs. Since deny-overrides blocks any allowlist override while the profile is active, run termination failed with 403 and runs hung in CANCELING with worker containers still running.

Closes #20.

Changes

  • src/security.rs: grant POST /containers/{id}/stop and POST /containers/{id}/restart in the container-runtime profile by adding them to RUNTIME_ENDPOINTS and removing them from the profile's retained write-denial list.
  • Tests: assert stop and restart are allowed in container_runtime_profile_allows_launcher_workflow, and container_runtime_profile_keeps_destructive_ops_denied confirms kill, pause, unpause, rename, update, resize, attach, and commit stay denied.
  • README.md: document that graceful termination and restart are included; CHANGELOG.md: [Unreleased] Fixed entry.

Design decision

Only stop and restart are granted. DockerRunLauncher in dagster-docker never calls kill/pause, so those remain denied (least privilege, no behavior loss). Stop is the graceful, reversible SIGTERM path; restart is compositionally stop+start, so denying it once stop and start are both granted would be a ceremonial boundary with no security value — the profile already granted the irreversible DELETE /containers/{id}, so this closes the lifecycle gap rather than widening it.

Validation

  • cargo fmt --all --check — pass
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo test --locked — 88 passed / 0 failed

DockerRunLauncher.terminate() cancels runs via POST /containers/{id}/stop,
which the container-runtime profile still denied. Grant stop alongside the
other launcher lifecycle endpoints; kill, restart, pause, unpause, rename,
update, resize, attach, and commit stay denied.
Restart is compositionally stop+start (SIGTERM -> timeout -> SIGKILL ->
start), so denying it while granting both parts is a ceremonial boundary.
Grant restart as a legitimate orchestrator lifecycle op; kill, pause,
unpause, rename, update, resize, attach, and commit stay denied.
@axellpadilla axellpadilla changed the title Allow container stop in container-runtime profile Allow container stop and restart in container-runtime profile Aug 14, 2026
@axellpadilla
axellpadilla merged commit 359b5d6 into logxel:main Aug 14, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

container-runtime blocks POST /containers/{id}/stop — breaks DockerRunLauncher run termination

1 participant