One function

_relay_host in leeguooooo/claude-code-usage-bar

The author described this change as fix(fp): loopback relays are not fingerprintable endpoints (#44). It counts as a record because the check below fails on the code as it stood at 5b7165850 and passes on ab6a6c43f, with nothing else changed between the two runs.

Fix saved2026-08-02
Sharing licenceMIT · LICENSE
Change size+7 3

What the code was meant to do, written into the code itself as a docstring

The relay host when ANTHROPIC_BASE_URL points off the official API, else None (official / unset). Same host-parsing as no-quota detection.

The change

11 def _relay_host(env: Dict[str, str]) -> Optional[str]:
2- """The relay host when ANTHROPIC_BASE_URL points off the official API,
3- else None (official / unset). Same host-parsing as no-quota detection."""
2+ """Remote relay host, or None for official, loopback, or unset URLs."""
43 base = (env.get("ANTHROPIC_BASE_URL") or "").strip()
54 if not base:
65 return None
76 from urllib.parse import urlparse
87 parsed = urlparse(base if "//" in base else "//" + base)
98 host = (parsed.hostname or "").strip().rstrip(".").lower()
10- if not host or host == _OFFICIAL_API_HOST:
9+ if not host or host == _OFFICIAL_API_HOST or host == "localhost":
1110 return None
11+ try:
12+ if ip_address(host).is_loopback:
13+ return None
14+ except ValueError:
15+ pass
1216 return host

The check that tells the two apart

failpass·tests/test_fp_risk.py::test_loopback_base_url_is_silent[HTTP://LOCALHOST:8787]

Check file tests/test_fp_risk.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it5b71658501c378a35dec3c917b18bb2e070a1069
Broken version dated2026-08-02
Moduleclaude_statusbar.fp_risk
Units changed_relay_host
Fingerprint77fd9b2f2c060ce7
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in leeguooooo/claude-code-usage-bar