Repository navigation
[web] Add option to configure allowed hosts - #5671
VaguelySerious wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 0e52833 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🧪 E2E Test Results⏳ Tests are running... This comment will be updated with the results when the tests complete. _Started at: _ |
📊 Workflow Benchmarks⏳ Benchmarks are running for ℹ️ Metric definitions & methodologyMetrics — All timestamps are deployment-side; runs are triggered in-deployment, so the CI runner and api.vercel.com sit outside every measured window. TTFS = Cold starts stay in the numbers (real bursty-workload latency, inflates P75+); Best is the warm floor. |
Sim WorldSimulated world deterministic testing for races. Traces 🟢 world-sim scenario book — 0 fail of 45 total
Full trace: |
About these numbersSizes are gzip; parentheses show the change against
|
karthikscale3
left a comment
There was a problem hiding this comment.
The host/origin check only runs in the standalone server.js path. The embedded handler — createWorkflowWebHandler in handler.js — serves the same static + SSR app (including /api/rpc) but never calls checkRequest, so --webAllowedHosts / WORKFLOW_WEB_ALLOWED_HOSTS is silently ignored whenever the dashboard is mounted in-process.
That's a live path, not a theoretical one: @workflow/nitro mounts the dashboard at /_workflow through createWorkflowWebHandler (packages/nitro/src/index.ts:460). So for Nitro/Nuxt users the new option has no effect, and the two entry points behave inconsistently for the same config.
Fix options, either works:
- Apply the same guard inside
createWorkflowWebHandler— wrap the returned handler withcheckRequestbefore the static/SSR dispatch, readingallowedHostsfrom an option and/orWORKFLOW_WEB_ALLOWED_HOSTS. The host app owns the connection, so this is just an in-handler check, no server wiring. - Or, if the embedding host is meant to own request filtering, document that explicitly on
handler.jsand in the README, and have the integrations pass the setting through. Right now nothing says the embedded path ignores the option, which makes it a silent surprise.
Either way the embedded handler should honor the same config as the standalone server; today it doesn't.
Two smaller things:
- This is potentially breaking for existing hostname access: anyone reaching the UI via a reverse proxy or a custom hostname starts getting a 403 until they set
WORKFLOW_WEB_ALLOWED_HOSTS. Worth a short migration note in the changeset so it isn't a silent behavior change. - The
no Origin header → allowbranch for unsafe methods is intentional (CLI/curl and other non-browser clients), but worth a one-line comment on it so it isn't "tightened" later and quietly breaks those clients.
The rest of the logic reads correctly — the Host parsing (bracketed IPv6, port validation, trailing-dot stripping, fail-closed on malformed input), the full-host (name + port) same-origin comparison, and the unit coverage all look solid.
Adds
--webAllowedHosts/WORKFLOW_WEB_ALLOWED_HOSTSto configure which host names the web UI server accepts. By default it acceptslocalhost,*.localhost, and IP addresses.🤖 Generated with Claude Code