fix(proxy): wire general_settings SSRF allowlist to litellm globals - #32243
Conversation
general_settings.user_url_allowed_hosts was documented in SSRF errors but never applied at startup, so internal MCP/OpenAPI URLs stayed blocked. Co-authored-by: Cursor <cursoragent@cursor.com>
Greptile SummaryThis PR fixes a long-standing misconfiguration gap (issue #26599) where
Confidence Score: 5/5The change is safe to merge — it makes previously-inert admin config keys actually take effect without altering any existing behavior for deployments that never set those keys. The wiring is straightforward: one helper function called in three well-defined config paths, each covered by a new mock test. The null/string-coercion edge cases are explicitly tested and behave sensibly. No existing tests are weakened, and no critical path code is touched. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/proxy/proxy_server.py | Adds _normalize_user_url_validation and _apply_ssrf_general_settings helpers, then calls _apply_ssrf_general_settings in three places: initial config load, live DB overlay merge, and dashboard update_config_general_settings. Logic is correct; null handling asymmetry between allowlists (clears) and validation flag (no-op) is intentional and tested. |
| litellm/proxy/_types.py | Adds three new Optional fields (user_url_validation, user_url_allowed_hosts, provider_url_destination_allowed_hosts) to ConfigGeneralSettings with accurate docstrings so the YAML keys are recognized and validated by Pydantic. |
| tests/test_litellm/proxy/proxy_server/test_proxy_config.py | Adds a regression test confirming that SSRF fields in a YAML general_settings block correctly reach litellm.* globals after load_config, with proper teardown to restore originals. |
| tests/test_litellm/proxy/test_proxy_server.py | Adds two new tests: one covering null/string-"false" edge cases in load_config, another verifying that live update_config_general_settings calls propagate all three SSRF globals, including clearing allowlists with None. Tests use only mocks — no real network calls. |
| ui/litellm-dashboard/src/lib/http/schema.d.ts | Adds the three new SSRF fields to the ConfigGeneralSettings OpenAPI schema component so the dashboard TypeScript client reflects the updated API shape. |
Reviews (3): Last reviewed commit: "fix: clear ssrf allowlists from null set..." | Re-trigger Greptile
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Use list[str] in ConfigGeneralSettings and run gen:api so schema.d.ts matches the new SSRF general_settings fields. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@coderabbitai review |
|
bugbot run |
✅ Action performedReview finished.
|
|
(note: @Sameerlite I'm just testing out coderabbit and comparing it with bugbot. Don't treat any of the issues it comes up with as blocking for now) |
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Null validation disables SSRF guard
- Null user_url_validation values are ignored and string booleans are normalized before updating the SSRF validation global.
- ✅ Fixed: Dashboard updates skip litellm globals
- Dashboard and DB general-settings updates now immediately apply the SSRF allowlist and validation globals used at request time.
You can send follow-ups to the cloud agent here.
|
|
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Null allowlists skip global reset
- Updated SSRF settings application to assign allowlist globals whenever their config keys are present, including explicit null values, with regression coverage for load and update paths.
You can send follow-ups to the cloud agent here.
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 92722db. Configure here.
Summary
user_url_validation,user_url_allowed_hosts, andprovider_url_destination_allowed_hostsfromgeneral_settingsintolitellm.*globals during proxy startupConfigGeneralSettingsso they are recognized as validgeneral_settingskeysgeneral_settings, but onlylitellm_settingswas ever wiredBefore

After

Note
Medium Risk
Touches SSRF enforcement configuration and runtime globals; incorrect wiring could leave stale allowlists or unexpected validation behavior, though the change is intended to make documented admin settings effective.
Overview
Fixes #26599 by making proxy
general_settingsactually drive the SSRF globals thatvalidate_url()/safe_getalready read (litellm.user_url_validation,user_url_allowed_hosts,provider_url_destination_allowed_hosts).Adds
_apply_ssrf_general_settings(with string/"false"handling foruser_url_validationand explicit updates when keys are present, includingnullto clear allowlists) and calls it on initial config load, merged general_settings updates, andupdate_config_general_settingsso YAML and dashboard changes take effect without restart. Documents the three fields onConfigGeneralSettingsand extends the dashboard OpenAPI schema; regression tests cover load and live config updates.Reviewed by Cursor Bugbot for commit 92722db. Bugbot is set up for automated code reviews on this repo. Configure here.