Skip to content

Replace silent CheckerMock fallback for Tor/I2P/DNS with explicit skip status #2664

Description

@soxoj

Problem

When the user does not pass --tor-proxy (or --i2p-proxy, or --with-domains), the corresponding checker is assigned a CheckerMock (maigret/checking.py:557) whose check() returns ('', 0, None). Every .onion / .i2p / domain entry in the database is then dispatched to that mock at maigret/checking.py:845–847 via options["checkers"][site.protocol].

A status_code of 0 is interpreted by _make_request at maigret/checking.py:158 as CheckError("Connection lost"). The end-user sees a "Connection lost" error for every .onion site instead of an honest "skipped because no Tor gateway is configured" signal.

This is misleading in three ways:

  • The site is not actually unreachable — it was never tried.
  • --print-errors is polluted with fake "Connection lost" entries (3 sites today: HiddenAnswers, DarkNet Trust, i2pforum).
  • Real connection-lost errors on clearweb sites become harder to spot.

Proposed fix

Either:

  • (a) extend MaigretCheckStatus (or reuse the existing ILLEGAL) and short-circuit dispatch when site.protocol in ("tor", "i2p") and the corresponding proxy is missing, returning an explicit SKIPPED — no Tor gateway configured status; or
  • (b) instantiate the proxied checker lazily, only after the dispatcher confirms a site needs it, and skip the site cleanly otherwise.

Acceptance

  • Running maigret <user> without --tor-proxy produces no "Connection lost" entries for .onion sites.
  • The CLI and JSON report visibly mark .onion sites as skipped, with a one-line explanation.
  • A regression test in tests/test_checking.py (new) verifies the dispatch path.

Code refs

  • maigret/checking.py:557 (CheckerMock definition)
  • maigret/checking.py:1105–1122 (the three bare # TODO comments above the mock fallbacks)
  • maigret/checking.py:158 (where status_code=0 becomes "Connection lost")
  • maigret/checking.py:845–847 (dispatch by site.protocol)

Related

  • Can't get Maigret to work on Tails over Tor? #544 (Tor/proxy documentation). The Tor-and-proxies docs page currently says ".onion sites are silently skipped", which is also inaccurate — merging this fix lets us tighten that wording.
  • Two of the three onion entries in data.json are also rotten today (DarkNet Trust uses a v2 onion address that Tor deprecated in October 2021); cleaning that up is a separate concern but is part of the same audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnetwork-problemsMostly network stack caused bugs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions