@slop-lab/dim-controller-proxy
v0.8.0
Published
Policy-constrained Unix socket proxy for DIM workspace controller APIs
Readme
@slop-lab/dim-controller-proxy
A policy-constrained Unix-socket proxy for exposing selected DIM workspace controller operations to an untrusted development container. Reviewed Project-root code runs the proxy in the trusted workspace container; only the new restricted socket is mounted into the child container.
Installation
npm install --save-exact '@slop-lab/[email protected]'The package is ESM-only, requires Node.js 24 or 26, includes TypeScript
declarations, and installs the dim-controller-proxy executable.
External URL preset
The built-in preset permits discovery, listing, creation, and individual revocation only for explicitly allowed ingresses:
dim-controller-proxy external-url \
--listen /run/dim/dev-controller/controller.sock \
--ingress local-http \
--ingress publicIt reads the trusted upstream socket and bearer grant from
DIM_CONTROLLER_SOCKET and DIM_CONTROLLER_TOKEN. Options
--directory-mode and --socket-mode accept octal Unix modes; their defaults
are 0700 and 0660.
Mount only /run/dim/dev-controller into the child container and configure the
child to use that socket. Never pass it the original token or mount the
original controller socket directory.
Node.js API
Reviewed code can construct a proxy from capability objects:
import { createControllerProxy } from "@slop-lab/dim-controller-proxy";
import {
externalUrlProxy,
getExternalUrlIngresses
} from "@slop-lab/dim-controller-proxy/external-url";
const ingresses = await getExternalUrlIngresses();
const proxy = createControllerProxy({
listen: "/run/dim/dev-controller/controller.sock",
capabilities: [
externalUrlProxy({
allowedIngresses: ingresses
.filter(({ name }) => name.startsWith("dev-"))
.map(({ name }) => name)
})
]
});
await proxy.listen();createControllerProxy also accepts explicit sourceSocket, token,
maxBodyBytes, and socket/directory modes. The default request-body limit is
65,536 bytes. Requests not authorized by any capability receive HTTP 403.
Custom reviewed policy modules can be started with
dim-controller-proxy --config ./proxy.mjs; importing that module is expected
to start and own the proxy lifecycle.
This proxy reduces the exposed controller API but does not make unreviewed policy code trustworthy. See the trust-boundary documentation and source repository.
