Repository navigation
fix(bedrock): drop toolSpec.strict for Haiku 4.5 and Sonnet 4.6 on Converse - #34609
baiyuxi930826 wants to merge 1 commit into
Conversation
|
Too many files changed for review. ( Bypass the limit by tagging |
|
|
…nverse Bedrock Converse rejects or mishandles toolSpec.strict for Claude Haiku 4.5 and Sonnet 4.6 (compiled-grammar hangs / invalid fields), matching the pattern already applied for Opus 4.7/4.8 and Sonnet 4. Set bedrock_converse_supports_strict_tools: false on all bedrock_converse cost-map entries for those model IDs and extend the regression suite. Fixes BerriAI#34388 Why: Keep MCP/PydanticAI strict tool definitions from breaking Bedrock proxy calls on newly shipped Claude model IDs.
0049359 to
7623032
Compare
| if prisma_client is None: | ||
| return None | ||
| try: | ||
| db_file = await ManagedFileRepository(prisma_client).table.find_first(where={"unified_file_id": input_file_id}) |
There was a problem hiding this comment.
High: Managed file ownership bypass
This lookup resolves any supplied unified file ID without checking created_by or team_id. An authenticated user who obtains another tenant's file ID can submit it as batch input; replacing the opaque ID with its storage_url bypasses the managed-files hook where can_user_call_unified_file_id() enforces ownership, allowing the attacker to process that file and retrieve the resulting batch output. Pass user_api_key_dict into this helper and enforce the same user/team/admin access check before returning the URL.
| consumed_count = await cache.async_increment_cache( | ||
| key=consumed_key, value=1, ttl=SAMLAuthHandler._replay_guard_ttl(auth) | ||
| ) | ||
| if consumed_count is not None and consumed_count > 1: |
There was a problem hiding this comment.
Medium: SAML replay protection fails open
DualCache.async_increment_cache() returns None when Redis fails, but this condition accepts the assertion. During a Redis outage, an attacker with a captured unsolicited signed assertion can replay it against another worker whose in-memory counter has not seen it and obtain a new UI session; fail closed whenever the shared atomic replay check cannot complete.
| if consumed_count is not None and consumed_count > 1: | |
| if consumed_count is None: | |
| raise HTTPException( | |
| status_code=status.HTTP_503_SERVICE_UNAVAILABLE, | |
| detail="SAML replay protection is unavailable.", | |
| ) | |
| if consumed_count > 1: |
PR overviewThis PR adjusts Bedrock Converse handling to omit Two security issues remain open. An authenticated user who knows another tenant’s file ID can bypass managed-file ownership checks and process that file, creating a cross-tenant data access risk. SAML assertion replay protection also fails open during Redis outages, potentially allowing a captured signed assertion to create a new UI session. Open issues (2)
Fixed/addressed: 0 · PR risk: 7/10 |
Response to CI / automated reviewThanks for the automated feedback. Scope check for this PR: Diff (3 files only)
No changes to CI failures
Veria / Greptile notes
Local verificationHappy to adjust further if maintainers want a different staging branch or flag naming. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
bedrock_converse_supports_strict_tools: falsefor allbedrock_conversecost-map entries of Claude Haiku 4.5 and Sonnet 4.6 (regional prefixes included).toolSpec.strict/additionalPropertieslike Opus 4.7/4.8 and Sonnet 4.Context
Fixes #34388
PydanticAI/MCP tool definitions often set
strict: true. Since LiteLLM began forwardingstrictto Bedrock Converse, Haiku 4.5 / Sonnet 4.6 can hit compiled-grammar limits or hang until gateway timeout. The same cost-map gate already exists for Opus 4.7/4.8 (#31923) and Sonnet 4 (#31943). Sonnet 5 is covered by separate open PRs — this change does not re-implement those.Test plan
pytest -q tests/test_litellm/litellm_core_utils/prompt_templates/test_bedrock_converse_strict_tools_opus_47_48.py→ 39 passedbedrock_converse_supports_strict_toolsis False for Haiku 4.5 / Sonnet 4.6 and True for Sonnet 4.5