security: bind redis and postgres ports to localhost only

Prevents external access to Redis (6379) and Postgres (5432).
Both services are internal-only - containers communicate via
Docker network, host port binding only needed for local debugging.

Flagged by DigitalOcean security scan 2026-02-22.
This commit is contained in:
Aaron Aronchick
2026-02-22 03:53:28 +00:00
parent 1c8a531f6a
commit 79120681de

View File

@@ -10,7 +10,7 @@ services:
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${POSTGRES_PORT:-5432}:5432"
- "127.0.0.1:${POSTGRES_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
@@ -20,7 +20,7 @@ services:
redis:
image: redis:7-alpine
ports:
- "${REDIS_PORT:-6379}:6379"
- "127.0.0.1:${REDIS_PORT:-6379}:6379"
backend:
build: