Skip to content

Per-purpose SOCKS credentials: each outbound purpose gets its own Tor circuit #4209

Done
5 of 5 issues completed

Description

@pithead-architect

What's the problem

Parent pithead#4146: every dashboard outbound client uses the same SOCKS endpoint with no credentials, so one purpose cannot be told apart from another at Tor and none gets its own circuit. tor_heal already mints per-circuit identities by rewriting the proxy URL (service/health/tor_heal.py:125: TOR_SOCKS_PROXY.replace("://", f"://{circuit}:isolate@", 1)), showing the mechanism, but no caller uses purpose-specific credentials.

What it impacts

Forensic isolation and circuit hygiene for appliance and DIY owners: update checks, health probes, dashboard/XvB calls and notifications today share one circuit and are indistinguishable at Tor, weakening the Tor-only egress step.

How I found it

Split of pithead#4146 (its acceptance criteria: each purpose uses its own SOCKS username and a test shows two purposes get different circuits); the rewrite pattern is tor_heal.py:125 on origin/develop.

How important is it

Medium-high for 2.0.5. Tor isolates by SOCKS auth by default, so distinct usernames pay off as soon as callers differ — which the sibling caller-sweep child establishes. The Tor-side policy (SocksPolicy, SafeSocks, dedicated ports) is pithead#4152 and is explicitly out of scope here.

Acceptance criteria

  • Each purpose — updates, probes/health, dashboard calls (XvB/price), notifications (Healthchecks/Telegram) — connects with its own distinct SOCKS username carrying :isolate, derived from the validated TOR_SOCKS_PROXY setting the earlier children introduce.
  • A unit test shows two purposes construct different proxy URLs (credential visible in the construction, never logged).
  • On a live Tor (tier4-e2e), a test shows two purposes get different exit circuits, e.g. read the egress exit fingerprint through each purpose's proxy and assert they differ.
  • Credential material never appears in logs or errors (reuse the helper's secret-free failure classes).
  • Tor container config is not changed (pithead#4152 owns that).

Possible solutions

Parent's option: set a distinct user:isolate pair per client the way tor_heal already does — a small helper that takes the validated TOR_SOCKS_PROXY and a purpose label and returns the credentialed URL; callers from the sibling sweep consume it.

Parent: #4146

Worker brief: Test tier: GitHub tiers 1-3 for the construction unit tests, then tier4-e2e targeted (or the tor phase that runs the Tor egress probes) on the head for the different-circuits proof.

Child of pithead#4146. Lands AFTER the two dashboard siblings (helper guard + validated TOR_SOCKS_PROXY; caller branch sweep) — build the per-purpose URL on top of the validated setting and the sweep's call sites. Do not touch the Tor container config: pithead#4152 owns SocksPolicy/SafeSocks/ports. Do not touch pithead#4154 (firewall).

Give each purpose (updates, probes/health, dashboard XvB/price calls, notifications) its own SOCKS username with :isolate, constructed the way dashboard/mining_dashboard/service/health/tor_heal.py:125 rewrites the URL; align tor_heal onto the shared helper if it composes cleanly. Ensure the rewritten URL never reaches logs (check exception texts and the request_failure_class paths). Unit test: two purposes construct different URLs. Live proof: tier4-e2e shows two purposes exit different Tor circuits (assert exit fingerprints differ through each purpose's proxy). ruff check + format; no comments/docstrings.

Sub-issues

Sub-issues

5 of 5 Issues completed
Loading 5 sub-issues

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 #4207. Blocked on the two dashboard siblings this issue must land after, per its own spec ("build the per-purpose URL on top of the validated setting and the sweep's call sites"). Verified on origin/develop-v2.0.5 (eb33819): TOR_SOCKS_PROXY is still a raw os.environ.get in dashboard/mining_dashboard/config/config.py:171 — the validated import-time setting my acceptance criteria require ("derived from the validated TOR_SOCKS_PROXY setting the earlier children introduce") does not exist until #4206 lands (its PR #4260 is open, review-required, not merged); and the eight if tor_proxy else None caller branches that #4207 sweeps are still present with no PR for #4207 yet — the per-purpose credential must be wired into those swept call sites, and wiring the current branch shapes would recreate exactly the pattern #4207 deletes and conflict with both sibling diffs. Finished so far: read #4209, parent #4146 and siblings #4206/#4207, confirmed base-branch code state, confirmed no existing PR or commits for #4209 (worktree clean at base tip, nothing edited). Unblocking action: merge PR #4260 (#4206) and land the #4207 sweep — #4207 is listed as the blocker because it is the last of the pair to land (it itself lands after #4206), so closing it means both prerequisites are in; when it closes, this session builds the per-purpose credential helper and its unit + tier4-e2e circuit tests on top of the validated setting and swept call sites.

    The runner resumes this issue when that one closes.

  4. added
    blocked
    on Nov 20, 2026
  5. removed
    blocked
    on Nov 20, 2026
  6. added
    tracker
    on Nov 20, 2026
  7. pithead-architect commented on Nov 20, 2026

    @pithead-architect
    Author

    A local session judged this too big for one local session (Too big for one local session: the per-purpose credential change touches 11 product source files (the proxy-URL helper plus 10 caller modules across updates/health/dashboard/notify) and a tier4-e2e live leg, and each caller also needs its existing zero-socket/proxy test updated — well past the one-o). The runner filed 5 chunks as sub-issues and marked this issue a tracker, so it is not picked again:

  8. pithead-architect commented on Dec 1, 2026

    @pithead-architect
    Author

    All five children (#4320 to #4324) are closed and their PRs merged, so this tracker is done. Closing it so #4146 can close.

    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

    appliancedashboardneeds-triagesecuritysize:Mtracker

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions