Skip to content

fix(server): probe only owned preview listeners - #16687

Merged
maria-rcks merged 6 commits into
pingdotgg:mainfrom
maria-rcks:fix/survey-preview-safe-discovery
Oct 10, 2026
Merged

maria-rcks merged 6 commits into
pingdotgg:mainfrom
maria-rcks:fix/survey-preview-safe-discovery

Conversation

@maria-rcks

@maria-rcks maria-rcks commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

automatic browser discovery used to send http requests to unrelated listeners, which could close binary-protocol servers. discovery now probes only listeners owned by t3 terminals, and skips a port if any listener at that port is unowned. explicitly configured loopback urls keep their paths and query strings.

verified the baseline scanner with pid-scoped real listener metadata: the binary listener received GET / and exited 23. the candidate terminal → websocket → browser card path discovered a real vite server on 8311 and opened its pairing page, while the unrelated binary listener received zero bytes and stayed alive. closing the owned terminal stopped its 8311 listener and removed its automatic card. native windows, desktop shell, mobile and relay/tunnel paths remain unverified.

before: actual scanner request closes the binary listener

after: owned web server discovered; unrelated listener receives zero bytes

before: actual scoped scanner sends GET and closes the binary listener

after: discovered web server opens in the browser

24 existing scanner tests, targeted lint, formatting and server typecheck passed on blacksmith.

implemented with gpt-6.1-sol in codex.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Oct 7, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This changes the default preview-discovery behavior by removing common-port fallback probing and gating automatic HTTP/TLS probes on T3 terminal ownership. The production path spans multiple platform-specific listener-discovery fallbacks, so the behavioral change requires human review.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 91bd5e97-37a3-438f-98dc-942d4c61146a

📥 Commits

Reviewing files that changed from the base of the PR and between 83591ea and 61c2e62.


📒 Files selected for processing (2)
  • apps/server/src/preview/PortScanner.test.ts
  • apps/server/src/preview/PortScanner.ts

💤 Files with no reviewable changes (2)
  • apps/server/src/preview/PortScanner.ts
  • apps/server/src/preview/PortScanner.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.



📝 Walkthrough

Walkthrough

PortScanner now limits automatic HTTP and HTTPS probes to listeners owned by registered terminal processes. Configured URLs remain eligible when listener discovery fails. Common-port probing was removed, and tests now use explicit URLs and registered process ownership.

Changes

Port scanning

Layer / File(s) Summary
Listener ownership and probe eligibility
apps/server/src/preview/PortScanner.ts, apps/server/src/preview/PortScanner.test.ts
Duplicate listener records clear terminal ownership when any record is unowned. Automatic HTTP and HTTPS probes skip listeners without terminal ownership. Tests register terminal processes and cover owned, unowned, and mixed-ownership listeners.
Configured URL scans and discovery fallback
apps/server/src/preview/PortScanner.ts, apps/server/src/preview/PortScanner.test.ts
Common-port probing was removed. When listener discovery fails or returns no listeners, scans use configured URLs. Integration tests use real loopback listeners and explicit URLs.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix


Merge Risk

Merge Risk: ⚪ Minimal · up to 61c2e

No actionable merge-blocking issue was found. Native Windows and relay paths remain unverified, but there is no evidence of a failure in those paths.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 83591

Automatic discovery becomes less intrusive by avoiding unrelated local services. Remaining uncertainty concerns concurrent terminal shutdown, incomplete listener visibility, and environments that have not been validated.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The affected sink is HTTP(S) probing of local endpoints. Automatic eligibility uses registrations from all known terminals; explicitly configured loopback targets remain eligible independently of terminal ownership.

Security Findings and Attack Paths

  • inferred — Stale PID registrations or incomplete listener visibility can weaken the ownership guarantee and permit requests to an unrelated local listener. These are residual limitations, not established PR-introduced attack paths: terminal inspection ordering and partial /proc acceptance predate the PR, and the base automatically probed discovered listeners without ownership authorization.

Trust Boundaries and Controls

  • observed — The new gate rejects unknown ownership and observed mixed ownership before automatic probing. Listener commands no longer request truncated output, and output-limit errors enter recovery rather than authorizing probes from a truncated command result. This does not establish complete visibility: /proc discovery still accepts one readable TCP table when the other cannot be read.

Hardening Proposals

  • proposed — As follow-up hardening, bind registrations to a live terminal generation, reject late inspection results after cleanup, revalidate ownership before dispatch and publication, and distinguish incomplete listener inventories from complete discovery.



