- New egress-proxy/ container (tinyproxy) that only allows CONNECT to api.anthropic.com, refuses everything else. - docker-compose.yml: sde-meeting-toolkit is no longer on 'default' at all. Its only networks are 'proxy' (NPM, inbound) and a new private 'egress' network shared only with egress-proxy. egress-proxy is the only container with a real internet route. - server.js: route the one outbound Anthropic call through EGRESS_PROXY_URL when set, using undici's own fetch + ProxyAgent together (mixing them with Node's global fetch throws a version mismatch error - caught this locally before it hit a real deploy). - Add undici as a real dependency (package.json, package-lock.json), npm ci step in Dockerfile. - Add smoke-test-egress.sh + Step 9b in DOCKER_TESTING.md to verify this whole chain with real Docker. - Update CHANGELOG.
76 lines
2.8 KiB
YAML
76 lines
2.8 KiB
YAML
# Standalone compose file for this tool.
|
|
#
|
|
# Network layout:
|
|
# - "proxy": external, owned by Nginx Proxy Manager's own stack. Lets NPM
|
|
# reach sde-meeting-toolkit by container name. No internet route.
|
|
# - "egress": private to this compose file. The ONLY thing
|
|
# sde-meeting-toolkit can reach besides "proxy". Used to talk to the
|
|
# egress-proxy container below.
|
|
# - "default": Compose's own auto-created network. Only egress-proxy is on
|
|
# it, since it's the only container here that needs real internet access.
|
|
#
|
|
# sde-meeting-toolkit itself is NOT on "default" and has no direct route to
|
|
# the internet at all. Its one outbound call (the AI draft button, to
|
|
# api.anthropic.com) is routed through egress-proxy via EGRESS_PROXY_URL,
|
|
# which only forwards that one destination and refuses everything else
|
|
# (see egress-proxy/tinyproxy.conf and egress-proxy/filter). A compromised
|
|
# app container still can't reach anything but Anthropic's API.
|
|
services:
|
|
sde-meeting-toolkit:
|
|
build: .
|
|
container_name: sde-meeting-toolkit
|
|
restart: unless-stopped
|
|
ports:
|
|
- "5173:5173"
|
|
environment:
|
|
- MOCK_AI=${MOCK_AI:-false}
|
|
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
|
|
- EGRESS_PROXY_URL=${EGRESS_PROXY_URL:-http://egress-proxy:8888}
|
|
- APP_USERS=${APP_USERS:-}
|
|
- APP_USERNAME=${APP_USERNAME:-}
|
|
- APP_PASSWORD=${APP_PASSWORD:-}
|
|
- RATE_LIMIT_MAX=${RATE_LIMIT_MAX:-20}
|
|
- RATE_LIMIT_WINDOW_MS=${RATE_LIMIT_WINDOW_MS:-300000}
|
|
- LOGIN_ATTEMPT_MAX=${LOGIN_ATTEMPT_MAX:-10}
|
|
- LOGIN_ATTEMPT_WINDOW_MS=${LOGIN_ATTEMPT_WINDOW_MS:-600000}
|
|
- LOGIN_LOCKOUT_MS=${LOGIN_LOCKOUT_MS:-900000}
|
|
- AUTH_LOG_FILE=${AUTH_LOG_FILE:-./data/auth-log.jsonl}
|
|
- SIGNIN_LOG_DEBOUNCE_MS=${SIGNIN_LOG_DEBOUNCE_MS:-1800000}
|
|
- TOKEN_LIMIT_PER_USER=${TOKEN_LIMIT_PER_USER:-0}
|
|
- TOKEN_USAGE_FILE=${TOKEN_USAGE_FILE:-./data/token-usage.json}
|
|
volumes:
|
|
# Persists the per-user token quota file across restarts and rebuilds.
|
|
# Without this, everyone's daily usage silently resets on every deploy.
|
|
- ./data:/app/data
|
|
networks:
|
|
- proxy
|
|
- egress
|
|
depends_on:
|
|
- egress-proxy
|
|
# Hardening for a container that's reachable from the public internet
|
|
# (through Nginx Proxy Manager). Neither of these needs any Linux
|
|
# capability the app doesn't already have, and the app never needs to
|
|
# escalate privilege.
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
|
|
egress-proxy:
|
|
build: ./egress-proxy
|
|
container_name: sde-meeting-toolkit-egress-proxy
|
|
restart: unless-stopped
|
|
networks:
|
|
- egress
|
|
- default
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
|
|
networks:
|
|
proxy:
|
|
external: true
|
|
egress:
|
|
driver: bridge
|