Lock down IPFS dsms-node: close external port 5001 and add auth to dsms-gateway #26

Open
opened 2026-04-20 09:37:51 +00:00 by sharang · 0 comments
Owner

Problem

docker-compose.yml exposes IPFS Kubo API port 5001 on the host. This port allows reading and writing arbitrary IPFS blocks without authentication. The dsms-gateway (port 8082) also has no JWT validation on its HTTP endpoints.

Required Actions

  1. Remove port 5001:5001 mapping from dsms-node in docker-compose.yml — the IPFS API should only be accessible within the Docker network, not from outside
  2. Restrict IPFS API to localhost only: add --api-addr /ip4/127.0.0.1/tcp/5001 to Kubo config
  3. Add JWT middleware to dsms-gateway Node.js service — validate Authorization: Bearer on all routes
  4. Verify Swarm port 4001 is intentionally public (needed for IPFS peering) — if not, close it too

Acceptance Criteria

  • curl http://<host>:5001/api/v0/id from outside Docker returns connection refused
  • dsms-gateway returns 401 for requests without a valid JWT
  • IPFS swarm peer connections still work (4001 can remain open if needed)
## Problem `docker-compose.yml` exposes IPFS Kubo API port 5001 on the host. This port allows reading and writing arbitrary IPFS blocks without authentication. The dsms-gateway (`port 8082`) also has no JWT validation on its HTTP endpoints. ## Required Actions 1. Remove port `5001:5001` mapping from `dsms-node` in `docker-compose.yml` — the IPFS API should only be accessible within the Docker network, not from outside 2. Restrict IPFS API to localhost only: add `--api-addr /ip4/127.0.0.1/tcp/5001` to Kubo config 3. Add JWT middleware to `dsms-gateway` Node.js service — validate `Authorization: Bearer` on all routes 4. Verify Swarm port 4001 is intentionally public (needed for IPFS peering) — if not, close it too ## Acceptance Criteria - `curl http://<host>:5001/api/v0/id` from outside Docker returns connection refused - dsms-gateway returns 401 for requests without a valid JWT - IPFS swarm peer connections still work (4001 can remain open if needed)
sharang added this to the M5: Frontend Hardening milestone 2026-04-20 09:37:51 +00:00
sharang added the securityseverity: medium labels 2026-04-20 09:37:52 +00:00
Sign in to join this conversation.