Pre-merge checks | Passed 3 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check Warning The description explains the problem, implementation, verification evidence, screenshots, test results, and unverified platforms. It does not provide the required Scope and approval information or exp… Add a link to the triaged issue or maintainer approval discussion with the approval comment. If this fix qualifies as an obvious bug exemption, state that reason explicitly and explain why no prior approval was required.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: restricting preview probing to owned listeners.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Description check

Explanation

The description explains the problem, implementation, verification evidence, screenshots, test results, and unverified platforms. It does not provide the required Scope and approval information or explain why the focused fix qualifies for an exemption.



  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

# Conflicts:
#	apps/server/src/preview/PortScanner.test.ts
#	apps/server/src/preview/PortScanner.ts
@maria-rcks
maria-rcks merged commit 318201c into pingdotgg:main Oct 10, 2026
28 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Oct 10, 2026
## What's Changed
* feat(web): draft screen project picker is searchable by @juliusmarminge in pingdotgg/t3code#17664
* fix(server): report incomplete transcript usage scans by @maria-rcks in pingdotgg/t3code#15661
* fix(web): every resize-driven layout commits in the same frame by @maria-rcks in pingdotgg/t3code#17656
* fix(web): right panel and terminal drawer follow the pointer while dragging by @maria-rcks in pingdotgg/t3code#17657
* fix(web): terminal drawer keeps its height after the window shrinks by @maria-rcks in pingdotgg/t3code#17658
* perf(web): sidebar drags restyle only the sidebar by @maria-rcks in pingdotgg/t3code#17659
* fix(web): server browser page resizes while the panel is dragged by @maria-rcks in pingdotgg/t3code#17660
* fix(storage): make worktree cleanup work and show why it skipped by @maria-rcks in pingdotgg/t3code#17563
* test(usage): usage service tests keep their state directory until cache writes land by @tris203 in pingdotgg/t3code#17636
* fix(checkpoint): pulls and rebases no longer flood a turn's changed files by @t3dotgg in pingdotgg/t3code#17161
* fix(web): place notification icons after titles by @voltcrash in pingdotgg/t3code#12209
* fix(web): attachments on an open question are visible again by @tiliakoos in pingdotgg/t3code#15537
* fix(web): scale Files tree with interface font size by @Umais-Adeed in pingdotgg/t3code#8011
* fix(server): probe only owned preview listeners by @maria-rcks in pingdotgg/t3code#16687
* fix(chat): surface pending subagent questions on parents by @maria-rcks in pingdotgg/t3code#16634
* fix(web): section header chevrons point up when collapsed by @ZenderGoD in pingdotgg/t3code#14273
* fix(web): timeline divider pill shows a pointer, visible hover and focus ring by @jonesfionn101-dotcom in pingdotgg/t3code#15188
* fix(git): allow creating prs from dirty worktrees by @maria-rcks in pingdotgg/t3code#15625
* docs(install): polish binary install destination phrasing by @ege-arhan in pingdotgg/t3code#15732
* perf(server): keep passive terminal output flowing by @StiensWout in pingdotgg/t3code#17178
* fix(web): stop button icon no longer shifts on hover by @NK-Works in pingdotgg/t3code#16012
* fix(web): add bottom padding to expanded tool panels by @12ya in pingdotgg/t3code#16525
* fix(web): keep incremental highlighter return type portable by @luke2x in pingdotgg/t3code#17259
* fix(web): sidebar "Code" label no longer clips its letter tops by @akbarakma in pingdotgg/t3code#16134
* fix(tests): use POSIX paths for the simulated macOS device host by @Quicksaver in pingdotgg/t3code#17241
* fix(mobile): Android composer keeps the caret in view on AOSP-based keyboards by @bitmvk in pingdotgg/t3code#17492
* test(web): allow cold timeline imports on CI by @lastobelus in pingdotgg/t3code#16608
* fix(mobile): pinch zooms chat images on Android by @AKolenda in pingdotgg/t3code#15047
* fix(web): selected provider ring no longer clipped during panel resize by @jfortez in pingdotgg/t3code#17534
* docs(usage): OpenCode Go limits need a Go API key by @nexxeln in pingdotgg/t3code#15664
* fix(web): improve usage scanning indicator alignment by @AksharP5 in pingdotgg/t3code#15498
* fix(server): print pairing credential expiry as ISO timestamp by @kvnloo in pingdotgg/t3code#14128
* chore(ci): use GPT 6.1 Sol Max for check agents by @ishaanko in pingdotgg/t3code#14312
* fix(mobile): honor requested terminal native architectures by @bompus in pingdotgg/t3code#10709
* fix(server): keep preview browser connected after operation timeouts by @juliusmarminge in pingdotgg/t3code#17693
* fix(web): timeline divider focus ring stays inside the pill by @t3dotgg in pingdotgg/t3code#17702
* perf(desktop): reuse the prepared shell environment in the local backend by @Yash-Singh1 in pingdotgg/t3code#17384
* fix(web): align settings page widths by @diegoarff in pingdotgg/t3code#12158
* test(server): resolve the temp dir before matching the symlinked entrypoint by @ylcn91 in pingdotgg/t3code#9400
* fix(web): keep inline code pills intact when they wrap by @satyalyadav in pingdotgg/t3code#12038
* Revert "chore(ci): use GPT 6.1 Sol Max for check agents" by @maria-rcks in pingdotgg/t3code#17698
* fix(web): show the correct new thread shortcut in command palette by @vaishnavsm in pingdotgg/t3code#8513
* fix(desktop): declare macOS local network usage by @jsilets in pingdotgg/t3code#11922
* docs: add Scoop as Windows installation method by @Mostafa-Ben-Git in pingdotgg/t3code#10509
* fix(server): agents run in their own systemd scopes so an OOM kill spares the server by @t3dotgg in pingdotgg/t3code#17662
* fix(web): welcome wizard says where imported projects come from by @UzEE in pingdotgg/t3code#14584
* fix(web): cite works on responses that end before a tool call by @maria-rcks in pingdotgg/t3code#17713
* fix(desktop): sign Windows native addons by @Lumbreras2306 in pingdotgg/t3code#8206
* fix(server): track resumed subagent follow-ups as separate tasks by @Yash-Singh1 in pingdotgg/t3code#17696
* fix(web): nested corners follow their container's radius by @maria-rcks in pingdotgg/t3code#17695
* feat(web): pr panel actions confirm in place by @maria-rcks in pingdotgg/t3code#17710
* feat(web): reorder right panel tabs by dragging by @eimexdev in pingdotgg/t3code#17730
* fix(azure-devops): list pull requests with token sign-in and check out into worktrees by @maria-rcks in pingdotgg/t3code#17725
* fix(usage): keep one email in two workspaces as two accounts by @maria-rcks in pingdotgg/t3code#17711
* feat(pull-requests): hosts can report edit and resolve permissions per item by @juliusmarminge in pingdotgg/t3code#17667
* perf(server): run Git for Windows' real git.exe, not its launcher by @SunkenInTime in pingdotgg/t3code#17707
* fix(clients): restart continuations show as a T3 Code notice, not another agent's message by @juliusmarminge in pingdotgg/t3code#17723
* fix(mobile): browser picture in picture opens from the header button by @juliusmarminge in pingdotgg/t3code#17731
* feat(source-control): GitCafe lives in @t3tools/source-control-gitcafe by @juliusmarminge in pingdotgg/t3code#17681
* fix(web): add provider wizard no longer shifts sideways while it grows by @flamboh in pingdotgg/t3code#17292
* fix(web): PR search keeps the caret where you type by @flamboh in pingdotgg/t3code#17675
* fix(server): thread PR badges catch up when another environment reads the PR by @flamboh in pingdotgg/t3code#17729
* fix(server): refuse editor paths with line breaks or quotes when the editor is a Windows command shim by @juliusmarminge in pingdotgg/t3code#17749

