Repository navigation
feat(proxy): admin-only /debug/report sharing the bug report environment - #42440
Conversation
…ronment fields Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ey with typed values Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
bugbot run |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…the B008 budget flat Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Review for PR #42440: Feat(proxy): Admin-only Security & Sanitization Analysis
|
… from the safe renderer, regenerate schema.d.ts Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…d budget maps in verbose /debug/report, single-exit scalar renderers Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
…ines detector allowlist entry Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
…merge main Keeps GET /debug/report limited to the same allowlist-only environment block the bug report link carries, so the endpoint lands low risk. The verbose walk (every key path, numbers, count-only operator maps) is deferred to a follow-up PR. Takes main's key-aware credential filter for the safe renderer Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…om /debug/report Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
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 892d9b4. Configure here.
TLDR
Problem this solves:
How it solves it:
GET /debug/reportreturns the bug report environment fields as JSONEnvironmentReportbuilder feeds the issue URL and the endpoint, one allowlist for bothUser Flow
Before: an admin asking support for help has no way to hand over version and config shape without redacting it by hand
{"detail":"Not Found"}After: one curl gives support the same facts the bug report link would put in a GitHub issue, with nothing operator-authored in it
surface,litellm_version,python_version,deploymentandconfig_linessuch aslitellm_settings.cache_params.type = localandmodel_list[*].provider = [openai]Relevant issues
Follow-up to #42065
Affected release
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Video walkthrough of this exact run at tip 892d9b4 (main 404, tip safe report for the admin, hostile config strings absent, viewer 403, internal user and no auth 401, real gpt-4o-mini call) is in the Slack thread: https://berriaillm.slack.com/archives/C0B302ZJU05/p1790098365878969?thread_ts=1789865287.481439&cid=C0B302ZJU05
Two proxies per side, one with 4 uvicorn workers and one with 1, started from main and from the tip with the same config, master key and
OPENAI_API_KEY. Base ports 18431 (4 workers) and 18441 (1 worker), head ports 18432 and 18442.$Kis the proxy admin master key,$NAis a virtual key with theinternal_userrole. Config, with placeholder values shaped like the strings an operator would not want in a report:Each status line below is
for i in $(seq 8); do curl -s -o /dev/null -w "%{http_code} " ... ; done, run against both the 4-worker and the 1-worker proxy of that side; both legs printed identical codesBefore (deba473, main at the time of the run)
Proxy admin
curl -s -o /dev/null -w "%{http_code} " -H "Authorization: Bearer $K" http://127.0.0.1:18431/debug/reportx8404 404 404 404 404 404 404 404Internal user key
curl -s -o /dev/null -w "%{http_code} " -H "Authorization: Bearer $NA" http://127.0.0.1:18431/debug/reportx8404 404 404 404 404 404 404 404No auth
curl -s -o /dev/null -w "%{http_code} " http://127.0.0.1:18431/debug/reportx8404 404 404 404 404 404 404 404Not in the OpenAPI schema
curl -s -H "Authorization: Bearer $K" http://127.0.0.1:18431/openapi.json | grep -c '"/debug/report"'0Real provider call
curl -s -o /dev/null -w "%{http_code} " -H "Authorization: Bearer $K" -H "Content-Type: application/json" -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"reply with ok"}],"max_tokens":3}' http://127.0.0.1:18431/v1/chat/completionsx8 in parallel200 200 200 200 200 200 200 200, all 4 workers (and the single worker on 18441) show CPU time consumedAfter (892d9b4)
Proxy admin
curl -s -o /dev/null -w "%{http_code} " -H "Authorization: Bearer $K" http://127.0.0.1:18432/debug/reportx8200 200 200 200 200 200 200 200curl -s -H "Authorization: Bearer $K" http://127.0.0.1:18432/debug/report | python3 -m json.toolfor s in acme-prod sk- postgres 10.0.0 hooks.example internal.corp; do echo -n "$s: "; curl -s -H "Authorization: Bearer $K" http://127.0.0.1:18432/debug/report | grep -ci "$s"; donecurl -s -H "Authorization: Bearer $K" "http://127.0.0.1:18432/debug/report?verbose=true"returns 200 with a body byte-identical to step 3: the query is not part of the route and is ignoredInternal user key
curl -s -o /dev/null -w "%{http_code} " -H "Authorization: Bearer $NA" http://127.0.0.1:18432/debug/reportx8401 401 401 401 401 401 401 401(the proxy admin route gate rejects before the handler; aproxy_admin_viewerkey reaches the handler and gets 403, shown in the video and covered intest_debug_utils.py)No auth
curl -s -o /dev/null -w "%{http_code} " http://127.0.0.1:18432/debug/reportx8401 401 401 401 401 401 401 401Not in the OpenAPI schema
curl -s -H "Authorization: Bearer $K" http://127.0.0.1:18432/openapi.json | grep -c '"/debug/report"'0Real provider call
curl -s -o /dev/null -w "%{http_code} " -H "Authorization: Bearer $K" -H "Content-Type: application/json" -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"reply with ok"}],"max_tokens":3}' http://127.0.0.1:18432/v1/chat/completionsx8 in parallel200 200 200 200 200 200 200 200, all 4 workers (and the single worker on 18442) show CPU time consumedType
🆕 New Feature
Caveats (if any)
Low
config_linescome fromproxy_config.configas loaded from YAML, so models added later through the DB or UI are not counted inmodel_list[*].provider(same scope as the bug report link today)/openapi.jsonon purpose;schema.d.tsstill carries its type because the generator includes hidden routesFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/b7cc1b2b8d9d48a8b6a62d6b3a5e01bc
Open in Devin Desktop: https://app.devin.ai/desktop/session/b7cc1b2b8d9d48a8b6a62d6b3a5e01bc?variant=devin
Note
Low Risk
Adds a gated debug read path with existing allowlisted config sanitization; BugReport is a structural refactor with tests asserting parity with issue URLs.
Overview
Introduces a shared
EnvironmentReport(versions, surface, deployment hint, allowlistedconfig_lines) and nests it underBugReport, so GitHub issue URLs and a new proxy endpoint use the same builder.Proxy: Adds admin-only
GET /debug/report(hidden from public OpenAPI) returning that environment JSON viabuild_proxy_environment_report(), reusing the same safe config line extraction as bug reports. Non–proxy-admin callers get 403.Bug report: Deployment metadata moves into
EnvironmentReport(SDK always reports pip; proxy reports Docker only when/.dockerenvexists). Issue URL generation reads nestedreport.environmentfields; behavior is covered by new/updated tests including hostile-config leakage checks.Reviewed by Cursor Bugbot for commit 892d9b4. Bugbot is set up for automated code reviews on this repo. Configure here.