Repository navigation
fix(responses_id_security): decrypt response ids for input_items follow-ups - #32269
mateo-berri merged 1 commit into
Conversation
Greptile SummaryThis PR fixes a missing entry in the
Confidence Score: 5/5The change is a two-line addition to an existing set/branch pattern already proven for identical follow-up routes; risk of regression is minimal. The code path for No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/proxy/hooks/responses_id_security.py | Adds alist_input_items to the responses API call type set and to the elif branch that decrypts data["response_id"], closing the gap that caused input-item follow-ups to fail with a model-not-found 400. |
| tests/test_litellm/test_responses_id_security.py | Adds two focused mock tests: one verifying response_id is decrypted for alist_input_items, the other asserting a cross-team access attempt raises HTTP 403 — both tests use no real network calls. |
Reviews (1): Last reviewed commit: "fix(responses_id_security): decrypt resp..." | Re-trigger Greptile
Greptile SummaryThis PR fixes a missing entry in the
Confidence Score: 5/5The change is a two-line addition that closes a gap in the hook's call-type allowlist; it has no effect on any other code path. Both changed files are small and self-contained. The hook fix correctly mirrors the established pattern for the other response follow-up routes, the new tests use mocks (no live network calls), cover both the success and the 403 path, and confirm the exact data mutation that was previously broken. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/proxy/hooks/responses_id_security.py | Adds "alist_input_items" to the responses_api_call_types set and to the elif branch that decrypts data["response_id"], correctly mirroring the existing pattern for aget_responses/adelete_responses/acancel_responses. |
| tests/test_litellm/test_responses_id_security.py | Adds two focused mock-only tests for alist_input_items: one for the happy-path decryption and one for the team-mismatch 403 case. No real network calls; all external dependencies are patched. |
Reviews (1): Last reviewed commit: "fix(responses_id_security): decrypt resp..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Relevant issues
Linear ticket
Part of LIT-4111
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewScreenshots / Proof of Fix
Live proxy against the real OpenAI API (
openai/gpt-4o-mini), DB-less, responses id security on by default:Before (proxy on
litellm_internal_stagingatf628b41400, port 53798): create a response, then list its input items with the encrypted id the proxy returnedFor contrast,
GET /v1/responses/{id}on the same encrypted id returns HTTP 200 on the same unpatched proxy, sinceaget_responsesis already in the hook's decrypt listAfter (proxy on this branch, same config and port): identical commands, and input_items now returns the real item list from OpenAI
Type
🐛 Bug Fix
Changes
The
ResponsesIDSecurityhook (on by default) encrypts theidreturned byPOST /v1/responsesand decrypts it again inasync_pre_call_hook, but only for the call types listed in itsresponses_api_call_typesset.alist_input_itemswas missing from that set, soGET /v1/responses/{response_id}/input_itemsforwarded the still-encrypted id to the router; the router could not decode the provider and model from it and failed with a 400 "You passed in model=None. There are no healthy deployments for this model". Every follow-up route that got its call type added to the set works (get, delete, cancel), which made input_items the odd one out. Reported by a customer; reproduced against bothopenai/gpt-4o-miniandazure/gpt-4o, so it is provider-agnosticThe fix adds
alist_input_itemsto the set and to the branch that decryptsdata["response_id"], which is exactly the keyget_response_input_itemsinlitellm/proxy/response_api_endpoints/endpoints.pypopulates from the path parameter. This also means the hook's user/team access check now runs for input_items follow-ups, closing the gap where the route skippedcheck_user_access_to_response_identirelyTwo regression tests were added to the existing
tests/test_litellm/test_responses_id_security.py: one assertsasync_pre_call_hookwithcall_type="alist_input_items"decryptsresponse_id, the other asserts a key from team A gets a 403 when listing input items of a response owned by team B. Both fail on the unpatched hookNote: there is a separate Azure-specific bug in how the upstream input_items URL is built (path segment appended after the query string), being fixed in another PR. On Azure deployments, input_items needs both fixes to work end to end