## New Contributors
* @tiliakoos made their first contribution in pingdotgg/t3code#15537
* @Umais-Adeed made their first contribution in pingdotgg/t3code#8011
* @ZenderGoD made their first contribution in pingdotgg/t3code#14273
* @jonesfionn101-dotcom made their first contribution in pingdotgg/t3code#15188
* @ege-arhan made their first contribution in pingdotgg/t3code#15732
* @NK-Works made their first contribution in pingdotgg/t3code#16012
* @12ya made their first contribution in pingdotgg/t3code#16525
* @luke2x made their first contribution in pingdotgg/t3code#17259
* @akbarakma made their first contribution in pingdotgg/t3code#16134
* @Quicksaver made their first contribution in pingdotgg/t3code#17241
* @bitmvk made their first contribution in pingdotgg/t3code#17492
* @lastobelus made their first contribution in pingdotgg/t3code#16608
* @jfortez made their first contribution in pingdotgg/t3code#17534
* @diegoarff made their first contribution in pingdotgg/t3code#12158
* @ylcn91 made their first contribution in pingdotgg/t3code#9400
* @satyalyadav made their first contribution in pingdotgg/t3code#12038
* @vaishnavsm made their first contribution in pingdotgg/t3code#8513
* @jsilets made their first contribution in pingdotgg/t3code#11922
* @Mostafa-Ben-Git made their first contribution in pingdotgg/t3code#10509
* @UzEE made their first contribution in pingdotgg/t3code#14584
* @Lumbreras2306 made their first contribution in pingdotgg/t3code#8206

