Skip to content

fix: cli and relay correctness/security bugs#3

Merged
icanvardar merged 8 commits into
devfrom
fix/security-correctness-findings
Jun 19, 2026
Merged

fix: cli and relay correctness/security bugs#3
icanvardar merged 8 commits into
devfrom
fix/security-correctness-findings

Conversation

@icanvardar

@icanvardar icanvardar commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary

  • Prefix filter re-emits Ctrl+\ on armed timeout instead of dropping it
  • Installer uses ~/.wrapper (no nested bin/bin) and verifies checksum
  • Telemetry defaults off until explicit consent is recorded
  • CLI version reads from package.json (matches release/Homebrew)
  • Port-only attach is authorized (no more "" bypass); registry uses a lock
  • shared state is persisted before issuing the relay ticket
  • Attach completes on session.closed; relay closes viewers when the host session ends
  • Fly deploy uses an explicit concurrency mapping

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 findSessionByPort when possible. When a backend is configured but the id stays "<unknown>", attach is refused instead of skipping authorization. Share flow awaits a heartbeat with shared: true before 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 exposes forwardInput for out-of-band bytes. The relay hub closes all viewers after broadcasting host session.closed. Prefix filter adds onForward so 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; findSessionByPort is exported. wrapper --version reads package.json. Install script default dir is ~/.wrapper (not nested bin/bin). Telemetry defaults off until an explicit preference exists (rc shell-host entry no longer implies consent). Fly deploy uses an explicit concurrency block with cancel-in-progress: false.

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

@icanvardar icanvardar merged commit abd3faf into dev Jun 19, 2026
7 checks passed

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

Cursor Bugbot has reviewed your changes using high effort 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 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 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 72a0e29. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant