Skip to content

Commit f0df05a

Browse files
lpcoxCopilot
andcommitted
fix: accept any unix socket in checkDockerHost
The checkDockerHost function used a Set of two hardcoded socket paths (/var/run/docker.sock, /run/docker.sock) to validate DOCKER_HOST. Any other unix socket path (e.g. /tmp/custom-docker.sock) was incorrectly rejected as an external daemon. All unix:// sockets are local by definition — only TCP endpoints (tcp://host:port) indicate an external Docker daemon incompatible with AWF's network isolation model. Replace the Set lookup with a unix:// prefix check. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7cc3412 commit f0df05a

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

src/cli.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -891,15 +891,6 @@ export function applyAgentTimeout(
891891
logger.info(`Agent timeout set to ${result.minutes} minutes`);
892892
}
893893

894-
/**
895-
* The set of DOCKER_HOST values that point to the local Docker daemon and are
896-
* therefore compatible with AWF's network isolation model.
897-
*/
898-
const LOCAL_DOCKER_HOST_VALUES = new Set([
899-
'unix:///var/run/docker.sock',
900-
'unix:///run/docker.sock',
901-
]);
902-
903894
/**
904895
* Checks whether DOCKER_HOST is set to an external daemon that is incompatible
905896
* with AWF.
@@ -912,9 +903,11 @@ const LOCAL_DOCKER_HOST_VALUES = new Set([
912903
* - The iptables DNAT rules set up by awf-iptables-init
913904
* - Port-binding expectations between containers
914905
*
906+
* Any unix socket (standard or non-standard path) is considered local and valid.
907+
*
915908
* @param env - Environment variables to inspect (defaults to process.env)
916-
* @returns `{ valid: true }` when DOCKER_HOST is absent or points at the local
917-
* socket; `{ valid: false, error: string }` otherwise.
909+
* @returns `{ valid: true }` when DOCKER_HOST is absent or points at a local
910+
* unix socket; `{ valid: false, error: string }` otherwise.
918911
*/
919912
export function checkDockerHost(
920913
env: Record<string, string | undefined> = process.env
@@ -925,7 +918,7 @@ export function checkDockerHost(
925918
return { valid: true };
926919
}
927920

928-
if (LOCAL_DOCKER_HOST_VALUES.has(dockerHost)) {
921+
if (dockerHost.startsWith('unix://')) {
929922
return { valid: true };
930923
}
931924

0 commit comments

Comments
 (0)