GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Enforce allowed host and WebSocket origin checks on server ingress by juliusmarminge · Pull Request #1169 · pingdotgg/t3code Conversation
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- validate allowed hosts with `Schema.Trim` + `Schema.check` - normalize hosts via lowercase decode step - simplify CSV decode/encode by removing Effect-wrapped transforms
| const invalidAllowedHostIssue = (input: string) => | ||
| new SchemaIssue.InvalidValue(Option.some(input), { | ||
| message: `Invalid host "${input}". Expected bare host[:port], for example "app.example" or "app.example:443".`, | ||
| }); | ||
|
|
||
| const AllowedHost = Schema.Trim.pipe( | ||
| Schema.check( | ||
| Schema.makeFilter( | ||
| (input) => { | ||
| if (input.length === 0 || input.includes("://")) { | ||
| return invalidAllowedHostIssue(input); | ||
| } | ||
|
|
||
| const candidateUrl = `http://${input}`; | ||
| if (!URL.canParse(candidateUrl)) { | ||
| return invalidAllowedHostIssue(input); | ||
| } | ||
|
|
||
| const parsed = new URL(candidateUrl); | ||
| return parsed.username || | ||
| parsed.password || | ||
| parsed.pathname !== "/" || | ||
| parsed.search || | ||
| parsed.hash | ||
| ? invalidAllowedHostIssue(input) | ||
| : true; | ||
| }, | ||
| { identifier: "AllowedHost" }, | ||
| ), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Low src/main.ts:47
The AllowedHost validation accepts port-only inputs like :8080. When parsed as new URL("http://:8080"), parsed.hostname is empty ("") but parsed.host is ":8080". The code returns parsed.host.toLowerCase() without checking that parsed.hostname is non-empty, so :8080 passes validation as a valid host.
const parsed = new URL(candidateUrl);
if (
parsed.username ||
parsed.password ||
+ parsed.hostname === "" ||
parsed.pathname !== "/" ||
parsed.search ||
parsed.hash
) {In file apps/server/src/main.ts around lines 47-75:
The `AllowedHost` validation accepts port-only inputs like `:8080`. When parsed as `new URL("http://:8080")`, `parsed.hostname` is empty (`""`) but `parsed.host` is `":8080"`. The code returns `parsed.host.toLowerCase()` without checking that `parsed.hostname` is non-empty, so `:8080` passes validation as a valid host.
Evidence trail:
- apps/server/src/main.ts lines 47-76 (at REVIEWED_COMMIT): Shows AllowedHost validation logic that checks username, password, pathname, search, hash but NOT hostname
- Node.js URL documentation (https://nodejs.org/api/url.html): Confirms that `new URL("http://:8080")` has `hostname = ""` and `host = ":8080"`, and `URL.canParse("http://:8080")` returns true
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
new URL("http://" + input).host instead of the raw lowercased input, which strips trailing slashes and ensures consistency with normalizeRequestHost.parsed.host instead of the raw input also strips default ports (e.g. :80), since the WHATWG URL parser's .host property omits default ports for the scheme.Or push these changes by commenting:
@cursor push ec7629b2b1
diff --git a/apps/server/src/main.ts b/apps/server/src/main.ts --- a/apps/server/src/main.ts +++ b/apps/server/src/main.ts @@ -74,7 +74,13 @@ { identifier: "AllowedHost" }, ), ), - Schema.decodeTo(Schema.String, SchemaTransformation.toLowerCase()), + Schema.decodeTo( + Schema.String, + SchemaTransformation.transform({ + decode: (input) => new URL(`http://${input}`).host, + encode: (input) => input, + }), + ), ); const AllowedHostsCsv = Schema.String.pipe(
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ), | ||
| ), | ||
| Schema.decodeTo(Schema.String, SchemaTransformation.toLowerCase()), | ||
| ); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Low Severity
The AllowedHost schema stores the lowercased original input string, so an entry like "app.example/" passes validation (because parsed.pathname === "/" satisfies the !== "/" guard) but is stored as "app.example/" with a trailing slash. Meanwhile, normalizeRequestHost returns parsed.host which is "app.example" without a slash. The allowedHostSet.has(requestHost) check therefore never matches, silently creating an allowlist entry that blocks all requests rather than permitting the intended host.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ), | ||
| ), | ||
| Schema.decodeTo(Schema.String, SchemaTransformation.toLowerCase()), | ||
| ); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Low Severity
AllowedHost stores the lowercased original input string via SchemaTransformation.toLowerCase(), but normalizeRequestHost extracts parsed.host from a http:// URL, which strips the default HTTP port (80) per the WHATWG URL spec. This means an entry like "app.example:80" passes validation and is stored as "app.example:80", but incoming requests with Host: app.example:80 produce "app.example" (no port) from normalizeRequestHost, so allowedHostSet.has(requestHost) always returns false — silently blocking the host rather than allowing it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Adding, at edit: or a |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
the remote mode will be more of a first class citizen soon and we'll make sure things are super solid when we get there for sure! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Merges `pingdotgg/t3code` `main` at `3962ae8586` (96 commits since `e536bfd33b`) into the fork. One merge commit; the tracker entry in `docs/fork/upstream-merge-log.md` has the full decision list. ## Conflicts (8) - **`ChatView.tsx`** (`converged`): upstream pingdotgg#19869 replaced `useCallback` with plain functions plus `useStableCallback`. I took upstream's file and re-applied each fork delta in that style: the sandbox start for scripts, the draft-thread create and host-run path in `runProjectScript`, Workspace script saves, the sandbox surface, file retargeting, the announced preview and terminal effects, the sandbox-commands banner, the PR-surface gate and the thread-fork dialog. **This file is the one to review closely.** - **`rightPanelStore.ts`** / **`FilePreviewPanel.tsx`**: the fork's `retargetFile` sits beside upstream's new `navigateFolder` and `folderTrail` (pingdotgg#15045). - **`ci.yml`**: upstream folded the `typecheck` job into `build` (pingdotgg#19633). The Moatless spec check now follows `build`'s final `Typecheck` step. - **`Sidebar.tsx`, `ProjectSettingsPanel.tsx`**: upstream's code plus the fork's additions. - **`index.html`**: kept the Moatless title. Added a `branding-shell` path-policy entry for it and `branding.ts`. - **`source-control-github/package.json`**: took upstream's new `generate` script and kept `tsc --noEmit` (the `tsc-rs` tripwire). - **`pnpm-lock.yaml`**: took upstream's copy, stripped `tsc-rs`, and re-derived it with a real install. Merge stats: 738 files landed against 736 in the upstream range. The one upstream file that didn't land is `index.html`, whose only upstream change was the title. The three extra landed files are fork docs. The fork delta is 815 files. ## Contract - Added `UnsupportedMethodError` to `orchestration.subscribeCommandOutput` and `server.getDatabaseStorage`. Both are new upstream methods Moatless doesn't dispatch. - Moatless now serves 11 more `pullRequests.*` reads (moatless pingdotgg#1161, pingdotgg#1164, pingdotgg#1169). They share `PullRequestRpcError` with methods it still refuses, so the union keeps `UnsupportedMethodError`. The 11 are declared as `pull-requests-*-shared-union` exceptions in `inventory.json`, which retire together once the rest of the family is served. ## Also in this PR `sandboxSurfaces.test.ts` had been red on `main` since `95dcaca54f` made the `pull-request` surface sandbox-independent without updating the test. The test and module doc now match the code. ## Verification Duplicate-adds, tripwires, resolution-check, unsupported-methods, lockfile, format, lint, typecheck and the production build are all green. The full test pass hit its one-hour deadline, so I ran the remaining packages one at a time. These still fail when run alone, in the same files the 2026-10-15 merge logged as sandbox failures: - `shared`: `AgentScope` - `t3`: `ServerBrowserPage`, `AcpAdapterV2` - `provider-opencode`: `OpenCodeServerLedger` - `ssh`: `tunnel.test.ts` `t3`'s `OrchestratorReplayFixtures` `claude_result_is_error` fails only because this sandbox sets `CLAUDE_CONFIG_DIR`; it passes with that unset. Every other package passes. ## Upstream features ### Usable as-is - Folder breadcrumbs navigate to parent folders (pingdotgg#15045). - Chat view, composer and sidebar no longer keep old renders alive (pingdotgg#19869, pingdotgg#19852). - Thread list cache saves without re-encoding every thread (pingdotgg#19915). - React Compiler runs natively (pingdotgg#20114). - Linked pull requests are virtualized (pingdotgg#20107). - A linked PR can be dragged into the composer as a context chip (pingdotgg#20102). - HTML renders show a skeleton and open images in the image viewer (pingdotgg#19654, pingdotgg#20036). - Model picker search lists the newest models first (pingdotgg#18494). - Wrapped split diffs stop jumping while scrolling (pingdotgg#20022). - Text selection continues under the turn minimap (pingdotgg#16748). - Sent queued messages say "from queue" (pingdotgg#19849). - Settings stay compact with many connected machines (pingdotgg#19744). - Middle-click and a setting to open PR links on GitHub (pingdotgg#19854, pingdotgg#19719). - Text generation no longer falls back to the flagship model (pingdotgg#19722). - Pending context handoff is hidden on threads with no sent message (pingdotgg#20033). - Mobile and desktop changes don't affect the fork's web client. - Not taken: the Beta branding (pingdotgg#20032). ### Unsupported in Moatless / needs implementation - **Live command output** (pingdotgg#15094): `orchestration.subscribeCommandOutput`, shown in `CommandOutputPanel.tsx` behind `capabilities.commandOutputStreaming`. Covered by the new union entry. - **Database storage notice and `t3 doctor` reclaim** (pingdotgg#19436, pingdotgg#19437): `server.getDatabaseStorage`, shown in `DatabaseStorageNotice.tsx` behind `capabilities.databaseStorage`. Covered by the new union entry. - **Delete a branch after its PR merges or closes** (pingdotgg#19257): a `pullRequests.runAction` option. The action is refused here. - **Device setup through a remote device host only** (pingdotgg#20077): behind `FEATURES.deviceHub`. ### Backend behavior to consider reproducing in Moatless - Resumed Claude subagents keep updating their own thread and pick up the parent's renamed worktree branch (pingdotgg#20061, pingdotgg#20079). - Steering no longer ends running subagents (pingdotgg#19210). - Worktrees shared by subagents are cleaned up, and orphaned ones are reported (pingdotgg#19748, pingdotgg#19749). - Superseded history is compacted in the background (pingdotgg#19435). - A run whose provider stream ends without a terminal event fails instead of hanging (pingdotgg#19131). - One malformed ACP session update no longer ends the session (pingdotgg#20015). - A dropped HTTP/2 connection no longer crashes the server (pingdotgg#18378). - PR refreshes are bounded by tracker reads (pingdotgg#19403). - Cursor threads in Auto use Cursor's Auto-review (pingdotgg#19712). - Grok health checks no longer start its updater (pingdotgg#18075). - Expanding a wide ignored folder no longer classifies every child (pingdotgg#20062). - OTLP exports name the machine and build they came from (pingdotgg#19370). Recorded in `docs/fork/gaps.md` under "Runtime fixes upstream made to its own server". 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- Moatless task: https://moatless.soaplabstest.com/tasks/d6f425f2-8234-412e-8189-1c71b309c04a
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.