Skip to content

feat: close port 8000 with configurable origin routing#43

Merged
aliasunder merged 6 commits into
mainfrom
feat/close-port-8000
May 18, 2026
Merged

feat: close port 8000 with configurable origin routing#43
aliasunder merged 6 commits into
mainfrom
feat/close-port-8000

Conversation

@aliasunder
Copy link
Copy Markdown
Owner

Summary

  • Add ORIGIN_URL env var — when set, API Gateway routes through this URL (Cloudflare Tunnel, Caddy, or any HTTPS frontend) instead of directly to the Lightsail IP on port 8000
  • Add MCP_PORT_CIDRS env var — controls port 8000 on the Lightsail firewall, same format as SSH_CIDRS. none maps to a non-routable CIDR (RFC 5737)
  • Together they close the plaintext HTTP exposure on port 8000. Forkers who don't configure either get identical behavior to today
  • Extracted parseCidrs helper shared by SSH and MCP firewall logic
  • Full Cloudflare Tunnel walkthrough in DEPLOY.md with VM recovery procedure

Test plan

  • npm run build — type-check passes
  • npm test — 469 tests pass (no app code changes)
  • sst deploy without ORIGIN_URL — routes to direct IP (backward-compat)
  • sst deploy with ORIGIN_URL + MCP_PORT_CIDRS=none — routes through tunnel
  • curl <lightsailIp>:8000 — connection timeout (port closed on firewall)
  • curl <PUBLIC_URL>/healthz — 200 OK (API GW → Cloudflare Tunnel → localhost)
  • curl <tunnel-hostname>/healthz — 200 OK (direct tunnel access)

🤖 Generated with Claude Code

aliasunder and others added 6 commits May 18, 2026 16:57
Add two new env vars to sst.config.ts for optional port 8000 hardening:

- ORIGIN_URL: when set, API Gateway routes through this URL (tunnel,
  Caddy, or any HTTPS frontend) instead of directly to the Lightsail IP.
- MCP_PORT_CIDRS: controls port 8000 on the Lightsail firewall, same
  format as SSH_CIDRS. "none" maps to a non-routable CIDR (RFC 5737).

Together they close the plaintext HTTP exposure on port 8000. Forkers
who don't configure either get identical behavior to today.

Extracted parseCidrs helper shared by SSH and MCP firewall logic.
Updated deploy pipeline, DEPLOY.md (full Cloudflare Tunnel walkthrough
with VM recovery procedure), ARCHITECTURE.md, and .env.example.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
NON_ROUTABLE_CIDR and OPEN_TO_ALL are now named constants. The
fallback parameter is removed — undefined always means open to all,
eliminating the risk of an empty-array fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aliasunder aliasunder merged commit a4634c2 into main May 18, 2026
2 checks passed
@aliasunder aliasunder deleted the feat/close-port-8000 branch May 18, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant