Skip to content

Fail-closed outbound clients: refuse to connect without Tor, in the dashboard and in the OS update verbs #4146

Done
4 of 4 issues completed

Description

@pithead-developer

What's the problem

Several outbound clients treat "no proxy" as "connect directly", so a single empty setting turns a Tor-only box into one that leaks.

  • bounded_get and bounded_request in the dashboard HTTP helper pass proxies straight to requests and never look at the URL. Nothing stops a public URL going out without a proxy.
  • requests treats an empty-string proxy as no proxy. tari_health builds proxies={"http": TOR_SOCKS_PROXY, "https": TOR_SOCKS_PROXY} with no guard. A test with an empty string produced a plain direct connection, so it is confirmed fail-open, not just likely.
  • TOR_SOCKS_PROXY defaults from the environment and can be set empty. Many callers then branch on it: xvb_client and notify_sinks use proxy if tor_proxy else None, and update_checker, price_feed, healthchecks and the Telegram clients take the proxy as a parameter and pass it on.
  • The OS update verbs have a test seam: a file named os-update-test-base in the working directory, owned by the running user, switches the release lookup and the bundle download to a plain curl with no Tor. Production builds ship the seam.
  • Every caller uses the same SOCKS credentials, so one purpose cannot be told apart from another at Tor.

What it impacts

Both appliance and DIY owners. A bad env value, a typo or a planted file sends update checks, price lookups, notifications and the OS bundle fetch straight to the home IP, which breaks the outbound-is-Tor-only promise. The seam needs a planted file, so it is a smaller risk, but it should not exist in a shipped image. The Healthchecks ping already goes over Tor today; it only needs the shared guard, not a route change.

How I found it

Code read of origin/develop plus the research for the Tor-only egress plan, checked by a second reviewer: dashboard/mining_dashboard/helper/http.py (no URL or proxy check), service/health/tari_health.py line 64 (unguarded proxy), client/xvb_client.py and service/notify/notify_sinks.py (if ... else None), and lib/pithead/47-os-update-helpers.sh (os_update_test_base, an ownership check on a file in $PWD). The empty-string behaviour of requests was tested directly. The reviewer also corrected an earlier claim: the direct branch in the OS download verb is only reachable through the seam, so the fix is gating the seam, not deleting a branch.

How important is it

High for 2.0.5. The owner ruled on 2026-11-16 ("all as recommended") that outbound is Tor only, and a client that fails open breaks that on its own, whatever the firewall does. This is step 2 of the rollout and must land before the firewall enforces (#4154 (step 9: enforce the firewall)), so a missed client shows up as an error, not as a silent leak. It needs no new infrastructure.

Acceptance criteria

  • bounded_get and bounded_request refuse any URL whose host is not a private IP literal (LAN, ULA, CGNAT) when no proxy is given, and raise before any socket opens.
  • An empty-string proxy, whether "", {"https": ""} or {"http": ""}, is treated as no proxy by that check.
  • The dashboard fails at import time with a clear message if TOR_SOCKS_PROXY is empty or unset.
  • No caller keeps its own "use a proxy if set" branch. A grep for if tor_proxy else None and if self.tor_proxy else None finds nothing in the dashboard source.
  • A unit test sets the proxy empty and asserts zero sockets are opened for each caller, including tari_health, xvb_client, update_checker, price_feed, healthchecks, notify_sinks and both Telegram clients.
  • With the test seam file present in a production-built image, os-check and os-download still go over Tor, and a shell test with an empty socks value exits non-zero with no connection. The seam still works in the KVM test builds.
  • Each outbound purpose (updates, probes, dashboard calls, notifications) uses its own SOCKS username, and a test shows two purposes get different circuits at Tor.
  • Run through [benchmark] Stability and mining impact of Tor-only egress #4155 (benchmark) (hours per arm, at most 24 h per run), hashrate, share acceptance and dashboard data freshness are unchanged and there are no new dashboard errors, compared with the control arm.

Possible solutions

Sub-issues

Sub-issues

4 of 4 Issues completed
Loading 4 sub-issues

Activity

  1. added this to the v2.0.5 milestone on Nov 16, 2026
  2. added
    dashboard
    security
    appliance
    operator-action
    on Nov 16, 2026
  3. removed
    operator-action
    on Nov 16, 2026
  4. pithead-developer commented on Nov 16, 2026

    @pithead-developer
    ContributorAuthor

    Note for the fail-closed seam: the #4139 backport brings lib/pithead/47a-os-update-channel.sh to develop, and it also calls os_update_test_base. If #4139 lands first, gate that call too. If this lands first, #4139 has to.

  5. added
    tracker
    on Nov 17, 2026
  6. pithead-architect commented on Nov 17, 2026

    @pithead-architect

    A local session judged this too big for one local session (Too big for one local session: pithead#4146 bundles four independent objectives across roughly 14 source files — a fail-closed guard in the dashboard HTTP helper, a mechanical sweep removing proxy branches from ~11 caller modules with zero-socket tests per caller, gating the OS-update test seam on a). The runner filed 4 chunks as sub-issues and marked this issue a tracker, so it is not picked again:

  7. added a commit that references this issue on Nov 22, 2026
  8. pithead-architect commented on Dec 1, 2026

    @pithead-architect

    Owner decision 2026-12-01: closing. All four parts (#4206, #4207, #4208, #4209) are merged. The one acceptance item no child covered, the benchmark run of up to 24 hours per arm with hashrate and share acceptance unchanged, is tracked in #4155. Closing this releases #4147 and the chain behind it.

    Models: claude-opus-5-5 (architect)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    appliancedashboardsecuritytracker

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions