Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(relay): resolve cloudflared using the hydrated PATH #19444

MergedExotic209093(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/19444/headmerged by juliusmarminge View on GitHub

A service-started server can hydrate its login PATH after Effect's default ConfigProvider captured the startup environment. The relay resolver still reads PATH through Config, so cloudflared in the hydrated user path can remain invisible.

Read PATH from HostProcess.Environment when resolving the executable. Keep the explicit T3CODE_CLOUDFLARED_PATH override on Config and preserve override/managed/PATH priority and version validation.

Refs #4913's later cloudflared reproduction. This addresses the resolver's stale PATH; it does not rewrite systemd units or change provider discovery.

Verification on Windows with Node 24.19.0:

  • vp test run packages/shared/src/relayClient.test.ts -t 'observes hydrated PATH|rejects downloads whose checksum': 2 passed, 18 skipped. The updated regression first resolves missing, hydrates PATH after manager construction while Config remains stale, finds the binary, and verifies the explicit Config override. It now runs on Windows and Linux.
  • The hydrated-PATH regression fails against unchanged 519d64f6ce production source and passes with this fix.
  • Shared package typecheck, scoped lint/formatting, two source reviews, and git diff --check passed.
  • Full targeted file on Windows: 10 passed, 8 skipped, 2 existing platform fixture failures. The forced-Linux EBUSY fixture fails identically on unchanged source/tests; the lock fixture's hardcoded POSIX path does not match Windows Path output. Those fixtures are left unchanged. CI owns the Linux full-file run.
  • Upstream CI passed at 09fa062, including all 20 relay tests on Linux (508 ms).
  • No real cloudflared process, tunnel, service, or client was launched.

Implemented with GPT-6.1-Sol through the Codex harness in T3 Code.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at 09fa062

      Macroscope's review found this PR approvable — This is a focused bug fix that makes existing cloudflared PATH resolution observe server-side environment hydration without changing override or managed-binary behavior. The accompanying tests cover the regression on POSIX and Windows paths, and no product defaults or static-analysis settings are changed.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      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: d1de0e61-7767-4c4f-9510-8d741e8e6386
      📥 Commits

      Reviewing files that changed from the base of the PR and between 7ac952c630ef8a60d14ca8f6a0c7adce33db4bae and 09fa062219ccd114b7c53db74cb99889c49e39ea.

      📒 Files selected for processing: 2
      • packages/shared/src/relayClient.test.ts
      • packages/shared/src/relayClient.ts

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

      📝 Walkthrough

      Cloudflared executable resolution now reads PATH from the host environment instead of a cached configuration value. Tests provide host environments and cover PATH changes, explicit path overrides, and version selection.

      Changes: Cloudflared PATH resolution

      Layer / File(s)Summary
      Host PATH lookup and validation
      packages/shared/src/relayClient.ts, packages/shared/src/relayClient.test.ts
      resolvePathExecutable now reads trimmed PATH from HostProcess.Environment. Tests provide host environments and check PATH changes, explicit overrides, and version selection.

      Priority: ➖ Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to 09fa0

      The cloudflared lookup change is mergeable after normal checks; no concrete outstanding risk is identified.

      Security architecture risk: 🔵 Low · up to 09fa0

      This is a narrow change to local executable selection. Explicit overrides, managed-binary priority, and version checks remain intact, and no new remote attack path was established. Deployment permissions still determine whether the hydrated search path is trustworthy.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The relevant authority is execution under the server's process identity, with access to inherited environment values and the connector token when launched as a tunnel client. Hydrated PATH directories become eligible sources, but the evidence does not establish attacker write access to those directories or a cross-tenant or fleet-wide exposure.

      Trust Boundaries and Controls

      • observed — PATH remains a trusted local executable source. Candidates must be files, satisfy platform executable checks, and report a compatible version. Probing executes the candidate, so compatibility validation does not authenticate its publisher. These controls predate the PR; the changed trust input is the current environment rather than cached PATH.

      Resilience and Maintainability Implications

      • observed — Failed or timed-out version probes have zero cache lifetime, while successful probes are keyed by executable path, size, and modification time. The inspected transition preserves retry after missing or failed discovery without introducing a persistent resolution state. Installation serialization and staged activation are unchanged.
      Pre-merge checks: Passed 4
      Passed Passed checks: 4 passed
      Check nameStatusExplanation
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Title checkPassedThe title clearly and concisely describes the main change: relay now resolves cloudflared using the hydrated PATH.
      Description checkPassedThe description covers the problem, expected behavior, implementation, scope, referenced issue, verification results, known platform-specific test limitations, and agent attribution. It is sufficientl…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge merged this0395bf9

    5. juliusmarminge closed this

Sign in to join this conversation.