Repository navigation
fix(bedrock)!: use the S3 bucket passed to SDK file calls instead of requiring proxy config - #47601
Conversation
|
@greptileai review |
|
bugbot run |
[Medium impact] Appears safe to merge after #47496, with no new actionable issues found SummaryBedrock file calls now use the bucket passed by the SDK caller, with environment variables as fallback
Reviews (6) · Last reviewed commit: "Merge branch 'litellm_proxy_client_stora..." · Reviewed by Greptile |
…drop the proxy credential snapshot The SDK dropped s3_bucket_name before it reached Bedrock, so litellm.file_content with that kwarg failed with "S3 bucket_name is required" (LIT-9501). Bedrock file calls now read the bucket from the call, else AWS_S3_BUCKET_NAME, and the proxy passes the deployment's bucket settings as plain kwargs instead of a separate snapshot. Request-body bucket fields are gated by the proxy allowlist
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
e7b3930 to
8e1b809
Compare
|
@greptileai re review |
|
bugbot run |
…trieve The lookup only fed the removed bucket snapshot. The router now passes the deployment's bucket straight through.
|
@greptileai re review |
|
bugbot run |
…ocked at the HTTP edge
|
@greptileai re review |
|
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 22df560. Configure here.
|
@litereview guide |
…drock_files_trust_call_bucket # Conflicts: # litellm/litellm_core_utils/cloud_storage_security.py # tests/unit/llms/vertex_ai/files/test_vertex_ai_files_transformation.py
|
|
@litereview code-review |
✅ code-review5/5 · Ready for human reviewScope: full · Full PR review. No correctness findings. Checks and execution details
The PR description includes inspectable manual E2E evidence for that change. It names the real bucket and region, the real
The GitHub compare from
The title carries
I found no defect. Local run: the affected suites (Bedrock/Vertex files,
View review · Reviewed |
|
@ryan-crabbe-berri could you fix the Router init High and the error-text Low, and decide the server-snapshot Medium in Caveats? I'll review again after |
7da180a
into
litellm_proxy_client_storage_allowlist
Python SDK users who upload a Bedrock batch file to their own S3 bucket can't read, list or delete it after, because the SDK only trusted a bucket the proxy handed it. This PR makes the SDK use the bucket passed on the call, or the env var. It is only safe on top of #47496, so that one merges first
Breaking change: a per-model
allow_legacy_cloud_file_idsin the proxy config now takes effect where it was silently ignored before, and the missing-bucket error text changed, so admins who set that flag and anyone matching the old error text should check both before upgradingDetails
TLDR
Problem this solves:
How it solves it:
Intentional product change: the SDK now honors the bucket and legacy-flag params passed on the call, the proxy's per-model
allow_legacy_cloud_file_idstakes effect, and model-routed Bedrock batches go through the batch rate limiter. All three were skipped beforeUser Flow
Before: an SDK user can upload a batch file to their S3 bucket but can never read it back
litellm.create_file(..., custom_llm_provider="bedrock", s3_bucket_name="my-bucket")returns ans3://my-bucket/...idlitellm.file_content(file_id=<that id>, custom_llm_provider="bedrock", s3_bucket_name="my-bucket")raisesS3 bucket_name is requiredeven though they passed itAfter: the same read returns the file, and a file in another bucket is still refused
create_filereturns ans3://my-bucket/...idfile_contentreturns the file's linesfile_contentfors3://some-other-bucket/...while passingmy-bucketraisesfile_id bucket does not match the configured storage bucketRelevant issues
Fixes #45061
Stacked on #47496, which has to merge first. Replaces #47459
Linear ticket
Resolves LIT-9501
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<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 moreDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Setup. Real Bedrock batch in
us-east-1onlitellm-lit7720-batch-qa-888with Haiku 4.5, since Haiku 5.5 has no Bedrock batch here. SDK cases are one script,python sdk_cases.py(below), run from each tree's .venv with AWS keys set andAWS_S3_BUCKET_NAMEunset. It echoes each call as a>>>line and prints an exception as its type and first line. Proxy cases are curl against--num_workers 2, fresh databases and #47496's config. Before is #47496's tipsdk_cases.py
1. SDK reads back the file it uploaded
Before (9d972c8). The upload works, and reading it back with the same bucket fails
After (b03cbd7). The same calls return the file's lines
2. SDK. A file in another bucket
Before (9d972c8)
After (b03cbd7)
3. SDK. List files
Before (9d972c8)
After (b03cbd7)
4. SDK. Read a batch result passing only the output bucket
Before (9d972c8)
After (b03cbd7)
5. SDK. A file outside LiteLLM's folders, no legacy flag
Before (9d972c8)
After (b03cbd7)
6. SDK. The same file with `allow_legacy_cloud_file_ids=True`
Before (9d972c8)
After (b03cbd7)
7. SDK. Delete the uploaded file
Before (9d972c8)
After (b03cbd7)
P1. Proxy. Upload a file to the model and read it back
Before (9d972c8)
After (b03cbd7)
P2. Proxy. Retrieve its metadata
Before (9d972c8)
After (b03cbd7)
P3. Proxy. List files for the model
Before (9d972c8)
After (b03cbd7)
P4. Proxy. Delete it
Before (9d972c8)
After (b03cbd7)
P5. Proxy. Managed batch, upload with `target_model_names` and create the batch
Before (9d972c8)
After (b03cbd7)
Type
🐛 Bug Fix
🧹 Refactoring
Caveats (if any)
High
allow_legacy_cloud_file_idsstring that is not a boolean now makes Router init fail"enabled"boots on base and raisesValidationErroron head, now that the field is a typedbool | NoneMedium
s3_bucket_namein kwargs, so feat(proxy)!: only let clients pick S3 buckets the admin allowed #47496's request-body blocklist is the only guard. The body does not weigh keeping the server snapshot when presentRouterSDK calls. P5 stops atvalidatingLow
s3_bucket_name, which feat(proxy)!: only let clients pick S3 buckets the admin allowed #47496 rejects, and says "file content retrieval" on list, delete and retrieve tooosv-scanis red on the repo-wide certifi and vite advisories, as on fix(security): stop trusting the compromised eMudhra root CA #47670's run, so not caused by this PRFinal Attestation