Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

refactor(docker): drop the unused system info call

Yudhi Armyndharise8ebc7f7f472
diff --git a/README.md b/README.md
index 8fe19e24c..a954ada9b 100644
--- a/README.md
+++ b/README.md
@@ -243,7 +243,7 @@ The production stack never exposes `/var/run/docker.sock` directly to the applic
openwa-api ──TCP 2375──▶ docker-proxy ──unix──▶ /var/run/docker.sock
```
-Only the operations needed for container orchestration are enabled (`CONTAINERS`, `IMAGES`, `VOLUMES`, `INFO`, `PING`, plus the `POST` method switch). The application connects via the `DOCKER_HOST=tcp://docker-proxy:2375` environment variable, which `DockerService` detects automatically. Note this is an operational gateway, not a fine-grained privilege boundary: with `POST` enabled the proxy admits every method to the enabled paths and cannot scope container-create payloads, so a compromised API container would be host-root-equivalent — see `SECURITY.md` for the full threat model, mitigations, and how to disable the proxy if you don't use the built-in datastore orchestration.
+Only the operations needed for container orchestration are enabled (`CONTAINERS`, `IMAGES`, `VOLUMES`, `PING`, plus the `POST` method switch). The application connects via the `DOCKER_HOST=tcp://docker-proxy:2375` environment variable, which `DockerService` detects automatically. Note this is an operational gateway, not a fine-grained privilege boundary: with `POST` enabled the proxy admits every method to the enabled paths and cannot scope container-create payloads, so a compromised API container would be host-root-equivalent — see `SECURITY.md` for the full threat model, mitigations, and how to disable the proxy if you don't use the built-in datastore orchestration.
### Non-root Container Execution
diff --git a/SECURITY.md b/SECURITY.md
index 539e20ed8..6a251a358 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -90,7 +90,7 @@ The application container never mounts `/var/run/docker.sock`; it reaches the da
only through the bundled `docker-proxy` sidecar (pinned `tecnativa/docker-socket-proxy`),
which listens solely on an internal Compose network that no other container joins.
The proxy enables only the endpoint families the built-in datastore orchestration
-needs (`CONTAINERS`, `IMAGES`, `VOLUMES`, `INFO`, `PING`) plus its single `POST`
+needs (`CONTAINERS`, `IMAGES`, `VOLUMES`, `PING`) plus its single `POST`
method switch.
This is **not** a fine-grained privilege boundary, and we deliberately do not claim
diff --git a/docker-compose.yml b/docker-compose.yml
index 8423841c1..5b4f9031c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -16,7 +16,7 @@ services:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
# Minimal set that keeps DockerService (src/modules/docker/docker.service.ts) working:
- # PING (health), INFO (getSystemInfo), CONTAINERS (list/inspect/create/start/stop),
+ # PING (health), CONTAINERS (list/inspect/create/start/stop),
# IMAGES (pull), VOLUMES (createVolume). POST is the proxy's single all-or-nothing
# method gate for non-GET requests (haproxy.cfg: `deny unless METH_GET || env(POST)`).
# Two consequences of the pinned proxy config, accepted and documented in SECURITY.md:
@@ -34,7 +34,6 @@ services:
CONTAINERS: 1
IMAGES: 1
VOLUMES: 1
- INFO: 1
PING: 1
POST: 1
# Everything else is denied by default (AUTH, SECRETS, NETWORKS, PLUGINS, SWARM, TASKS, SERVICES, CONFIGS, NODES, DISTRIBUTIONS)
diff --git a/scripts/smoke-test-docker-proxy.sh b/scripts/smoke-test-docker-proxy.sh
index f0ac1f03f..b1d22620b 100755
--- a/scripts/smoke-test-docker-proxy.sh
+++ b/scripts/smoke-test-docker-proxy.sh
@@ -54,7 +54,7 @@ echo ""
echo "==> Verifying the proxy permits the read operations orchestration needs (from openwa-api)..."
# openwa-api is the only container that can reach docker-proxy:2375 (internal network), so
# the ACL is exercised from inside it. Node's global fetch (Node 18+) avoids a curl dependency.
-for endpoint in _ping containers/json info images/json volumes; do
+for endpoint in _ping containers/json images/json volumes; do
CODE=$(docker exec openwa-api node -e "fetch('http://docker-proxy:2375/$endpoint').then(r=>console.log(r.status)).catch(()=>console.log(0))" 2>/dev/null || echo 0)
if [ "$CODE" != "200" ]; then
echo "FAIL: GET /$endpoint via proxy returned HTTP $CODE (expected 200)" >&2
diff --git a/src/modules/docker/docker.service.spec.ts b/src/modules/docker/docker.service.spec.ts
index 26c2373ce..0cf411785 100644
--- a/src/modules/docker/docker.service.spec.ts
+++ b/src/modules/docker/docker.service.spec.ts
@@ -782,51 +782,3 @@ describe('DockerService.orchestrateProfiles', () => {
expect(result.message).toBe('Failed to start postgres: boom');
});
});
-
-describe('DockerService.getSystemInfo', () => {
- it('reports unavailable when Docker is not connected', async () => {
- expect(await new DockerService().getSystemInfo()).toEqual({ available: false });
- });
-
- it('maps the daemon info into the public shape', async () => {
- const service = new DockerService();
- Object.assign(service as unknown as Record<string, unknown>, {
- docker: {
- info: jest.fn().mockResolvedValue({
- Containers: 5,
- ContainersRunning: 2,
- ContainersPaused: 1,
- ContainersStopped: 2,
- Images: 9,
- ServerVersion: '27.0.3',
- OperatingSystem: 'Docker Desktop',
- Architecture: 'aarch64',
- }),
- },
- isAvailable: true,
- });
-
- expect(await service.getSystemInfo()).toEqual({
- available: true,
- info: {
- containers: 5,
- containersRunning: 2,
- containersPaused: 1,
- containersStopped: 2,
- images: 9,
- serverVersion: '27.0.3',
- operatingSystem: 'Docker Desktop',
- architecture: 'aarch64',
- },
- });
- });
-
- it('reports unavailable when the daemon info call fails', async () => {
- const service = new DockerService();
- Object.assign(service as unknown as Record<string, unknown>, {
- docker: { info: jest.fn().mockRejectedValue(new Error('daemon gone')) },
- isAvailable: true,
- });
- expect(await service.getSystemInfo()).toEqual({ available: false });
- });
-});
diff --git a/src/modules/docker/docker.service.ts b/src/modules/docker/docker.service.ts
index 8e3f9b840..0d261e453 100644
--- a/src/modules/docker/docker.service.ts
+++ b/src/modules/docker/docker.service.ts
@@ -67,7 +67,7 @@ export class DockerService implements OnModuleInit {
* dockerode's runtime takes an options object with `abortSignal` on every call, which its typings
* declare only for some of them.
*/
- private abortable<T>(method: 'ping' | 'info', abortSignal: AbortSignal): Promise<T> {
+ private abortable<T>(method: 'ping', abortSignal: AbortSignal): Promise<T> {
const call = this.docker![method].bind(this.docker) as unknown as (options: {
abortSignal: AbortSignal;
}) => Promise<T>;
@@ -672,47 +672,6 @@ export class DockerService implements OnModuleInit {
return result;
}
-
- /**
- * Get Docker system info
- */
- async getSystemInfo(): Promise<{ available: boolean; info?: Record<string, unknown> }> {
- if (!this.docker || !this.isAvailable) {
- return { available: false };
- }
-
- try {
- const info = (await this.answered(
- abortSignal => this.abortable<unknown>('info', abortSignal),
- 'the daemon info',
- )) as {
- Containers: number;
- ContainersRunning: number;
- ContainersPaused: number;
- ContainersStopped: number;
- Images: number;
- ServerVersion: string;
- OperatingSystem: string;
- Architecture: string;
- };
- return {
- available: true,
- info: {
- containers: info.Containers,
- containersRunning: info.ContainersRunning,
- containersPaused: info.ContainersPaused,
- containersStopped: info.ContainersStopped,
- images: info.Images,
- serverVersion: info.ServerVersion,
- operatingSystem: info.OperatingSystem,
- architecture: info.Architecture,
- },
- };
- } catch (error) {
- this.logger.error('Failed to get Docker info', error);
- return { available: false };
- }
- }
}
/**