Repository navigation
Description
What's the problem
Part of pithead#4209 (child of #4146). Every dashboard outbound client passes the validated TOR_SOCKS_PROXY verbatim, so all purposes share one Tor circuit. dashboard/mining_dashboard/service/health/tor_heal.py:125 and service/notify/healthchecks.py:118 already show the mechanism (base.replace("://", f\"://{label}:isolate@", 1)) but it is duplicated inline and no purpose-level label exists. Siblings #4206 (validated setting + fail-closed helper/http.py guard) and #4207 (caller sweep, all callers now on proxy_map(...)) are merged on develop-v2.0.5.
What it impacts
Foundation for forensic isolation of appliance/DIY egress: nothing can carry per-purpose credentials until one shared builder exists.
How I found it
Split of pithead#4209 after re-reading the merged siblings on origin/develop-v2.0.5 (ad76587).
How important is it
Blocking: the three caller-wiring children and the live tier4 child consume this helper.
Acceptance criteria
- In
dashboard/mining_dashboard/helper/http.py(no comments/docstrings), exactly: constantsPROXY_PURPOSE_UPDATES = "updates",PROXY_PURPOSE_HEALTH = "health",PROXY_PURPOSE_DASHBOARD = "dashboard",PROXY_PURPOSE_NOTIFY = "notify", anddef purpose_proxy(base, label)returningbase.replace("://", f\"://{label}:isolate@", 1). - Raises
ValueErrorwhenbasecontains no://orlabelis empty; the label is inserted verbatim (callers pass purpose constants oruuid.uuid4().hex). - A
requests/PySocks shape note is NOT written as a code comment; the existing PySocks non-empty-fields explanation stays only where it already is outside the edited hunk or moves to docs. - Unit tests added to
dashboard/tests/helper/test_http.py: two different purposes construct different URLs; same label is stable; the userinfolabel:isolate@is visible in the returned string before the first@; ValueError branches;refuse_direct_publicstill passes a credentialed proxy as usable. - No caller changes; docs that describe outbound egress as one shared circuit are corrected if any say so explicitly (check
docs/dev/manual-qa/diy/09-privacy-tor.md,docs/monitoring.md).
Possible solutions
The pinned one-function helper beside proxy_map; parameters-only, never reaching into config (the #4206 parameter-driven rule).
Parent: #4209
Worker brief: Test tier: GitHub tiers 1-3 (dashboard-logic row; name it in the PR body) — no bench job by itself. Add purpose_proxy(base, label) and the four PROXY_PURPOSE_* constants to dashboard/mining_dashboard/helper/http.py exactly as pinned in the Acceptance criteria; unit-test in dashboard/tests/helper/test_http.py (different purposes differ, userinfo present, ValueError branches, guard still passes credentialed proxies). Do not touch any caller module. ruff check + format; no comments/docstrings; local proof is uv run --extra test on the touched pytest modules plus make lint-py shape.
Activity
pithead-developer commentedon Nov 22, 2026
Merged in #4347.
Per-purpose proxy helper: purpose_proxy() builds credentialed SOCKS U…