Skip to content

Remove every dashboard proxy branch; per-caller zero-socket tests #4207

Closed

Description

@pithead-architect

What's the problem

Parent pithead#4146 requires that no caller keeps its own "use a proxy if set" branch. Eight sites build probes = {...} if tor_proxy else None — client/xvb_client.py:203,228,266,323, service/health/update_checker.py:57, service/xvb/price_feed.py:65, service/notify/healthchecks.py:94, service/notify/notify_sinks.py:43, service/notify/telegram_notifier.py:60, service/notify/telegram_commands.py:190 — and service/health/tari_health.py, service/xvb/xvb_standby.py, service/data_setup.py, service/health/tor_heal.py pass the raw TOR_SOCKS_PROXY string. Both shapes fail open when the value is empty (a confirmed requests behaviour).

What it impacts

Same leak surface as the parent: notifications, Telegram sends, XvB calls, price and update checks can go direct on an empty setting even once the shared helper guards, if a caller builds its own proxies dict.

How I found it

Split of pithead#4146; the branch sites are the exact grep the parent's acceptance criteria name (if tor_proxy else None, if self.tor_proxy else None), confirmed on origin/develop.

How important is it

High for 2.0.5; this is the sweep that makes the parent's grep criterion true. Depends on the shared guard and validated setting landing first (sibling child: helper guard).

Acceptance criteria

  • grep -rn "if tor_proxy else None\|if self.tor_proxy else None" dashboard/mining_dashboard finds nothing.
  • Every listed caller passes the validated shared proxy setting to the bounded helpers unconditionally; no caller constructs a proxies dict from a raw env string.
  • For each caller — tari_health, xvb_client, update_checker, price_feed, healthchecks, notify_sinks, and both Telegram clients — a unit test drives its request path with the proxy cleared and asserts zero sockets are opened and the caller's existing failure contract holds (returns None / keeps last good, never raises to the loop).
  • Normal-path behaviour is unchanged with a valid proxy and private-IP targets.

Possible solutions

Mechanical deletion onto the shared guard: callers pass the validated setting from config; the helper's guard (sibling child) does the refusing. One new test module with one parametrized zero-socket case per caller.

Parent: #4146

Worker brief: Test tier: GitHub tiers 1-3 (dashboard-logic row); the zero-socket unit tests are the proof, no bench job by itself — the stack-level no-new-dashboard-errors check rides the parent rollout's tier4-e2e.

Child of pithead#4146. Lands AFTER the sibling child that adds the guard to helper/http.py and the validated TOR_SOCKS_PROXY setting in config/config.py — build on that, do not duplicate it.

Delete the if tor_proxy else None branches at client/xvb_client.py:203,228,266,323, service/health/update_checker.py:57, service/xvb/price_feed.py:65, service/notify/healthchecks.py:94, service/notify/notify_sinks.py:43, service/notify/telegram_notifier.py:60, service/notify/telegram_commands.py:190; switch service/health/tari_health.py, service/xvb/xvb_standby.py, service/data_setup.py, service/health/tor_heal.py from the raw string to the validated setting. Callers pass the proxy unconditionally.

Add one test module: per caller (tari_health, xvb_client, update_checker, price_feed, healthchecks, notify_sinks, both Telegram clients) drive the request with the proxy cleared (monkeypatch the setting or pass the shape the caller receives) and assert zero sockets opened plus the caller's existing fail-silent contract. Prove the suite is RED without the helper guard by pinning the sibling's behaviour only through the public helper interface, not by importing private names. No comments/docstrings. ruff check + format on changed files; GitHub tiers 1-3 green.

Activity

  1. added this to the v2.0.5 milestone on Nov 17, 2026
  2. added
    dashboard
    security
    appliance
    needs-triage
    size:M
    on Nov 17, 2026
  3. pithead-developer commented on Nov 20, 2026

    @pithead-developer
    Contributor

    Blocked on #4206. Blocked on the sibling change this issue is specified to build on. #4207's own brief says it "Lands AFTER the sibling child that adds the guard to helper/http.py and the validated TOR_SOCKS_PROXY setting in config/config.py — build on that, do not duplicate it." That sibling is #4206, whose PR #4260 is still open (MERGEABLE, no failing checks, at REVIEW_REQUIRED — the runner's review pipeline owns the merge; no human action needed). On the base origin/develop-v2.0.5 (eb33819) I confirmed: config.py:171 still reads TOR_SOCKS_PROXY from env with a default (no validated setting); helper/http.py has no refusal guard; all 10 "if ... tor_proxy else None" branch sites listed in the issue exist; and tari_health.py:64, xvb_standby.py:89, data_setup.py:64/73/81 and tor_heal.py pass the raw env string straight through. None of the acceptance criteria can be met without #4206's code merged: callers cannot import a validated setting that does not exist yet (defining it here is the forbidden duplication), and the per-caller zero-socket tests can only be green once the helper refuses before any socket opens. Finished so far: full recon — verified the base still carries every listed site, mapped the exact interface PR #4260 provides (import-time RuntimeError on empty TOR_SOCKS_PROXY in config.py; NoUsableProxy plus a private-IP-literal guard in bounded_get/bounded_request), and confirmed no open PR claims 4207. What unblocks: #4206 closing (PR #4260 merging); the runner then resumes this session and the implementation is mechanical onto that interface — delete the 10 branches, switch the 4 raw-string callers to the validated setting, add the one parametrized zero-socket test module, and prove RED-without-guard/GREEN on head with ruff plus GitHub tiers 1-3. No files were edited; the worktree is clean and nothing was pushed.

    The runner resumes this issue when that one closes.

  4. added
    blocked
    on Nov 20, 2026
  5. removed
    blocked
    on Nov 20, 2026
  6. pithead-developer commented on Nov 20, 2026

    @pithead-developer
    Contributor

    Merged in #4304.

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

    appliancedashboardneeds-triagesecuritysize:M

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions