Skip to content

[WRONG BRANCH] Require operator-paired GUI sessions for Remote Workspace mutations - #531

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-remote-workspace-vulnerability
Draft

luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-remote-workspace-vulnerability

Conversation

@luvs01

@luvs01 luvs01 commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Motivation

  • The Remote Workspace mutation surface previously accepted any gui-session principal, which can be minted and replayed by local non-browser processes and thus did not guarantee interactive, operator-mediated dashboard consent.
  • The change closes this consent gap by distinguishing sessions issued via the operator-mediated GUI pairing flow from automatically bootstrapped loopback/Tailscale sessions and restricting mutation authority accordingly.

Description

  • Add isPaired to ManagementSessionControl and implement currentSession(...) to re-evaluate session provenance using the full GUI session predicate (src/server/management-auth.ts).
  • Require an operator-paired GUI session for Remote Workspace mutations at the management namespace gate in handleRemoteWorkspaceRoutesOnDemand (src/server/management-api.ts) and at route-level checks via sessionOnly (src/server/management/remote-workspace-routes.ts).
  • Update focused tests to assert paired vs. non-paired session behavior (tests/clients/remote-workspace-management.test.ts, tests/server/server-management-auth.test.ts).
  • Update architecture and user docs to explain the operator pairing requirement and that automatically-bootstrapped sessions remain read-only for Remote Workspace control (structure/remote-workspace.md, docs-site/src/content/docs/guides/remote-workspace.md, docs-site/src/content/docs/reference/management-api.md).

Testing

  • Ran the focused unit/integration tests for the changed subsystem: npx --yes bun@latest test tests/server/server-management-auth.test.ts --test-name-pattern 'remote session admission shares' and npx --yes bun@latest test tests/clients/remote-workspace-management.test.ts, both passed.
  • Typecheck and repo invariants passed with bun run typecheck and bun run structure:check and privacy scan with bun run privacy:scan (all succeeded).
  • Built the docs to validate updates with (cd docs-site && bun install --frozen-lockfile && bun run build), which succeeded.
  • The full test suite was exercised in CI-like runs; unrelated environment/timing-sensitive tests outside the changed surface showed known transient failures, but all focused tests covering this PR passed.

Codex Task

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-14T01:37:38.411923Z d4b1f87 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: d2c15726-705c-4d02-a26c-82ddbca574f5


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.

@github-actions github-actions Bot added the bug Something isn't working label Sep 14, 2026
@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

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

Copy link
Copy Markdown

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: d4b1f87a11

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +160 to +163
if (ctx.req.method !== "GET" && (
ctx.principal !== "gui-session"
|| ctx.sessionControl?.isPaired(ctx.req, ctx.config) !== true
)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Provide a pairing path for automatically bootstrapped dashboards

When the Hub dashboard is opened directly, the page is automatically given a loopback or tailscale-identity session, but gui/src/App.tsx renders ConnectPairingForm only for a connected-client topology and only while no shared session exists. This new check therefore makes every Remote Workspace mutation return 403 without exposing any UI path to obtain the required pairing-issued session; even a manually paired session is replaced by an automatic one after reloading the Hub page. Add an in-dashboard upgrade path for these read-only sessions before enforcing this gate.

Useful? React with 👍 / 👎.

ctx.principal !== "gui-session"
|| ctx.sessionControl?.isPaired(ctx.req, ctx.config) !== true
)) {
return Response.json({ error: "A paired dashboard session is required for Remote Workspace changes." }, { status: 403 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the activation test for the new error response

For an enabled workspace mutation authorized as admin-token, this branch now returns the new “paired dashboard session” error, while tests/clients/remote-workspace-activation.test.ts still asserts the previous exact JSON string. That test will deterministically fail in the normal test suite, so its expected response must be updated with this behavior change.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot changed the title Require operator-paired GUI sessions for Remote Workspace mutations [WRONG BRANCH] Require operator-paired GUI sessions for Remote Workspace mutations Sep 14, 2026
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft September 14, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant