litellm/tests/unit/enterprise/proxy
Kerry Lu efe349de9f
fix(files): match every spelling of a provider file id in the ownership check (#51498)
* fix(files): match every spelling of a provider file id in the ownership check

enforce_provider_file_access matched the stored provider file id by exact string, and a Gemini output file
can be addressed as files/<id>, files%2F<id>, <id>/ or its full URL, all of which the Gemini file transformation
sends to the same file. Those spellings found no ownership row and fell through the no-row pass-through path.

canonical_provider_file_id collapses the spellings to the bare id; the ownership check looks up both the
spelling the caller sent and the canonical one, and store_batch_output_file_ownership stores the canonical id.

* fix(files): unwrap model-encoded ids and index canonical provider ids in ownership rows

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(files): assert the ownership lookup outcome instead of its query shape

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(files): map provider ids back to their unified file by canonical spelling

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* chore(files): record the bound on the ownership lookup's in filter

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(files): reduce any scheme or case wrapping files/<id> the way gemini does before the ownership lookup

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(files): bind the reverse lookup match with a walrus instead of a Final inside the loop

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(files): assert the provider id lookup covers the requested ids instead of its exact list

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit e8fc243a09)

* fix(files): keep non-Gemini storage URLs opaque so an upload name cannot index another key's provider id

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(files): judge the provider id resolver by the mapping it returns only

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-13 05:43:43 +00:00
..
auth refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
guardrails Return configured guardrail native findings (#49217) (#49460) 2026-10-31 23:37:45 +00:00
hooks fix(files): match every spelling of a provider file id in the ownership check (#51498) 2026-11-13 05:43:43 +00:00
management_endpoints fix(proxy): reject unknown guardrail names on key, user, team and project writes (#51080) 2026-11-11 19:28:45 -08:00
__init__.py ci: move caching, proxy-extras, gateway and enterprise tests into tests/unit and run them from litellm-tests (#42902) 2026-09-24 15:49:59 -07:00
test_afile_retrieve_returns_unified_id.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
test_audit_logging_endpoints.py ci: move caching, proxy-extras, gateway and enterprise tests into tests/unit and run them from litellm-tests (#42902) 2026-09-24 15:49:59 -07:00
test_batch_retrieve_input_file_id.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_batch_retrieve_registers_missing_output_file_id.py fix(proxy): save file details for every batch output file so they list and retrieve (#41761) 2026-10-08 18:51:45 -07:00
test_batch_retrieve_returns_unified_input_file_id.py ci: move caching, proxy-extras, gateway and enterprise tests into tests/unit and run them from litellm-tests (#42902) 2026-09-24 15:49:59 -07:00
test_batch_update_db_managed_output_file_id.py fix(responses): bill a background response once, on the first read or poll that sees it finished (#45703) 2026-10-15 11:00:14 -07:00
test_deleted_file_returns_403_not_404.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
test_enterprise_routes.py ci: move caching, proxy-extras, gateway and enterprise tests into tests/unit and run them from litellm-tests (#42902) 2026-09-24 15:49:59 -07:00
test_file_deletion_blocking.py fix(batches): stop unbillable batches from blocking file deletes and new-batch polling (#48752) 2026-10-28 12:19:36 -07:00
test_liteadmin.py feat(enterprise): bundle LiteAdmin Slack with native gateway login (#44444) 2026-10-03 17:28:18 -07:00
test_managed_files_access_check.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
test_managed_files_hook.py fix(files): match every spelling of a provider file id in the ownership check (#51498) 2026-11-13 05:43:43 +00:00