Commit graph

12 commits

Author SHA1 Message Date
Kit Langton
da5e29b320 fix(server): read auth Config from Flag for HttpApi/Hono parity
HttpApi auth middleware was reading ServerAuth.Config via Effect's generated
defaultLayer, which resolves Config.string('OPENCODE_SERVER_PASSWORD') once
and is memoized by Layer identity. Subsequent runtime mutation of process.env
(or Flag.OPENCODE_SERVER_PASSWORD) was never observed, so the middleware kept
serving 401 even when auth was disabled at runtime.

Hono's AuthMiddleware reads Flag.OPENCODE_SERVER_PASSWORD per request, so it
picks up mutations immediately. With Hono still the production default and
HttpApi gated by OPENCODE_EXPERIMENTAL_HTTPAPI, the gap was masked by tests
that flipped the flag back to Hono for no-auth scenarios.

Override ServerAuth.Config.defaultLayer to read Flag.* via Layer.sync at
layer-build time. Each fresh listener (memoMap) picks up current Flag values.
This matches Hono behavior across listeners; per-request mutation within a
single listener is not preserved (would require reading Flag in the middleware
itself, which is a separate concern).

Tests:
- httpapi-listen: parameterize 'tickets optional when auth disabled' across
  both backends to lock in parity.
- httpapi-raw-route-auth + httpapi-ui: switch from ConfigProvider injection
  (which is now a no-op since defaultLayer is Flag-backed, not Config-backed)
  to ServerAuth.Config.layer({...}) for explicit overrides, or Flag mutation
  for tests that exercise the production read path.

46/46 auth + PTY tests pass.
2026-05-04 00:13:02 -04:00
opencode-agent[bot]
755cd561ec chore: generate 2026-05-03 19:45:26 +00:00
Kit Langton
6312c55d55
fix(server): serve embedded UI from bunfs (#25632) 2026-05-03 19:44:23 +00:00
Shoubhit Dash
8694c5b68f
fix(auth): respect server username in clients (#25596) 2026-05-03 19:28:31 +05:30
OpeOginni
101566131d
fix(httpapi): add basic auth challenge for browser login
Adds a WWW-Authenticate challenge for unauthorized experimental HttpApi UI fallback responses so browsers open the Basic Auth prompt when a server password is configured.
2026-05-03 13:20:05 +00:00
Kit Langton
ca75ac6681
refactor(server): extract Hono-coupled utilities to backend-neutral modules (#25542) 2026-05-03 12:58:34 +00:00
Kit Langton
2dd1f2d453
Avoid request-time HttpApi layer provisioning (#25179) 2026-04-30 19:36:57 -04:00
opencode-agent[bot]
8805104b8d chore: generate 2026-04-30 23:25:10 +00:00
Kit Langton
fc155e9fc5
Build HttpApi UI route from services (#25177) 2026-04-30 19:24:10 -04:00
opencode-agent[bot]
247284b9af chore: generate 2026-04-30 22:51:09 +00:00
Kit Langton
e0305e47f3
Protect HttpApi web UI fallback with auth (#25169) 2026-04-30 18:49:54 -04:00
Kit Langton
5518ecaefe
Fix HttpApi web UI fallback (#25163) 2026-04-30 17:43:18 -04:00