Skip to content

Support ProPR Connect tunnel endpoints seamlessly in desktop #1985

Closed

Description

@integry

Objective

Make a ProPR instance exposed through ProPR Connect usable as a first-class desktop endpoint. The repository currently calls this hosted Cloudflare path propr tunnel; preserve compatibility with that contract while using the user-facing ProPR Connect terminology.

Scope

  • Recognize and normalize the canonical bare hosted endpoint https://t-<instance-id>.propr.dev with no path, query, fragment, credentials, alternate port, lookalike suffix, or encoded-host ambiguity. Continue supporting ordinary validated HTTPS remote instances and loopback development endpoints.
  • Use the Connect origin directly for /api/status, all REST calls, pairing bootstrap/poll/revoke, and /socket.io/; do not require the tunnel to serve the Web UI root.
  • Use only the API-returned browser approval URL. Support the existing hosted approval contract (https://app.propr.dev/desktop/pairing?...&tunnel=t-...) and exact tunnel /api/desktop/pairings/.../browser fallback without synthesizing an approval URL from renderer input.
  • Make paste/add-profile UX identify a verified ProPR Connect endpoint and show clear offline, tunnel-disabled, incompatible-version, and revoked-auth states. Recovery after the tunnel returns must not require recreating the profile when its canonical origin is unchanged.
  • Treat an endpoint/origin change as a profile-generation change requiring fresh discovery and pairing. Never send the old origin credential, cookies, authorization events, or Socket.IO auth to the replacement endpoint. Keep all tokens in the main-process credential service.
  • Do not place tunnel tokens, pairing secrets, instance tokens, or private paths in URLs, deep links, renderer storage, logs, diagnostics, analytics, or error text. The desktop app does not own or restart cloudflared; local setup may link to the existing CLI workflow.

Automatic local discovery

  • Add a versioned, bounded, noninteractive machine-readable ProPR Connect discovery contract to the CLI (preferred user-facing shape: propr connect --json, with a compatibility alias to the current tunnel implementation if needed). It may report schema version, canonical public endpoint, instance id, configured/enabled/running/verified state, and safe compatibility metadata only. It must never emit the connector token, pairing/device secret, instance access token, environment contents, credential-presence oracle, or private filesystem paths. Human output must remain separate from JSON stdout.
  • The desktop main process may invoke this contract automatically only through an app-bundled or explicitly trusted CLI executable and a known setup root/profile; use argument-array execution without a shell, a minimal environment, hard timeout/cancellation, output-size cap, exit-code handling, and strict discriminated schema validation. The renderer receives only validated safe metadata. Never recursively scan user disks or parse stack .env directly.
  • Verify every discovered endpoint independently through bounded /api/status and compatibility discovery before presenting it. Require user confirmation before adding/switching a profile or beginning browser pairing. Discovery must not transfer authentication. Manual URL entry remains available when the CLI is absent, old, malformed, slow, or offline.
  • If multiple known roots yield endpoints, deduplicate by canonical origin and present explicit choices. A changed origin is not silently substituted for an existing profile; it follows the fresh-generation/re-pair rules above.
  • Add deterministic tests for JSON schema/version compatibility, secret absence, stdout/stderr separation, missing/old CLI, malformed/oversized output, timeout/abort, nonzero exit, hostile endpoint strings, duplicate roots, endpoint rotation, verification failure, and confirmation cancellation.

End-to-end validation

  • Add deterministic client/API/Electron/UI tests for the real t-<id>.propr.dev shape, hosted browser approval, REST and Socket.IO same-origin routing, tunnel down/up reconnect, origin rotation, Unicode/IDNA and suffix lookalikes, path/query rejection, and secret absence. Model the proxy locally in CI; do not require live Cloudflare access.

Dependencies and integration

Coordinate semantically with #1961, which owns remote pairing, credential custody, profile generations, and reconnect behavior. Reuse its single canonical window.proprDesktop bridge and DesktopCredentialService; do not create a parallel auth or connection stack. If #1961 has not landed in the transport epic, limit this PR to shared Connect endpoint classification/contracts and non-overlapping tests, then sync/reconcile before review.

Target the branch selected by base-1953-epic-desktop-transport-api; never target main. Do not merge this PR. It requires Ultrafix, exact-head independent review, green full CI, and final combined validation with #1961 before integration.

Part of #1950 and #1953.

Activity

  1. propr-dev commented on Aug 29, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using codex agent with gpt-5.6-sol model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: codex
    • Model: gpt-5.6-sol
    • Branch: 1985/gpt-5.6-sol-support-propr-connect-tun-20260829-2108-al6
    • Base Branch: 1953-epic-desktop-transport-api
    • Worktree: issue-1985-20260829-2108-gpt-5.6-sol-al6

    🔍 Track Task Execution

  2. integry commented on Aug 29, 2026

    @integry
    OwnerAuthor

    Requirement added after the initial AI task began: automatic local endpoint discovery is now part of acceptance. The implementation must expose a versioned secret-free propr connect --json-style CLI contract and invoke it only from the desktop main process with trusted executable/root, no shell, timeout/output bounds, strict schema validation, independent endpoint verification, and explicit user confirmation. If the in-flight implementation does not include this section, apply it as the first follow-up on the generated PR before review.

  3. integry commented on Aug 29, 2026

    @integry
    OwnerAuthor

    Security/operations addendum from the tunnel audit:

    • Do not rely on TLS origin alone if Connect tunnel hostnames can ever be deleted/reassigned. Define a stable non-secret instance identity in the versioned discovery/status contract, pin {canonicalOrigin, instanceIdentity} in the desktop profile, and perform a bounded unauthenticated compatibility/identity probe before any saved bearer is attached to REST or Socket.IO after startup/recovery. On identity mismatch, send no credential, stop reconnect, and require explicit re-pair. Alternatively, the Connect control plane must provide and test a hard non-reassignment guarantee; document which invariant is authoritative. Never use a GitHub installation id or connector token as this public identity.
    • propr tunnel on can leave an already-running API with stale API_PUBLIC_URL/FRONTEND_URL. Discovery must distinguish configured/enabled/running from API-confirmed readiness and surface restart-required rather than beginning a pairing flow. The seamless setup path should correspond to propr tunnel setup ... --start or its safe Connect alias.
    • Keep the current exact-origin approval redirect contract: initial approval may be the same-origin tunnel /api/desktop/pairings/:id/browser, which redirects to https://app.propr.dev/desktop/pairing?...&tunnel=t-.... Do not loosen approval URL validation to arbitrary hosted pages.
  4. integry commented on Aug 29, 2026

    @integry
    OwnerAuthor

    Seamless handoff addendum: the runtime already registers and validates a propr://connect protocol, but no adapter/UI currently consumes a Connect endpoint hint. Implement an endpoint-only handoff alongside local CLI JSON discovery. A bounded form such as propr://connect?url=<canonical-bare-https-origin>&name=<optional-display-hint> is untrusted input: parse and normalize in main, reject credentials/fragments/extra or duplicate parameters/oversize/control/encoded-host ambiguity, pass only safe endpoint metadata through the single canonical bridge, normalize again at the consumer, and require explicit confirmation followed by ordinary /api/status identity verification and browser pairing. Never accept a connector token, relay token, pairing/device secret, instance bearer, or auto-approval material in the URL. Never silently overwrite/switch an existing profile; deduplicate exact origin+identity and surface conflicts. Cover cold start, second instance, queued-before-renderer-ready delivery, cancellation, duplicate profile, changed identity, malformed/encoded URL, and secret-bearing parameter rejection. Preserve ordinary dashboard deep-link behavior and do not turn this into OAuth callback handling.

  5. added a commit that references this issue on Aug 29, 2026
  6. integry commented on Sep 4, 2026

    @integry
    OwnerAuthor

    Implemented by #1988, merged into 1953-epic-desktop-transport-api (1af8b44). Closing the completed child issue during epic issue/PR reconciliation. Final desktop integration and delivery remain tracked by #1950 / #1970; this does not claim a main-branch release.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions