Conversation
…al polls The qBittorrent and SABnzbd auth middleware overwrote a shared in-memory *arr.Arr's Host/Token in place whenever a.Source == "auto", unconditionally — even when the incoming credentials were empty. When Sonarr/Radarr polled GET /torrents/info (or the SAB equivalent) with blank download-client credentials, they wiped the shared arr's Host and Token to "", corrupting the arr for every other consumer of the shared arr map — notably the repair service, which then rejects the arr with "arr not configured". Guard the mutation so it only overwrites when BOTH incoming credentials are non-empty, mirroring the empty-guard these functions already apply before their AddOrUpdate call. A poll with valid creds still populates/updates an auto arr; an empty-cred poll no longer wipes an already-populated one. Adds regression + positive tests to both the qbit and sabnzbd packages.
Davixk
force-pushed
the
fix/arr-credentials-wiped-by-empty-poll
branch
from
July 27, 2026 00:23
b035504 to
0de408c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What breaks: after Sonarr/Radarr have been polling for a while, every *arr starts reporting "arr not configured" until its host/token is re-saved in the UI. Repair sweeps fail for the same reason.
Why:
authenticateinpkg/server/qbit/context.goandpkg/server/sabnzbd/context.gooverwrites the shared*arr.Arr'sHost/Tokenin place whenevera.Source == "auto", unconditionally. A poll that arrives with blank download-client credentials therefore sets them to"". Because the*arr.Arris shared through the manager's arr map, that corrupts the entry for every other consumer, not just the polling request. The functions already apply an empty-credential guard a few lines lower, beforeAddOrUpdate— the in-place mutation just isn't covered by it.The fix: only adopt credentials from a poll when both
usernameandpasswordare non-empty. A poll with valid credentials still populates or updates an auto arr; an empty-credential poll no longer wipes one.Evidence: running in production on a ~47,000-entry library. Regression and positive tests added to both packages; the regression tests fail on
betawithout the change.