fix: cli and relay correctness/security bugs#3
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 72a0e29. Configure here.
| export function setSessionShared(id: SessionId, shared: boolean): void { | ||
| const raw = readRaw(); | ||
| const next = raw.sessions.map((s) => (s.id === id ? { ...s, shared } : s)); | ||
| writeRaw({ version: SCHEMA_VERSION, sessions: next }); |
There was a problem hiding this comment.
Prune writes bypass registry lock
Medium Severity
The listSessions function prunes stale entries by calling writeRaw without acquiring the registry lock. This creates a race condition with other locked registry mutations, potentially leading to session record loss or data corruption during concurrent operations.
Reviewed by Cursor Bugbot for commit 72a0e29. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Note
Medium Risk
Changes attach authorization and backend shared-state timing (security-sensitive) plus relay viewer teardown; behavior shifts for port-only attach and default telemetry.
Overview
This PR tightens attach authorization and relay/share correctness, plus several CLI UX and ops fixes.
Security & attach: Port-only attach now resolves the session id via
findSessionByPortwhen possible. When a backend is configured but the id stays"<unknown>", attach is refused instead of skipping authorization. Share flow awaits a heartbeat withshared: truebefore issuing a relay ticket so viewer checks don't race the periodic heartbeat.Relay & attach lifecycle: The attach client finalizes on
session.closed(so relay viewers don't hang on a lingering socket) and exposesforwardInputfor out-of-band bytes. The relay hub closes all viewers after broadcasting hostsession.closed. Prefix filter addsonForwardso an armed-timeout re-emits Ctrl+\ to the PTY/viewer instead of dropping it (with a test).Registry & release: Session registry writes use a best-effort file lock;
findSessionByPortis exported.wrapper --versionreadspackage.json. Install script default dir is~/.wrapper(not nestedbin/bin). Telemetry defaults off until an explicit preference exists (rcshell-hostentry no longer implies consent). Fly deploy uses an explicit concurrency block withcancel-in-progress: false.Reviewed by Cursor Bugbot for commit 72a0e29. Bugbot is set up for automated code reviews on this repo. Configure here.