Summary
When the PyPI version check fails (offline, PyPI down, rate limited, etc.), the tool incorrectly reports that a new version is available.
Where
user_scanner/utils/updater_logic.py, check_for_updates()
Details
get_pypi_version() catches any request failure and returns None:
def get_pypi_version(pypi_url):
try:
pypi_version = httpx.get(pypi_url, timeout=7).json()["info"]["version"]
except Exception as e:
print(e)
return None
return pypi_version
check_for_updates() compares this directly without checking for None:
if current_ver != latest_ver:
print(f"\n[!] New version available: {R}{current_ver}{X} -> {C}{latest_ver}{X}\n")
choice = input("Do you want to update? (y/n/d): ")
Since current_ver is always a real string, this is True on every failed check, producing:
[!] New version available: 1.4.1.9 -> None
Reproduced by mocking get_pypi_version to return None and calling check_for_updates() directly.
Impact
Fires on any network failure, not an edge case. Also feeds into update_self(), which uninstalls before reinstalling, so accepting the prompt while offline risks leaving the tool uninstalled.
Suggested fix
Skip the prompt when latest_ver is None.
I'd like to work on this myself.
Summary
When the PyPI version check fails (offline, PyPI down, rate limited, etc.), the tool incorrectly reports that a new version is available.
Where
user_scanner/utils/updater_logic.py,check_for_updates()Details
get_pypi_version()catches any request failure and returnsNone:check_for_updates()compares this directly without checking forNone:Since
current_veris always a real string, this isTrueon every failed check, producing:[!] New version available: 1.4.1.9 -> None
Reproduced by mocking
get_pypi_versionto returnNoneand callingcheck_for_updates()directly.Impact
Fires on any network failure, not an edge case. Also feeds into
update_self(), which uninstalls before reinstalling, so accepting the prompt while offline risks leaving the tool uninstalled.Suggested fix
Skip the prompt when
latest_ver is None.I'd like to work on this myself.