Skip to content

fix: load workspaces through remote HTTP proxies - #866

Merged
mariusvniekerk merged 5 commits into
mainfrom
t3code/fix-workspace-tab-loading
Aug 10, 2026
Merged

fix: load workspaces through remote HTTP proxies#866
mariusvniekerk merged 5 commits into
mainfrom
t3code/fix-workspace-tab-loading

Conversation

@mariusvniekerk

@mariusvniekerk mariusvniekerk commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Opening kenn-forge through a plain-HTTP reverse proxy could leave the Workspaces view blank. The sidebar required a browser API that is unavailable on insecure origins. Vite also told remote browsers to connect hot module replacement to their own loopback address.

Use Svelte's component identity for workspace refresh ownership, and let Vite derive its development WebSocket endpoint from the page origin. Explicit HMR overrides remain available for proxies that expose a different host, protocol, or port. The full-stack insecure-origin regression opts in only inside the isolated Docker E2E job, so ordinary local runs never bind its non-loopback proxy.

Validation
  • Frontend unit suite: 3,887 passed, 2 skipped.
  • Local workspace-sidebar Playwright suite: 24 passed, 8 skipped across Chromium and Firefox.
  • Frontend checks, non-mutating lint, commit hooks, push hooks, and public-safety scans passed.

generated by a clanker

@roborev-ci

roborev-ci Bot commented Aug 9, 2026

Copy link
Copy Markdown

roborev: Combined Review (8a26968)

The PR has one high-severity security issue and one medium-severity test coverage gap.

High

  • Network-exposed test proxy enables arbitrary command executionfrontend/tests/e2e-full/00-workspace-sidebar.spec.ts:216

    The unrestricted reverse proxy binds to a non-loopback interface and forwards all requests to the loopback-only e2e server, which has the host runtime enabled. A network-adjacent attacker could invoke POST /api/v1/runtime/sessions with attacker-controlled commands and working directories, executing code as the CI runner or developer account.

    Bind the proxy only to loopback and map a test hostname to 127.0.0.1 using Chromium host-resolver rules. Alternatively, allow only the required read-only routes and reject mutation/runtime endpoints.

Medium

  • HMR behavior lacks end-to-end regression coveragefrontend/src/lib/dev/viteConfig.test.ts:38

    The test only asserts the generated configuration object; it does not verify that a page accessed through an alternate origin connects to /__vite_hmr on that origin and receives updates.

    Add an integration/e2e test using an alternate-origin, WebSocket-capable proxy and verify that an HMR update reaches the browser.


Reviewers: 2 done | Synthesis: codex, 14s | Total: 4m6s

@roborev-ci

roborev-ci Bot commented Aug 9, 2026

Copy link
Copy Markdown

roborev: Combined Review (e04ded9)

The changes look sound, but the remote-origin Vite HMR behavior lacks end-to-end coverage.

Medium

  • frontend/vite.config.ts:75 — The HMR fix is covered only by a configuration-object assertion. The Playwright test uses the embedded production SPA, so it never starts Vite or exercises the HMR WebSocket. Page-origin routing could regress undetected. Add a gated browser integration test that runs Vite behind a non-loopback reverse proxy and verifies /__vite_hmr connects through the page origin, ideally by observing a hot update.

Reviewers: 2 done | Synthesis: codex, 13s | Total: 5m10s

mariusvniekerk and others added 5 commits August 9, 2026 19:43
The workspace refresh owner used crypto.randomUUID(), which browsers expose only in secure contexts. Plain-HTTP reverse proxies therefore crashed the sidebar before it could load any workspaces.\n\nUse Svelte's component-scoped identity so refresh ownership remains unique without depending on a secure-origin browser API.\n\nValidation: full frontend unit suite (3,873 passed, 2 skipped); focused sidebar suite (57 passed); frontend format, lint, kit-ui, Svelte, and Effect checks.

Generated with Codex (gpt-5.6-sol)
Co-authored-by: Codex <198982749+openai-codex@users.noreply.github.com>
Same-port reverse proxies already forward WebSocket upgrades, but the generated Vite client was told to dial the backend loopback address. For remote browsers, that address points at the browser machine instead of the development host.

Let Vite infer protocol, host, and port from the page origin by default. Explicit environment overrides remain available for asymmetric proxy setups.

Validation: focused Vite config suite (11 passed); isolated generated-client inspection; full frontend unit suite with two workers under host pressure (3,873 passed, 2 skipped); frontend format, lint, kit-ui, Svelte, and Effect checks.

Generated with Codex (gpt-5.6-sol)
Co-authored-by: Codex <198982749+openai-codex@users.noreply.github.com>
The component regression runs under jsdom, which cannot prove the shipped browser app survives a genuinely insecure HTTP origin. Loopback is also treated as trustworthy, so the existing full-stack server URL would not reproduce the failure.

Exercise the embedded SPA and real workspace API through a test-owned non-loopback reverse proxy. The browser preconditions and SQLite-backed workspace row now protect the remote HTTP workflow in both Chromium and Firefox.

Validation: mutation check against the old randomUUID call; full workspace-sidebar Playwright spec (26 passed, 6 skipped); full frontend unit suite (3,873 passed, 2 skipped); frontend format, lint, kit-ui, Svelte, and Effect checks.

Generated with Codex (gpt-5.6-sol)
Co-authored-by: Codex <198982749+openai-codex@users.noreply.github.com>
The insecure-origin regression needs a non-loopback address to reproduce browser security behavior. Running that listener during ordinary local E2E runs can expose the full-stack fixture to nearby network peers.\n\nRequire the isolated Docker E2E job to opt in. CI keeps the end-to-end proof without opening the listener on developer hosts.

Generated with Codex (gpt-5.6-sol)
Co-authored-by: Codex <198982749+openai-codex@users.noreply.github.com>
A Vite configuration test carried a developer-specific Tailnet hostname into the public pull request. Test fixtures must not preserve local machine or network identity.\n\nUse reserved example domains while retaining the same allowed-host and HMR override coverage.

Generated with Codex (gpt-5.6-sol)
Co-authored-by: Codex <198982749+openai-codex@users.noreply.github.com>
@mariusvniekerk
mariusvniekerk force-pushed the t3code/fix-workspace-tab-loading branch from e04ded9 to 538c870 Compare August 9, 2026 23:51
@roborev-ci

This comment has been minimized.

@mariusvniekerk
mariusvniekerk merged commit 81afd5d into main Aug 10, 2026
18 checks passed
@mariusvniekerk
mariusvniekerk deleted the t3code/fix-workspace-tab-loading branch August 10, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant