Repository navigation
Description
Problem
Lines cited at dcafadf. Paths are under src/devops_cli/ unless they start with tests/. These paths are inside the locked docker-py 7.2.0 (pyproject.toml:24, uv.lock:797), not devops-cli: docker/__init__.py, docker/auth.py, docker/client.py, docker/api/…, docker/context/…, docker/transport/… and docker/utils/….
Before the Docker SDK dials a TCP daemon, DockerEngineService.resolve_host (docker/engine.py:229-246) runs the egress check (validate_service_url). It reads DOCKER_HOST itself and decides with a hand-written scheme test, so it checks a different endpoint than the one docker.from_env() then dials. Offline probes (no network namespace, an isolated DOCKER_CONFIG, private networks disallowed) confirmed each point below.
Hand-rolled code:
- A case-sensitive
startswithagainst the tuple("tcp://", "http://", "https://")(docker/engine.py:234,config/constants.py:2015-2018). - A string rewrite,
docker_host.replace("tcp://", "http://", 1)(docker/engine.py:245). - A push-name regex,
^[a-zA-Z0-9_.-]+(?:/[a-zA-Z0-9_.-]+)*(?::[a-zA-Z0-9_.-]+)?$(commands/docker.py:161-163). - The comment at
constants.py:2015-2017calls the tuple a "closed, exhaustive set" defined bydockerd -H. It is neither. docker-py also accepts uppercase schemes,ssh://,http+unix://, and a barehost:portwhose host is not made only of letters.
Confirmed defects:
- Spellings that skip the check. docker-py's own parser,
docker.utils.parse_host, reads the scheme case-insensitively. It reads a barehost:portas tcp unless the host is letters only:192.0.2.1:2375,[::1]:2375andexample.com:2375becomehttp://…, whilelocalhost:2375raisesDockerException: Invalid bind address protocol.APIClientrunsparse_hoston every endpoint (docker/api/client.py:146-148). These are dialled with no check:TCP://,Tcp://,HTTP://,HTTPS://, a bare192.0.2.1:2375and[::1]:2375. Lowercasetcp://192.0.2.1:2375is refused. - Docker contexts are never checked. With
DOCKER_HOSTunset,from_env()in docker 7.2.0 falls back to the Docker CLI context:DOCKER_CONTEXT, orcurrentContextinconfig.json(docker/client.py:84-87,:104-108).resolve_hostignores the context and returns the default unix socket. A context with endpointtcp://192.0.2.10:2376, selected either way, was dialled with no check. docker 7.2.0 has been pinned since v0.2.4, so this gap has existed since the check was added in v0.2.22.- For a context name that does not exist,
ContextAPI.kwargs_from_contextreturns{}(docker/context/api.py:150-152), sofrom_envsilently dials the default socket. The Docker CLI refuses the same setting (context "nope": context not found), whether the name comes fromDOCKER_CONTEXTor fromcurrentContext(measured).
- For a context name that does not exist,
- The TUI skips the check.
_get_docker_client(ui/data_providers.py:217-221), used byfetch_docker_status(:400), callsdocker.from_env()directly. - A refusal ends in a traceback.
resolve_hostruns outside thetry(docker/engine.py:253), and_engine()(commands/docker.py:53-60) catches onlyDockerError. So theSSRFBlockedErrorfortcp://192.0.2.1:2375endsdevops docker imagesin a full Rich traceback.validate_service_urlcan also raiseInvalidURLError(core/validation.py:286-295), andparse_hostraisesDockerException, orValueErrorfor a bad port. Each would escape the same way. - The push regex is wrong both ways.
- It rejects valid names with a registry port:
localhost:5000/app:1.0,example.com:443/a/b:cand[::1]:5000/app:1. - It accepts invalid names:
UPPER/Caseand-lead/app. - The progress line
MESSAGES.docker.pushing_imageis Rich markup (Pushing [dim]{image}[/dim]...), and the name is not escaped (commands/docker.py:165). Without the regex,app:1[/x]raisesMarkupError.
- It rejects valid names with a registry port:
- The knowledge base teaches the bypass.
ai/knowledge_base/devops_cli/libraries/docker.md:37-42,:61(the metrics example) and:94tell agents to create clients withdocker.from_env().
Replacement: docker-py's own exported functions, in the order from_env uses them, split into steps that later endpoint sources can reuse:
-
Gather the endpoint from one ordered list of sources. The first source that gives an endpoint wins. Each source is one entry in the list, so a source can be added later without touching the normalise, check or build steps:
DOCKER_HOST: thebase_urlfromdocker.utils.kwargs_from_env();DOCKER_CONTEXT: the context fromdocker.ContextAPI.get_context(name);currentContextinconfig.json, when it is notdefault:ContextAPI.get_current_context();- the default context,
ContextAPI.DEFAULT_CONTEXT(docker/context/api.py:20), whose host isunix:///var/run/docker.sock.
This is the order
from_envandkwargs_from_contextfollow (docker/client.py:104-108,docker/context/api.py:136-160), written as a list instead of onekwargs_from_envcall plus asetdefaultmerge ofkwargs_from_context.- The
tlsthatkwargs_from_envbuilds fromDOCKER_TLS_VERIFYandDOCKER_CERT_PATHapplies whichever source wins. Without it, a context'sTLSConfigapplies. This is whatfrom_env'ssetdefaultmerge does today. - A context name that does not exist (
get_contextreturnsNone), fromDOCKER_CONTEXTor fromcurrentContext, is an error that names the context, as in the Docker CLI. No later source is tried.kwargs_from_contextcannot be used for this, because it returns{}for a missing context.
-
Normalise it with the SDK's parser.
base_url = docker.utils.parse_host(raw, docker.constants.IS_WINDOWS_PLATFORM, tls=bool(params.get("tls"))). This is the callAPIClientmakes. -
Choose what to check with an allowlist. If
urllib.parse.urlsplit(base_url).scheme in ("http", "https"), callvalidate_service_url(base_url, "Docker Host", allow=settings.ai.allow_private_network), asdocker/engine.py:246does today.http+unixandnpipeare local.sshis left out on purpose (key questions).- A denylist would send
ssh://intovalidate_service_url, which refuses every scheme except http and https (core/validation.py:286-291).
-
One public resolve step that does not connect.
resolve_host()keeps its name and stays public. It gathers, normalises and checks, builds no client and opens no socket. It returns a frozenDockerEndpointmodel (models/docker.py) with:source: where the endpoint came from, which isDOCKER_HOST, the context's name, or the socket path for the default context;raw: the endpoint as its source gave it (Go clients such as dive take this form, nothttp+unix://);base_url: theparse_hostURL that was checked;params: the docker-py keyword arguments the client is built from:base_urlset to the checked URL, andtls.
Callers that need the endpoint without a client (a sandbox socket guard, a child process's
DOCKER_HOST, error lines) reuse this step. -
Say it is a pre-flight check. docker-py dials through requests and urllib3, not httpx2, so this check runs before the dial and cannot see the dialled address.
resolve_host's docstring says so and names the gap: for an endpoint given by name, the address can change between the check's DNS lookup and the dial. -
Dial what was checked.
client()callsresolve_host()and buildsdocker.DockerClient(timeout=int(DEFAULT_DOCKER_TIMEOUT_SECONDS), **endpoint.params)instead ofdocker.from_env(...). If a later docker-py adds an endpoint source tofrom_env, this client does not use it, so the change fails closed.use_ssh_clientstays unset. -
One error type.
- Gathering, parsing and the check move inside the
try. DockerExceptionandValueErrorfrom docker-py,SSRFBlockedErrororInvalidURLErrorfromvalidate_service_url, and a missing context all becomeDockerDaemonUnavailableError. Its message gives the source name and the reason, so_engine()prints one line._engine()prints it withprint_error(..., prefix=False, safe=True). The reason now quotes text the user supplied:parse_hostmessages and the refusal both echo the endpoint. Measured:parse_host("abc://x/[/x]")raisesDockerException: Invalid bind address protocol: abc://x/[/x], and Rich rejects that line withMarkupErrorunless it is escaped.ERRORS.docker.cannot_connectholds no markup, sosafe=Trueloses nothing.
- Gathering, parsing and the check move inside the
-
TUI.
fetch_docker_statustakesget_engine().client(), and_get_docker_clientis deleted (no pass-through wrapper). -
Push.
- Delete the regex and let docker-py and the daemon judge the reference.
- Around
images.push:docker.errors.InvalidRepository, which docker-py'sresolve_repository_nameraises before any request (docker/auth.py:15-27), and anAPIErrorwhosestatus_codeisHTTPStatus.BAD_REQUESTprintERRORS.docker.invalid_image_nameand the reason (the exception text, or the daemon'sexplanation);- any other
APIErrorprints the daemon's explanation as text (safe=True); - both exit 1.
- The name goes through
escape_text(already imported,commands/docker.py:27) in the progress line, and the invalid-name message is printed withsafe=True. - Do not add
parse_repository_tagorresolve_repository_namecalls.images.pushalready runs both (docker/api/image.py:474-476), and neither rejectsInvalid Name!orapp:1[/x].
-
Delete the constants at
constants.py:2011-2018, with the false comment:CONST_DOCKER_UNIX_SOCKET_PATH(already unused);CONST_DOCKER_UNIX_SOCKET_URL;CONST_DOCKER_HOST_ENV_VAR;CONST_DOCKER_NETWORK_HOST_SCHEMES.
-
Knowledge base.
docker.md(:37-42,:61and:94) says that devops-cli code gets its client fromget_engine().client(), which checks the endpoint, and its examples use that call.
Out of scope:
security/checkov.py:72-84(_floats_on_latest). Rebuilding it onparse_repository_tagremoves no construct: it still needs the$VARsubstitution and the last-component split. Moving this check to hadolint's DL3006 and DL3007 rules (not yet filed) would delete the function instead.commands/docker.py:87(tag.rpartition(":")). It is correct for its input:Image.tagscomes from the Engine's RepoTags, which are alwaysname:tag. Switching toparse_repository_tagis optional.- Podman's endpoint variables and sockets. feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117 adds them as sources in this item's list.
Acceptance criteria
-
One shared fixture for the endpoint environment.
tests/conftest.pygains one fixture, used by every test below that resolves an endpoint (engine, CLI and TUI). It sets up:DOCKER_HOST,DOCKER_CONTEXT,DOCKER_TLS_VERIFY,DOCKER_CERT_PATHandDEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORKunset (tests/conftest.py:408sets the last one to true), andai.allow_private_network: false;DOCKER_CONFIGandHOMEboth pointed attmp_path, with aconfig.jsonholding{}written there. docker-py looks for contexts in acontextsdirectory next to whicheverconfig.jsonit finds (get_context_dir(),docker/context/config.py:53-54). It searches$DOCKER_CONFIG/config.json, then~/.docker/config.json(docker/utils/config.py:13-19). With noconfig.jsonat all it looks in./contextsunder the current directory. Measured: withDOCKER_CONTEXTset and noconfig.json,ContextAPI.kwargs_from_context()returns{}; writing{}toconfig.jsonmakes it return the tcp endpoint;- a helper that writes a context (
contexts/meta/<sha256 of name>/meta.json) next to thatconfig.json.
A later item extends this one fixture with its own variables and socket paths, so the rows below keep their results on any host.
-
Endpoint table, parametrised and offline. Only TEST-NET and loopback literals are used, and
docker.DockerClientis patched, except in thessh://row. Expected results, with each value set asDOCKER_HOST:TCP://192.0.2.1:2376,Tcp://192.0.2.1:2376,HTTP://192.0.2.1:2375,HTTPS://192.0.2.1:2376, a bare192.0.2.1:2375and[::1]:2375are refused, and no client is built. Today all six are dialled without a check.tcp://192.0.2.1:2375is still refused. With private networks allowed, it reachesDockerClientashttp://192.0.2.1:2375, the URL that was checked.unix:///run/user/1000/docker.sockand the unset default reachDockerClientwithout a check.ssh://u@192.0.2.1is not checked. With the realDockerClient, it raisesDockerDaemonUnavailableErrorbefore any I/O, because paramiko is not installed.fd://3,localhost:2375,tcp://192.0.2.1(no port),tcp://192.0.2.1:99999andtcp://192.0.2.1:abcraiseDockerDaemonUnavailableError.- For every row that is not refused,
resolve_host()builds no client and returns the source name (DOCKER_HOST, or/var/run/docker.sockfor the unset default), the endpoint as given and theparse_hostURL.
-
Contexts. A context with endpoint
tcp://192.0.2.10:2376is written with the fixture's helper.- Selected by
currentContextinconfig.json, and separately byDOCKER_CONTEXTwithconfig.jsonholding{}, it is refused before any client is built, and the error names the context. - With private networks allowed, it reaches
DockerClientashttp://192.0.2.10:2376. WithDOCKER_TLS_VERIFY=1andDOCKER_CERT_PATHat a directory undertmp_pathholding emptyca.pem,cert.pemandkey.pem, it reachesDockerClientashttps://192.0.2.10:2376with the environment'stls, asfrom_envdoes. DOCKER_CONTEXTbeatscurrentContext.currentContext: defaultgives the default socket.DOCKER_CONTEXT=nope, and separatelycurrentContext: gone, raiseDockerDaemonUnavailableErrornaming the missing context, and no client is built.- With
DOCKER_HOSTset, the context is ignored, as in docker-py.
- Selected by
-
No traceback.
devops docker imagesexits 1 and prints one error line that names the source and gives the reason as written, with no traceback, for each of: a refused endpoint (tcp://192.0.2.1:2375), an unparsable one (tcp://192.0.2.1:abc), and one whose text holds markup (abc://x/[/x], which prints literally). -
Pre-flight docstring.
resolve_host's docstring says the check runs before docker-py's own dial (requests and urllib3) and names the DNS window for an endpoint given by name. -
TUI.
fetch_docker_statusgets its client fromget_engine().client(). With a refused endpoint, it returnsconnected=Falsewith the refusal aserror_message, and no client is built. -
Contract test. A test pins these
docker.utils.parse_hostoutputs, measured with docker 7.2.0, so a docker-py bump that changes any of them fails:TCP://192.0.2.1:2376→http://192.0.2.1:2376;192.0.2.1:2375→http://192.0.2.1:2375;HTTPS://192.0.2.1:2376→https://192.0.2.1:2376;ssh://u@192.0.2.1→ssh://u@192.0.2.1:22;unix:///x→http+unix:///x;unix:///run/user/1000/podman/podman.sock(Podman's rootless socket) →http+unix:///run/user/1000/podman/podman.sock;None→http+unix:///var/run/docker.sock;tcp://192.0.2.1andlocalhost:2375raiseDockerException;ssh://u@192.0.2.1:22/run/user/1000/podman/podman.sock, an ssh URI with a socket path as Podman writes them, raisesDockerException("no path allowed for this protocol",docker/utils/utils.py:280-283).
-
Push.
localhost:5000/app:1.0,example.com:443/a/b:cand[::1]:5000/app:1reachimages.push.app:1[/x]prints literally in the progress line, with noMarkupError.Invalid Name!, withimages.pushmocked to raise a 400APIError, prints the invalid-name error and exits 1 with no traceback. A mocked 500 prints the daemon's text.- With
images.pushmocked to raisedocker.errors.InvalidRepository(what docker-py raises for-reg.example.com/app:1), the invalid-name error prints and the command exits 1. The hyphen-led registry host is the point of that case: docker-py checks only the registry part, so the name needs a dotted registry host such as-reg.example.com. - These tests stay green:
tests/test_docker.py:54,:209-215,:253and:275.
-
No construct left.
rg -n 'CONST_DOCKER_NETWORK_HOST_SCHEMES|CONST_DOCKER_HOST_ENV_VAR|CONST_DOCKER_UNIX_SOCKET_(URL|PATH)|replace\("tcp://"|docker\.from_env\(' src testsprints nothing. It searches every file type, so the knowledge-base page is covered.rg -n 're\.match\(' src/devops_cli/commands/docker.pyprints nothing.- No
net-marker from feat(ci): hand-rolled URL and address parsing failsdevops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107 is left indocker/engine.py,commands/docker.pyor the Docker block ofconfig/constants.py. At dcafadf, feat(ci): hand-rolled URL and address parsing failsdevops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107's rules match two sites there:docker/engine.py:245(net-scheme-affix) and the scheme tuple atconfig/constants.py:2018(net-address-list). DEFAULT_NET_CONSTRUCT_SUPPRESSION_CEILING, feat(ci): hand-rolled URL and address parsing failsdevops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107's ceiling inconfig/defaults.py, is lowered in the same PR by the number of markers removed.
-
Tests updated.
tests/test_docker_engine.py::35-40: the default resolves tohttp+unix:///var/run/docker.sockfrom source/var/run/docker.sock, and theCONST_DOCKER_UNIX_SOCKET_URLimport (:14) goes;:43-54: assert that theparse_host-normalised URL reaches the check;:57-66: the unix socket case;:69-76,:79-86and:437-441: patchdocker.DockerClientinstead ofdocker.from_env.
tests/test_docker.py::177: the patch target;:205-207:Invalid Name!now needs a mockedAPIError, because the SDK accepts that name.
tests/test_ui_dashboard.py:234and:246: drive the engine (thedocker_enginefixture,tests/conftest.py:610-623, or a patchedDockerEngineService.client) instead of patching_get_docker_client.
-
Docs and release.
- The
docker.mdknowledge-base page is updated at:37-42,:61and:94. - A changelog.d fragment says the checks are stricter. Uppercase schemes, a bare address-and-port endpoint such as
192.0.2.1:2375, and Docker-context TCP endpoints are now checked, so a daemon on a private range needsai.allow_private_network. A context name that does not exist is now an error instead of a silent fall-back to the default socket.devops docker pushnow accepts registry ports. - The new tests are offline and take well under 1 s together, and
uv run devops cipasses.
- The
-
feat(cli): docker containers & multi-tier workload sandbox console (
tab-docker) #687's docker tab (not yet built) consumesDockerEngineServiceand builds no third Docker client; a comment on feat(cli): docker containers & multi-tier workload sandbox console (tab-docker) #687 records it. -
The tests reuse fix(cli):
devops docker pruneremoves stopped containers, unused networks and dangling images instead of failing on every engine #1116'screate_autospecdocker_clientfixture when it has landed (and feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117 reuses it too), rather than adding another hand-built fake.
Key questions
- Should
ssh://endpoints be checked? Proposed: no; leave them unchecked, as today.- paramiko is not in
uv.lock, so docker-py refusesssh://before any I/O (docker/api/client.py:179-188). - If paramiko were added, docker-py would take the real host from
~/.ssh/config(docker/transport/sshconn.py:194-205). A check on the URL's host would then not match the host that is dialled.
- paramiko is not in
- The SDK functions are exported but undocumented. Is that acceptable? Proposed: yes.
parse_host,kwargs_from_envandContextAPI(withget_context,get_current_contextandDEFAULT_CONTEXT) are exported (docker/utils/__init__.py,docker/__init__.py:3). docker-py's API docs at 7.2.0 (docs/client.rst,docs/api.rst) coverfrom_env,DockerClientand the low-levelAPIClient, not these. The safeguards are the exact pin, Renovate and the contract test. Because the client is built from the checked params, any drift fails closed. - Should a context name that does not exist be an error? Proposed: yes, from
DOCKER_CONTEXTand fromcurrentContextalike. The Docker CLI refuses both (measured), and docker-py's silent fall-back to the default socket dials an endpoint the user did not choose. The error names the context, so a stalecurrentContextis easy to fix. - Should the check be
validate_service_urlorvalidate_configured_service_url? Proposed: keepvalidate_service_urlwithallow=settings.ai.allow_private_network, as today. This item changes what is checked, not the policy.validate_configured_service_url(core/validation.py:339-353, from fix(ai): client timeouts take effect, replies are read under the size limit, and remote models go where their settings say (#960) #1077) would newly allow a loopback TCP daemon withoutallow_private_network. That loosening is a separate decision. - Should the check run at connect time, as fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898 does for httpx2 clients? Proposed: out of scope.
- docker-py dials through requests and urllib3, which fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's httpx2 network backend does not reach.
- An endpoint given by name keeps today's window between the check's DNS lookup and the dial. An IP-literal endpoint has no such window.
- The check stays a pre-flight check, and fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898 PR B must keep it. Today it reaches the address check through
validate_service_url→validate_url→_enforce_non_private_ssrf(core/validation.py:312), which fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898 PR B deletes along with_resolve_host_ips. When fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898 PR B lands, the Docker endpoint check calls fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's public resolve-and-check function (DNS lookup and address check), anddocker/engine.pyis on fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's list of callers that keep a pre-flight check (its key question "Which callers keep a pre-flight check?").
- What about child processes? Proposed: out of scope; this item covers the in-process SDK only. They inherit
DOCKER_HOST,DOCKER_CONFIG,DOCKER_TLS_VERIFYandDOCKER_CERT_PATHthrough the environment allowlist (core/process.py:61-64), and the tools the CLI starts dial on their own. The public resolve step lets a later item hand a child process the chosen endpoint. - Should image names with
.or..segments be refused? Proposed: no check in this item. The name is the user's own argument to their own daemon, and onlydevops docker pushsends it.- Measured: over a TCP endpoint, requests removes dot segments from the request path.
devops docker push a/../../xreached a stub daemon asPOST /v1.47/x/push. Over a unix socket, the path is sent as typed. - Today's regex accepts these names too.
- No Python library in
uv.lockparses Docker references strictly: docker-py'sparse_repository_tagandresolve_repository_nameaccept them. A check here would have to be a hand-written parser or regex, which the project's library-first rule excludes.
- Measured: over a TCP endpoint, requests removes dot segments from the request path.
Strategic alignment
- Priority P2. This is a confirmed egress-check bypass on user-configured endpoints (Docker contexts, since v0.2.22), plus a functional bug that blocks pushes to any registry with a port.
- Owner preference: Podman over Docker. This item is the groundwork for feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117. Its ordered list of sources, its public resolve step and its shared test fixture let feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117 add
CONTAINER_HOSTand Podman's sockets as sources, so every new source passes the same egress check by construction. - Library first. docker-py's own
kwargs_from_env,ContextAPIandparse_hostreplace a hand-written scheme tuple, prefix test and string rewrite. docker 7.2.0 is already a direct, exact-pinned dependency (Apache-2.0, actively maintained). docker-py's and the daemon's own reference checks replace a hand-written regex. No new dependency and no added CI time. - Size: small.
- About 60 source lines across
docker/engine.py,models/docker.py,ui/data_providers.py,commands/docker.pyandconfig/constants.py. - One shared fixture, about 8 test edits and 20 new parametrised cases.
- About 60 source lines across
- Dependencies.
- Lands after feat(ci): hand-rolled URL and address parsing fails
devops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107, so its markers go with the code, in parallel with fix(security): URL credential masking uses urllib and httpx2, so passwords containing '@' and non-http schemes are masked and IPv6 hosts stay intact #1109, fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112 and fix(git): GitHub clones trust GitHub's published host keys through OpenSSH, so junk known_hosts lines and a failed key scan no longer skip pinning #1114. - Lands before feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117, which builds on the ordered sources, the public resolve step, the shared fixture and the TUI switch.
- Independent of fix(security): egress guards refuse cloud metadata in every numeric, NAT64 and provider form, classified by ipaddress and one maintained library #897.
- Not independent of fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898. The Docker endpoint check is a pre-flight check for a dialler that is not httpx2, and fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898 PR B deletes the resolve path it uses today (
_enforce_non_private_ssrf, reached fromvalidate_service_url). Whichever lands second makes the Docker check call fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's public resolve-and-check function. fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's list of callers that keep a pre-flight check namesdocker/engine.py, so a fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898 PR B builder keeps this check.
- Lands after feat(ci): hand-rolled URL and address parsing fails
- Proposed milestone: backlog (P2), picked by the release-start fill.
- Related:
- fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898: its PR B must keep this item's Docker endpoint check and move it onto fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's public resolve-and-check function (see Dependencies).
- feat(docker): container commands find a Podman engine before Docker's default socket, and rootless sandboxes run as the host user #1117: adds Podman's endpoint sources to this item's list, reuses
resolve_host()for dive'sDOCKER_HOSTand its error lines, and extends the shared fixture. - fix(security): a sandbox workspace can never expose the container engine socket or the user's runtime directory and its session bus #1115: its workspace check takes the engine socket from
resolve_host(). The two are independent; whichever lands second keeps that check on this one resolve step. - refactor(k8s): the kubernetes, argo, docker, terraform, observability and valkey tables move out of config/ next to their owners #1031 must not move these constants; this item deletes them.
- fix(ai): client timeouts take effect, replies are read under the size limit, and remote models go where their settings say (#960) #1077 added
validate_configured_service_url.
- Evidence-first review. A deterministic tool originates this finding: feat(ci): hand-rolled URL and address parsing fails
devops ci, AGENTS.md makes the library the rule, and reviews stop discarding the findings #1107'snet-scheme-affixrule flags thereplace("tcp://", …)atdocker/engine.py:245, and its message namesdocker.utils.parse_host. The pre-fixresolve_host, whereTCP://skips the check, is also a candidate defect template for the review tool's synthetic defect corpus (ai/review/defects.py,DefectTemplateat :125), which injects known defects into clean files and measures how many a review reports.
Update 2026-10-08: refinement
#1316 leaves the dashboard bypass (ui/data_providers.py:217-221) to #1334, which takes Docker from #1316's seam. Whichever of this item and #1334 lands first deletes _get_docker_client; the other's tests drive the engine.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 8, 2026
Placed in v0.2.31 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: finding identity v2, URL credential masking, tests that leave no state, the Docker endpoint check and the Argo CD/OTel perimeters. Position 7 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.
fix(docker): the Docker endpoint check covers the endpoint the SDK di…
dan-petty-bot commentedon Oct 9, 2026
What changed
#1481, merged into
release/v0.2.31as f8ebd60.13 file(s) changed.
How it was verified
Check runs at 90aa318:
Acceptance Criteria of
docs/agent/tasks/task-1108-docker-endpoint-check.md:docker_endpoint_envintests/conftest.pyprovides isolated test environment, unsets Docker environment variables, setsallow_private_network: false, and provides awrite_contexthelper.192.0.2.1:2375), and loopback/TEST-NET endpoints are refused without building a client.ai.allow_private_network: true) normalise tohttp://...and reachDockerClient.DOCKER_HOST>DOCKER_CONTEXT>currentContext> default socket) and raisesDockerDaemonUnavailableErroron missing contexts.DOCKER_TLS_VERIFY,DOCKER_CERT_PATH) upgrade context endpoints tohttps://....devops docker imagesprints single error line naming source and reason with no traceback on invalid endpoints.resolve_host()documents the pre-flight check and the DNS window.devops docker pushaccepts registry ports (localhost:5000/app:1.0,example.com:443/a/b:c,[::1]:5000/app:1), escapes progress markup, and handlesInvalidRepositoryandAPIError.replace("tcp://", ...),docker.from_env(, andre.matchincommands/docker.py.changelog.d/1108.mdis provided.feat(release): v0.2.31 (#1490)