Files
sde-meeting-toolkit/.env.example
Matt Mabrey 77203955a5 Restrict outbound network to api.anthropic.com only
- 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.
2026-09-29 18:16:35 -07:00

64 lines
2.9 KiB
Plaintext

## Copy this file to .env and fill in real values. Do not commit .env.
# Set to true to test the AI draft button with no API key and no cost.
# Returns a canned draft instead of calling Anthropic. Leave unset or false
# for real drafts.
MOCK_AI=false
# Required for the AI draft button, unless MOCK_AI=true.
ANTHROPIC_API_KEY=your-anthropic-api-key-here
# Only meaningful in the Docker deployment (docker-compose.yml sets this
# automatically to http://egress-proxy:8888). When set, the one outbound
# call this app makes (to api.anthropic.com) is routed through that proxy
# instead of going out directly, and the container itself has no other
# route to the internet at all. Leave unset for local, non-Docker runs -
# the AI draft button then calls Anthropic directly, same as always.
EGRESS_PROXY_URL=
# Named users. Comma-separated user:password pairs. Each name doubles as the
# identity used for the per-user token quota below.
# Example: APP_USERS=alice:pass1,bob:pass2,carol:pass3
# Leave blank for solo local use with no login prompt (usage is then tracked
# under the identity "local").
APP_USERS=
# Legacy single shared login. Only used if APP_USERS is blank. Everyone who
# logs in with this pair shares one identity and one token quota. Prefer
# APP_USERS instead: a shared login means the audit log below can't tell
# which real person made a given request.
APP_USERNAME=
APP_PASSWORD=
# Login lockout (brute-force protection). After this many failed logins from
# one address within the window, that address is locked out for the lockout
# period, even with the correct password. Only applies when a login is
# required (APP_USERS or APP_USERNAME/APP_PASSWORD is set). Defaults: 10
# failed attempts per 10 minutes locks out for 15 minutes.
LOGIN_ATTEMPT_MAX=10
LOGIN_ATTEMPT_WINDOW_MS=600000
LOGIN_LOCKOUT_MS=900000
# Sign-in audit log. One line per login event (timestamp, source address,
# username, success or failure) - never the password. Failures are logged
# individually; successes are logged at most once per address+user within
# SIGNIN_LOG_DEBOUNCE_MS, since Basic Auth resends credentials on every
# request and logging each one would flood the file. Persists across
# restarts if AUTH_LOG_FILE's folder is a mounted volume.
AUTH_LOG_FILE=./data/auth-log.jsonl
SIGNIN_LOG_DEBOUNCE_MS=1800000
# Optional. Caps AI draft calls per source IP, to catch a runaway script
# fast. Defaults: 20 requests per 5 minutes.
RATE_LIMIT_MAX=20
RATE_LIMIT_WINDOW_MS=300000
# On the back burner: off by default. Caps combined input+output tokens per
# named user, per UTC calendar day. Leave at 0 (or unset) for unlimited,
# which also skips writing TOKEN_USAGE_FILE. Set a positive number (for
# example 50000, roughly 100-200 AI drafts with this tool's prompt size) to
# turn it back on. Usage then persists across restarts if TOKEN_USAGE_FILE's
# folder is a mounted volume.
TOKEN_LIMIT_PER_USER=0
TOKEN_USAGE_FILE=./data/token-usage.json