caelum0x b76f1f3593 fix(security): pin the OpenCode CORS proxy to opencode.ai upstreams
A request path like /api/opencode/go/https://evil.com/steal made
joinUpstream's `new URL(relative, base)` discard `base` entirely
(WHATWG URL semantics for an absolute URL segment), so the proxy would
forward the request's authorization/x-api-key/x-goog-api-key headers
to an attacker-chosen host instead of opencode.ai. This runs live in
production via scripts/shotluma-worker.ts on app.shotluma.com.

Reject any resolved upstream whose origin does not match the intended
opencode.ai origin, and add regression tests covering absolute,
protocol-relative, and plain adversarial path segments plus a
worker-level test asserting no outbound fetch happens for the crafted
path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-20 16:09:51 +03:00
..