**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261010.2908...v0.0.46-nightly.20261010.2922

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261010.2922
github-actions Bot added a commit to davidvanderklay/t3code-flake that referenced this pull request Oct 10, 2026
## What's Changed
* feat(web): draft screen project picker is searchable by @juliusmarminge in pingdotgg/t3code#17664
* fix(server): report incomplete transcript usage scans by @maria-rcks in pingdotgg/t3code#15661
* fix(web): every resize-driven layout commits in the same frame by @maria-rcks in pingdotgg/t3code#17656
* fix(web): right panel and terminal drawer follow the pointer while dragging by @maria-rcks in pingdotgg/t3code#17657
* fix(web): terminal drawer keeps its height after the window shrinks by @maria-rcks in pingdotgg/t3code#17658
* perf(web): sidebar drags restyle only the sidebar by @maria-rcks in pingdotgg/t3code#17659
* fix(web): server browser page resizes while the panel is dragged by @maria-rcks in pingdotgg/t3code#17660
* fix(storage): make worktree cleanup work and show why it skipped by @maria-rcks in pingdotgg/t3code#17563
* test(usage): usage service tests keep their state directory until cache writes land by @tris203 in pingdotgg/t3code#17636
* fix(checkpoint): pulls and rebases no longer flood a turn's changed files by @t3dotgg in pingdotgg/t3code#17161
* fix(web): place notification icons after titles by @voltcrash in pingdotgg/t3code#12209
* fix(web): attachments on an open question are visible again by @tiliakoos in pingdotgg/t3code#15537
* fix(web): scale Files tree with interface font size by @Umais-Adeed in pingdotgg/t3code#8011
* fix(server): probe only owned preview listeners by @maria-rcks in pingdotgg/t3code#16687
* fix(chat): surface pending subagent questions on parents by @maria-rcks in pingdotgg/t3code#16634
* fix(web): section header chevrons point up when collapsed by @ZenderGoD in pingdotgg/t3code#14273
* fix(web): timeline divider pill shows a pointer, visible hover and focus ring by @jonesfionn101-dotcom in pingdotgg/t3code#15188
* fix(git): allow creating prs from dirty worktrees by @maria-rcks in pingdotgg/t3code#15625
* docs(install): polish binary install destination phrasing by @ege-arhan in pingdotgg/t3code#15732
* perf(server): keep passive terminal output flowing by @StiensWout in pingdotgg/t3code#17178
* fix(web): stop button icon no longer shifts on hover by @NK-Works in pingdotgg/t3code#16012
* fix(web): add bottom padding to expanded tool panels by @12ya in pingdotgg/t3code#16525
* fix(web): keep incremental highlighter return type portable by @luke2x in pingdotgg/t3code#17259
* fix(web): sidebar "Code" label no longer clips its letter tops by @akbarakma in pingdotgg/t3code#16134
* fix(tests): use POSIX paths for the simulated macOS device host by @Quicksaver in pingdotgg/t3code#17241
* fix(mobile): Android composer keeps the caret in view on AOSP-based keyboards by @bitmvk in pingdotgg/t3code#17492
* test(web): allow cold timeline imports on CI by @lastobelus in pingdotgg/t3code#16608
* fix(mobile): pinch zooms chat images on Android by @AKolenda in pingdotgg/t3code#15047
* fix(web): selected provider ring no longer clipped during panel resize by @jfortez in pingdotgg/t3code#17534
* docs(usage): OpenCode Go limits need a Go API key by @nexxeln in pingdotgg/t3code#15664
* fix(web): improve usage scanning indicator alignment by @AksharP5 in pingdotgg/t3code#15498
* fix(server): print pairing credential expiry as ISO timestamp by @kvnloo in pingdotgg/t3code#14128
* chore(ci): use GPT 6.1 Sol Max for check agents by @ishaanko in pingdotgg/t3code#14312
* fix(mobile): honor requested terminal native architectures by @bompus in pingdotgg/t3code#10709
* fix(server): keep preview browser connected after operation timeouts by @juliusmarminge in pingdotgg/t3code#17693
* fix(web): timeline divider focus ring stays inside the pill by @t3dotgg in pingdotgg/t3code#17702
* perf(desktop): reuse the prepared shell environment in the local backend by @Yash-Singh1 in pingdotgg/t3code#17384
* fix(web): align settings page widths by @diegoarff in pingdotgg/t3code#12158
* test(server): resolve the temp dir before matching the symlinked entrypoint by @ylcn91 in pingdotgg/t3code#9400
* fix(web): keep inline code pills intact when they wrap by @satyalyadav in pingdotgg/t3code#12038
* Revert "chore(ci): use GPT 6.1 Sol Max for check agents" by @maria-rcks in pingdotgg/t3code#17698
* fix(web): show the correct new thread shortcut in command palette by @vaishnavsm in pingdotgg/t3code#8513
* fix(desktop): declare macOS local network usage by @jsilets in pingdotgg/t3code#11922
* docs: add Scoop as Windows installation method by @Mostafa-Ben-Git in pingdotgg/t3code#10509
* fix(server): agents run in their own systemd scopes so an OOM kill spares the server by @t3dotgg in pingdotgg/t3code#17662
* fix(web): welcome wizard says where imported projects come from by @UzEE in pingdotgg/t3code#14584
* fix(web): cite works on responses that end before a tool call by @maria-rcks in pingdotgg/t3code#17713
* fix(desktop): sign Windows native addons by @Lumbreras2306 in pingdotgg/t3code#8206
* fix(server): track resumed subagent follow-ups as separate tasks by @Yash-Singh1 in pingdotgg/t3code#17696
* fix(web): nested corners follow their container's radius by @maria-rcks in pingdotgg/t3code#17695
* feat(web): pr panel actions confirm in place by @maria-rcks in pingdotgg/t3code#17710
* feat(web): reorder right panel tabs by dragging by @eimexdev in pingdotgg/t3code#17730
* fix(azure-devops): list pull requests with token sign-in and check out into worktrees by @maria-rcks in pingdotgg/t3code#17725
* fix(usage): keep one email in two workspaces as two accounts by @maria-rcks in pingdotgg/t3code#17711
* feat(pull-requests): hosts can report edit and resolve permissions per item by @juliusmarminge in pingdotgg/t3code#17667
* perf(server): run Git for Windows' real git.exe, not its launcher by @SunkenInTime in pingdotgg/t3code#17707
* fix(clients): restart continuations show as a T3 Code notice, not another agent's message by @juliusmarminge in pingdotgg/t3code#17723
* fix(mobile): browser picture in picture opens from the header button by @juliusmarminge in pingdotgg/t3code#17731
* feat(source-control): GitCafe lives in @t3tools/source-control-gitcafe by @juliusmarminge in pingdotgg/t3code#17681
* fix(web): add provider wizard no longer shifts sideways while it grows by @flamboh in pingdotgg/t3code#17292
* fix(web): PR search keeps the caret where you type by @flamboh in pingdotgg/t3code#17675
* fix(server): thread PR badges catch up when another environment reads the PR by @flamboh in pingdotgg/t3code#17729
* fix(server): refuse editor paths with line breaks or quotes when the editor is a Windows command shim by @juliusmarminge in pingdotgg/t3code#17749

