fix: remove SSRF sinks from API failure logging#2665
Merged
Conversation
Replace axios.getUri() calls in external-api, plexApi, and jellyfin-adapter with a small helper that builds log-safe request descriptors via plain string ops, and normalize base URLs on construction. Preserves per-request baseURL overrides and params in failure logs, and closes the CodeQL server-side-request-forgery alert on external-api.service.ts.
The added normalizeExternalApiBaseUrl used new URL(baseUrl), which CodeQL treats as a URL-construction sink. That gave its SSRF query a cleaner dataflow path from user config into every downstream axios request, producing four new alerts on the request call sites in external-api.service.ts. Removing the normalizer keeps only describeRequestTarget, which builds log strings via plain string ops and encodeURIComponent, and closes the original alert without introducing new ones.
maintainerr-automation Bot
added a commit
that referenced
this pull request
Apr 12, 2026
* fix: quiet noisy service logs * fix: clarify rule placeholders and Seerr helper copy * fix: track collection membership provenance (#2663) * fix: remove SSRF sinks from API failure logging (#2665) * fix: remove SSRF sinks from API failure logging Replace axios.getUri() calls in external-api, plexApi, and jellyfin-adapter with a small helper that builds log-safe request descriptors via plain string ops, and normalize base URLs on construction. Preserves per-request baseURL overrides and params in failure logs, and closes the CodeQL server-side-request-forgery alert on external-api.service.ts. * fix: drop base URL normalizer to keep CodeQL SSRF fix minimal The added normalizeExternalApiBaseUrl used new URL(baseUrl), which CodeQL treats as a URL-construction sink. That gave its SSRF query a cleaner dataflow path from user config into every downstream axios request, producing four new alerts on the request call sites in external-api.service.ts. Removing the normalizer keeps only describeRequestTarget, which builds log strings via plain string ops and encodeURIComponent, and closes the original alert without introducing new ones. --------- Co-authored-by: enoch85 <mailto@danielhansson.nu>
Contributor
|
🎉 This PR is included in version 3.6.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
Closes the critical CodeQL
js/server-side-request-forgeryalert on external-api.service.ts that was blocking #2664.The alert fired because
axios.getUri({ ...config, url: endpoint })was called purely to build a string for failure log messages. CodeQL treatsgetUrias a URL-construction sink, so user-providedendpointflowing into it lit up as SSRF — even though the result only ever reachedlogger.debug.Changes
lib/requestLogging.ts→describeRequestTarget(fallbackBaseURL, endpoint, config?): builds a log-safebase + path + querystring with plain string ops andencodeURIComponent. No URL parser, nogetUri.logRequestFailureandpostRollinguse the helper. Per-requestbaseURLoverrides andconfig.paramsare still reflected in failure logs.Every subclass of
ExternalApiService(servarr, seerr, tautulli, tmdb, tvdb, plextv, plexCommunity, internal) inherits the fix automatically.Notes
metadata.provider.plex.tvbaseURL overrides, tautullicmd=...params) that a naive fix would have lost.normalizeExternalApiBaseUrlhelper usingnew URL(baseUrl). CodeQL treated that as a new URL-construction sink and started flagging every downstream axios request. Reverted to keep the fix minimal.Test plan
yarn buildgreenyarn format:checkgreen