Skip to content

sync#2701

Closed
Jish2 wants to merge 7 commits into
pingdotgg:mainfrom
Jish2:main
Closed

sync#2701
Jish2 wants to merge 7 commits into
pingdotgg:mainfrom
Jish2:main

Conversation

@Jish2
Copy link
Copy Markdown

@Jish2 Jish2 commented May 14, 2026

What Changed

Why

UI Changes

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Medium Risk
Updates credentialed CORS handling for browser API routes and changes dev networking behavior, which could inadvertently block/allow origins or affect local connectivity if the allowlist/host logic is wrong.

Overview
Enables safer credentialed CORS for browser-facing API routes by switching browserApiCorsLayer to HttpMiddleware.cors with credentials: true and a concrete origin allowlist (isAllowedBrowserApiCorsOrigin) covering loopback, .localhost, private LAN ranges, and Tailscale CGNAT, with new unit tests.

Improves dev LAN/Tailscale usability by rewriting configured web targets away from loopback when the page is served from a non-loopback hostname, and by adjusting Vite dev-server/HMR host handling when binding to 0.0.0.0/::.

Dev runner and tooling are updated to propagate --host to both T3CODE_HOST and HOST, preserve T3CODE_NO_BROWSER when not explicitly overridden, and ensure relevant env vars are included in turbo.json globals.

Reviewed by Cursor Bugbot for commit ea17fca. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add LAN/Tailscale support for dev server by rewriting loopback API URLs and hardening CORS

  • Adds isAllowedBrowserApiCorsOrigin in http.ts to validate credentialed CORS origins, allowing loopback, *.localhost, private IPv4 ranges, IPv6 ULA, and Tailscale CGNAT (100.64.0.0/10); all other origins are rejected.
  • Updates browserApiCorsLayer to use credentialed CORS and delegate origin checks to the new validator.
  • Adds rewriteConfiguredTargetLoopbackHostForPageHostname in target.ts so that when the web UI is served from a non-loopback host, httpBaseUrl and wsBaseUrl are rewritten from loopback to the page hostname.
  • Updates vite.config.ts so that wildcard bind hosts (0.0.0.0 or ::) cause HMR to use the page hostname rather than the wildcard address.
  • Passes HOST and T3CODE_HOST through to child processes in dev-runner.ts and adds both to Turbo's envPassThrough in turbo.json.
  • Behavioral Change: credentialed CORS responses are now only echoed for explicitly allowed origins; previously non-credentialed CORS was used.

Macroscope summarized ea17fca.

Jish2 added 7 commits April 29, 2026 00:17
Bun records the root package as a workspace dependency so the lockfile
matches package.json after install.

Made-with: Cursor
Include these in globalEnv so dev and web tasks invalidate when bind
address or HTTP base URL overrides change.

Made-with: Cursor
…OWSER

Set HOST alongside T3CODE_HOST so apps/web/vite.config.ts sees the bind
address. Stop deleting T3CODE_NO_BROWSER when the CLI omits --no-browser so
extendEnv:false runs preserve a parent shell export.

Made-with: Cursor
Replace wildcard CORS with credentials plus isAllowedBrowserApiCorsOrigin
(loopback, .localhost, private CGNAT/LAN ranges) so credentialed fetches
from LAN or Tailscale dev URLs succeed safely.

Made-with: Cursor
Map wildcard bind hosts to true for server.host and omit HMR host so the
client uses the page hostname instead of ws://0.0.0.0.

Made-with: Cursor
When env points at localhost but the UI is opened from LAN or Tailscale,
rewrite http/ws base URLs to the current page host so requests do not hit
the browser machine loopback. Add Vitest coverage for rewrite behavior.

Made-with: Cursor
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0583b415-1606-44d7-8541-42d17b8d8a24

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels May 14, 2026
@Jish2 Jish2 closed this May 14, 2026
@Jish2
Copy link
Copy Markdown
Author

Jish2 commented May 14, 2026

oops sorry just meant to sync

@Jish2
Copy link
Copy Markdown
Author

Jish2 commented May 14, 2026

:(

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ea17fca. Configure here.

if (!isLoopbackHostname(normalizeHostname(url.hostname))) {
return rawBaseUrl;
}
url.hostname = pageHostname;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IPv6 hostname rewrite silently fails due to missing brackets

Low Severity

When the page is accessed via an IPv6 address (e.g., http://[fd00::1]:5733/), pageHostname will be fd00::1 (the WHATWG URL getter strips brackets). Assigning this unbracketed IPv6 value via url.hostname = pageHostname is a silent no-op in the WHATWG URL API, because the colon is a forbidden domain code point and host parsing fails. The rewrite never actually takes effect for IPv6, leaving the URL pointing at localhost.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ea17fca. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant