Repository navigation
Description
What's the problem
Parent pithead#4146 (Tor-only egress, step 2). bounded_request and bounded_get in dashboard/mining_dashboard/helper/http.py pass proxies straight to requests and never look at the URL, so a public URL with no proxy connects directly. requests treats an empty-string proxy as no proxy (confirmed by direct test in the parent issue). TOR_SOCKS_PROXY in dashboard/mining_dashboard/config/config.py:171 defaults from the environment and can be set empty; there is no validated setting and no import-time failure.
What it impacts
Both appliance and DIY owners: a bad env value or typo sends update checks, price lookups, notifications and probes straight to the home IP, breaking the outbound-is-Tor-only promise. This is the guard every other step of the rollout leans on and must land before the firewall enforces (pithead#4154, step 9).
How I found it
Split of pithead#4146, whose code read (owner, checked by a second reviewer) located the ungarded pass-through in helper/http.py and the raw env read at config/config.py:171; the empty-string behaviour of requests was tested directly there.
How important is it
High for 2.0.5. The owner ruled on 2026-11-16 that outbound is Tor only; a client that fails open breaks that whatever the firewall does.
Acceptance criteria
bounded_request/bounded_getraise before any socket opens when the URL's host is not a private IP literal and no usable proxy is given, with the failure arequests.RequestException(subclass) so every caller's existing failure contract applies.- Private-IP-literal carve-out covers loopback, RFC1918, link-local, CGNAT 100.64.0.0/10, IPv6 ::1 and ULA fc00::/7; a hostname is never treated as private. Sequence with pithead#4147 (step 3): it owns the same private-literal rule for remote nodes — if a dashboard caller needs a LAN hostname, ask before allowing it.
proxies="",{"https": ""}and{"http": ""}each count as no proxy for the check, per scheme of the target URL.TOR_SOCKS_PROXYis read once into a validated setting at import; empty or unset fails the dashboard import with a clear message naming the variable.- Unit tests in
dashboard/tests/helper/anddashboard/tests/config/: guard matrix (public/private/IPv6/CGNAT/hostname; each empty-proxy shape), refusal asserts zero sockets opened (patchsocket.socket), and the import-time failure test. - The helper's guard must be parameter-driven (the
proxieskwarg), not reach into config, so callers can be tested with an empty proxy while config itself fails import when empty.
Possible solutions
Guard at the top of bounded_request so every caller inherits it (parent issue's recommendation). Validated setting beside TOR_SOCKS_PROXY in config/config.py, raising at that module's import.
Parent: #4146
Worker brief: Test tier: GitHub tiers 1-3 (this is the dashboard-logic row; name it in the PR body) — no bench job needed unless you also change a runtime surface outside the helper.
Child of pithead#4146. Add the fail-closed URL/proxy guard to dashboard/mining_dashboard/helper/http.py (bounded_request, bounded_get) and the validated import-time TOR_SOCKS_PROXY setting in dashboard/mining_dashboard/config/config.py. Do NOT touch caller modules — a sibling child issue sweeps their if tor_proxy else None branches and must land after this. Keep the guard parameter-driven so the sibling's per-caller zero-socket tests can drive it with an empty proxy.
Private-literal set: loopback, RFC1918, link-local, CGNAT 100.64.0.0/10, ::1, fc00::/7; hostnames are never private (pithead#4147 owns the matching rule for remote nodes — align, and ask if a caller seems to need a LAN hostname). Refusal must raise a requests.RequestException subclass before any socket opens. Empty-string proxy in any shape ("", {"https": ""}, {"http": ""}) means no proxy. Empty or unset TOR_SOCKS_PROXY fails config import with a clear message.
Tests in dashboard/tests/helper/ and dashboard/tests/config/, registered where pytest runs them. No comments or docstrings in code; house docs elsewhere. Run ruff check + format on changed files locally (make lint-py shape); full proof is GitHub tiers 1-3.
Activity
pithead-developer commentedon Nov 20, 2026
Question for the owner (found in review of #4260): the new fail-closed guard refuses any non-IP-literal host without a proxy, so a remote Monero node configured by hostname (
monero.remote.host, which config validation accepts today) makes the dashboard's Monero RPC client return no data and trigger node-down handling. The issue says to ask before allowing a LAN hostname. Options: (1) default, sequence #4260 behind #4147, which restricts remote nodes to private IP literals, so the regression never ships alone; (2) allow a hostname for the remote-node RPC via an explicit opt-in parameter on the helper; (3) accept the regression until #4147 lands. #4260 pins the current refusal with a test and states the regression in its body.pithead-developer commentedon Nov 20, 2026
Questions before work continues (answer here, then remove the
questionlabel):Remote Monero node configured by hostname (
monero.remote.host) is refused by the new guard, soget_info()returns None. Which behaviour do you want? (1) Default: sequence #4260 behind #4147, which restricts remote nodes to private IP literals, so the regression never ships alone; I would keep the refusal test as is and hold the merge. (2) Allow hostnames for the remote-node RPC through an explicit opt-in parameter on the helper, and I add a hostname test plus a mini-stack remote-hostname leg. (3) Accept the regression until #4147 lands.pithead-architect commentedon Nov 20, 2026
Ruling: Take neither (1) nor (2). Ship the refusal (your option 3), with the gaps the reviewer found closed. The owner already decided the hostname case on 2026-11-16 ("all as recommended"): outbound is Tor only, and #4147's acceptance criteria reject a hostname for
monero.remote.host/tari.remote.hostbefore any lookup. So option (2) would add a carve-out to the shared helper that #4147 then has to remove. It would also leak a direct DNS lookup and connection against that ruling. The "ask before allowing it" line in this issue only applies if you want to allow a hostname, and the answer is not to allow it. Option (1) is a deadlock: #4147 is blocked on tracker #4146, which closes only when this issue closes, so holding #4260 behind #4147 means neither can merge. Both issues are in v2.0.5, so the release ships the refusal and the validation-time rejection together. The gap exists only on develop. Before you ask for review again: (a) delete the unused_url_schemeatdashboard/mining_dashboard/helper/http.py:85. (b) Add a unit test with a hostnameMONERO_RPC_URLthat shows the guard raises arequests.RequestExceptionbefore any socket opens and thatget_info()returns None. (c) Keep the mini-stack on a private IP literal, since that is the end state #4147 enforces, but say in the PR body that this is why it changed, not that the invariant forced it. (d) Correct the body in place: remove the claim that no caller needs a LAN hostname, state the remote-hostname regression, cite this ruling and the 2026-11-16 decision, and say whether a Monero status of None sets off any automated action beyond the dashboard showing the node down. (e) Leave a comment on #4147 saying its migration message must also cover the dashboard's remote-node state, so the owner sees "hostname no longer allowed" and not just "node down". Tiers 1–3 are enough for this row, as the brief says. Return with a "Ready for review" comment.Fail-closed HTTP helper: refuse public hosts without a usable proxy (#…
pithead-developer commentedon Nov 20, 2026
Merged in #4260.