Skip to content

Pass sandbox management auth from server#358

Merged
ben-fornefeld merged 1 commit into
mainfrom
fix/sandbox-management-auth-from-server
Jun 5, 2026
Merged

Pass sandbox management auth from server#358
ben-fornefeld merged 1 commit into
mainfrom
fix/sandbox-management-auth-from-server

Conversation

@ben-fornefeld
Copy link
Copy Markdown
Member

@ben-fornefeld ben-fornefeld commented Jun 5, 2026

Summary

  • pass sandbox SDK auth through a route-specific prop only for terminal and filesystem inspect
  • construct sandbox SDK auth headers in a server-only helper instead of inline in client-boundary JSX
  • keep client-safe AuthUser in the auth module models while AuthContext stays server-side
  • remove browser Supabase session lookups from sandbox SDK client helpers
  • update the e2b SDK to 2.27.1

Boundary check

  • client-only scan has no authContext/accessToken/access_token/server-auth imports
  • sandboxManagementAuth remains only on terminal and filesystem inspect client surfaces

@ben-fornefeld ben-fornefeld requested a review from drankou as a code owner June 5, 2026 22:58
Copilot AI review requested due to automatic review settings June 5, 2026 22:58
@cla-bot cla-bot Bot added the cla-signed label Jun 5, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 5, 2026 11:28pm
web-juliett Ready Ready Preview, Comment Jun 5, 2026 11:28pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented Jun 5, 2026

PR Summary

Medium Risk
Access tokens and team headers still reach client components for E2B SDK calls; behavior depends on server routes always gating pages (filesystem page newly enforces this).

Overview
Bumps the e2b SDK from ^2.14.0 to ^2.27.1 (lockfile also picks up newer tar / undici).

Sandbox terminal and filesystem inspect no longer call Supabase getSession() in the browser. Server routes build a sandboxManagementAuth object (createSandboxManagementAuth: API headers + userId) and pass it into DashboardTerminal, SandboxInspectView / SandboxInspectProvider, and openTerminalSandbox / Sandbox.connect.

AuthUser lives in @/core/modules/auth/models so dashboard client code does not import server auth types. The filesystem inspect page adds server-side auth and team slug resolution before rendering.

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

@ben-fornefeld ben-fornefeld changed the title Pass sandbox management auth from server temp: pass sandbox management auth from server Jun 5, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b18de9a12a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/app/dashboard/terminal/page.tsx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors dashboard sandbox SDK usage so that sandbox-management authentication (Supabase token + team header + user id) is provided by server-rendered routes and then passed into client-side helpers/components, instead of being fetched from the browser Supabase client at call time.

Changes:

  • Introduces a SandboxManagementAuth shape and threads it through terminal and sandbox-inspect client code.
  • Removes browser Supabase session lookups from terminal sandbox session logic and inspect connection logic.
  • Updates the terminal and filesystem inspect server pages to construct and pass sandbox-management auth headers from the server.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit/dashboard-terminal.test.ts Updates unit tests to pass sandboxManagementAuth instead of mocking browser Supabase session lookups.
src/features/dashboard/terminal/sandbox-session.ts Refactors terminal sandbox open/connect/create to use provided sandboxManagementAuth headers/userId.
src/features/dashboard/terminal/dashboard-terminal.tsx Updates terminal component API to accept and forward sandboxManagementAuth.
src/features/dashboard/sandbox/sandbox-management-auth.ts Adds shared SandboxManagementAuth interface.
src/features/dashboard/sandbox/inspect/view.tsx Threads sandboxManagementAuth into the inspect provider.
src/features/dashboard/sandbox/inspect/context.tsx Uses provided headers for Sandbox.connect instead of fetching browser session.
src/app/dashboard/terminal/page.tsx Constructs sandboxManagementAuth server-side and passes into the terminal client component.
src/app/dashboard/[teamSlug]/sandboxes/[sandboxId]/filesystem/page.tsx Fetches auth context + team id server-side and passes sandboxManagementAuth into sandbox inspect view.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ben-fornefeld ben-fornefeld force-pushed the fix/sandbox-management-auth-from-server branch from b18de9a to 92926d6 Compare June 5, 2026 23:07
@ben-fornefeld ben-fornefeld changed the title temp: pass sandbox management auth from server Pass sandbox management auth from server Jun 5, 2026
Comment thread src/features/dashboard/terminal/sandbox-session.ts
Copy link
Copy Markdown

@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.

There are 2 total unresolved issues (including 1 from previous review).

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 94193ff. Configure here.

Comment thread src/features/dashboard/terminal/sandbox-session.ts
@ben-fornefeld ben-fornefeld force-pushed the fix/sandbox-management-auth-from-server branch from 94193ff to fcb8dc9 Compare June 5, 2026 23:15
@ben-fornefeld ben-fornefeld force-pushed the fix/sandbox-management-auth-from-server branch from fcb8dc9 to 62da057 Compare June 5, 2026 23:22
@ben-fornefeld ben-fornefeld changed the title Pass sandbox management auth from server temp: pass sandbox management auth from server Jun 5, 2026
@ben-fornefeld ben-fornefeld force-pushed the fix/sandbox-management-auth-from-server branch from 62da057 to 2a747ca Compare June 5, 2026 23:27
@ben-fornefeld ben-fornefeld changed the title temp: pass sandbox management auth from server Pass sandbox management auth from server Jun 5, 2026
@ben-fornefeld ben-fornefeld enabled auto-merge (squash) June 5, 2026 23:31
@ben-fornefeld ben-fornefeld merged commit c539a4a into main Jun 5, 2026
15 checks passed
@ben-fornefeld ben-fornefeld deleted the fix/sandbox-management-auth-from-server branch June 5, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants