Repository navigation
fix: match exec and create endpoints on whole path segments (#49) - #67
Merged
Merged
Conversation
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
The three routers disagreed about exec and the create endpoints, and in some cases each was wrong in its own way:
DELETE /containers/mycontainer/execPOST /containers/exec-runner/startDELETE /containers/exec-runnerGET /containers/exec-runner/jsonGET /images/execGET /exec/abc/jsonPOST /containers/create/extraPOST /images/create/extramatchEndpointlooked only at the first two segments. As a result,execwas matched only as the container name, andcreateaccepted trailing segments./exec. A container whose name starts withexec(exec-runner,executor) could therefore not be started, removed or inspected through them, even though Docker allows such names.Rule: after the #53 percent check and the version strip, match on whole path segments.
exec is not allowed, when either:exec, orcontainersand any later segment is exactlyexec.POST /containers/createandPOST /images/creatematch only with exactly two segments.matchEndpointis replaced byisExecPathand exact matches, and removed.is_exec_path.isExecPath.Closes #49
Behaviour change, not breaking: Go and Rust now deny exec inspect (
GET /exec/<id>/json), as TS already did. No Docker CLI command uses it. Through the raw API it leaked the full command line of exec instances started directly on the daemon, including inline secrets: I checked this live, by finding exec IDs with container inspect and then reading the instance. The per-socket exec feature is tracked separately in #65.Spec first (
spec/router.qnt)denyExec.execSubpathDeleteDenied,execSubpathPostDenied,execPrefixName{Start,Delete,Get}Allowed,execNamespace{Get,Post}Denied,createSubpathDenied) and propertiesexecNeverAllowed,execPrefixNamesRoute,createOnlyExact.DELETE …/execdivergence is replaced.make test-spec:listener_locked11,listener_unlocked10,router27,router_pre4815,router_pre5315 passing.Tests (written first; RED commits
3ff44e2,7ae6d5d)GET /images/exec,POST /images/create/extra,GET /containers/myexec/json,DELETE /containers/executor, the reservedGET /containers/exec/json, andGET /executor.endpoint POST /containers/x/exec is not allowed) also ends in "exec is not allowed", so a substring check would have passed Go before the fix.deploy/test.sh, 39 → 43 checks:DELETE /containers/no-such/exec→ 403,POST /containers/create/extra→ 403,POST /containers/exec-nosuch/start→ 404 (the daemon answered), andGET /exec/<id>/json→ 403. Before the fix: Go 40/3, Rust 41/2, TS 42/1, each failing exactly its known divergences.Verification
/v1.45/exec/abc/json, trailing slashes (/containers/x/exec/,/containers/create/,/images/create/),/executor,/images/exec, and/. Go'sPOST /containers/create/(trailing slash) is now denied, matching Rust and TS. The Docker CLI never sends it.docker start exec-nosuchreturns the daemon's "No such container".docker exec <running container> truereturnsexec is not allowed.docker versionsucceeds.Follow-ups recorded
/exec) can never fire, because the chain runs only on container create. The README row describing it overstates it.Squash-merge required: the RED commits fail by design. It needs no footers, so the default squash message (PR title plus commit bullets) is fine and releases v0.3.1.
Type of change
Implementation(s) changed
deploy/test.sh)Testing
make test-all): Go 108, Rust 145, TS 162 (1 skipped)make test-integration,-rsand-tseachALL 43 TESTS PASSEDmake test-spec(above);make verifyruns in CImake lint-allChecklist
spec/README.md, AGENTS.md counts)