## New Contributors
* @tiliakoos made their first contribution in pingdotgg/t3code#15537
* @Umais-Adeed made their first contribution in pingdotgg/t3code#8011
* @ZenderGoD made their first contribution in pingdotgg/t3code#14273
* @jonesfionn101-dotcom made their first contribution in pingdotgg/t3code#15188
* @ege-arhan made their first contribution in pingdotgg/t3code#15732
* @NK-Works made their first contribution in pingdotgg/t3code#16012
* @12ya made their first contribution in pingdotgg/t3code#16525
* @luke2x made their first contribution in pingdotgg/t3code#17259
* @akbarakma made their first contribution in pingdotgg/t3code#16134
* @Quicksaver made their first contribution in pingdotgg/t3code#17241
* @bitmvk made their first contribution in pingdotgg/t3code#17492
* @lastobelus made their first contribution in pingdotgg/t3code#16608
* @jfortez made their first contribution in pingdotgg/t3code#17534
* @diegoarff made their first contribution in pingdotgg/t3code#12158
* @ylcn91 made their first contribution in pingdotgg/t3code#9400
* @satyalyadav made their first contribution in pingdotgg/t3code#12038
* @vaishnavsm made their first contribution in pingdotgg/t3code#8513
* @jsilets made their first contribution in pingdotgg/t3code#11922
* @Mostafa-Ben-Git made their first contribution in pingdotgg/t3code#10509
* @UzEE made their first contribution in pingdotgg/t3code#14584
* @Lumbreras2306 made their first contribution in pingdotgg/t3code#8206

**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261010.2908...v0.0.46-nightly.20261010.2922

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261010.2922
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant