Repository navigation
fix: deny exec-create and pause paths when their env vars are unset - #56
Merged
Merged
Conversation
EXEC=0 documented as covering /containers/{id}/exec but the template
only gated paths starting with /exec, so exec-create fell through the
generic containers allow. ALLOW_PAUSE was allow-only with no deny rule,
so pause fell through whenever CONTAINERS=1 and POST=1. Add the missing
deny rules in the same style as the existing archive/change/export/
logs/top denies. Ref: Tecnativa/docker-socket-proxy#114
|
Thanks for opening this pull request! Be sure to follow the pull request template! |
thespad
approved these changes
Nov 6, 2026
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
root/templates/haproxy.cfgdoes not enforce two of its documented ACLs onnested container paths:
EXEC=0does not block exec-create. The exec rule(
http-request allow if ... ^(/v...)?/exec { env(EXEC) }) only matchespaths starting with
/exec(i.e.POST /exec/{id}/start). The actualexec-create call,
POST /containers/{id}/exec, matches the genericallow if ^(/v...)?/containers { env(CONTAINERS) }rule instead, so withCONTAINERS=1andPOST=1it succeeds regardless ofEXEC. The READMEdocuments
EXEC=0as covering/exec & /containers/{id}/exec, so thetemplate fails to implement its own documented behaviour.
ALLOW_PAUSE=0does not block pause. The pause rule is allow-only(
allow if .../pause { env(ALLOW_PAUSE) }) with no corresponding denyrule. With
CONTAINERS=1andPOST=1the request falls through to thegeneric containers allow. The same asymmetry exists for
start/stop/killunderALLOW_START/ALLOW_STOP/ALLOW_RESTARTS,though this PR keeps scope to the two demonstrated gaps (start/stop/kill
fall-through can be a follow-up).
This PR adds two deny rules in the same style as the existing
archive/change/export/logs/top denies (they must precede the generic
allows — HAProxy
http-requestrules are first-match-wins), plus the twomissing
acldefinitions:Benefits of this PR and context:
Aligns the template with the README's documented ACL semantics and closes a
real hardening gap: a user with
CONTAINERS=1, POST=1, EXEC=0, ALLOW_PAUSE=0— the standard read-plus-restart profile — currently exposesexec-instance creation and container pause to whatever process can reach the
proxy. This fixes the intent expressed by the existing deny block for
archive/change/export/logs/top.
Related: Tecnativa/docker-socket-proxy#114 (exec open when POST=1),
Tecnativa/docker-socket-proxy#176 (proposed fix, still open).
How Has This Been Tested?
haproxy -c -fconfig validation passes with the patched template.(
CONTAINERS=1 IMAGES=1 NETWORKS=1 VOLUMES=1 LOGS=1 EVENTS=1 INFO=1 VERSION=1 PING=1 POST=1 ALLOW_START=1 ALLOW_STOP=1 ALLOW_RESTARTS=1 ALLOW_UNPAUSE=1, all other vars 0):GET /_ping→ 200GET /containers/json→ 200POST /v1.47/volumes/create→ 201POST /v1.47/containers/x/unpause→ 204 (ALLOW_UNPAUSE=1 still granted)POST /v1.47/containers/x/exec→ 403 (was 201)POST /v1.47/containers/x/pause→ 403 (was 204)POST /v1.47/exec/{id}/start→ 403 (unchanged)POST /v1.47/build,/commit,/containers/x/top,/containers/x/archivePUT → 403 (unchanged)EXECandALLOW_PAUSEdocumented coverage.Source / References:
EXEC=0→/exec & /containers/{id}/exec)