mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-11 08:38:24 +00:00
Merge ae0c9c8af0 into 527d882508
This commit is contained in:
commit
7dec14a476
2 changed files with 22 additions and 0 deletions
|
|
@ -163,6 +163,11 @@ _WEB_IDENTITY_SESSION_POLICY_ACTIONS: Final[Mapping[str, tuple[str, ...]]] = Map
|
|||
"sts:TagGetWebIdentityToken",
|
||||
),
|
||||
"BedrockMantleLiteLLM": ("bedrock-mantle:CreateInference",),
|
||||
"BedrockWebSearchLiteLLM": (
|
||||
"bedrock-websearch:InvokeSearch",
|
||||
"bedrock-websearch:InvokeFetch",
|
||||
"bedrock-websearch:ExternalWebAccess",
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -393,3 +393,20 @@ class TestSessionPolicyGrantsEveryBedrockRoute:
|
|||
|
||||
def test_policy_document_fits_the_sts_plaintext_limit(self):
|
||||
assert len(_captured_policy_document()) <= _STS_SESSION_POLICY_PLAINTEXT_LIMIT
|
||||
|
||||
class TestBedrockWebSearchActionsCovered:
|
||||
"""Mantle's hosted web_search tool authorizes against the ``bedrock-websearch``
|
||||
namespace, so the session-policy ceiling must include it or web_search calls
|
||||
come back status=failed on OIDC/WIF auth."""
|
||||
|
||||
@pytest.mark.parametrize("action", ["InvokeSearch", "InvokeFetch", "ExternalWebAccess"])
|
||||
def test_bedrock_websearch_action_present(self, action: str):
|
||||
assert f"bedrock-websearch:{action}" in _granted_actions(_captured_policy())
|
||||
|
||||
def test_bedrock_websearch_statement_is_scoped(self):
|
||||
stmt = _statement_by_sid(_captured_policy(), "BedrockWebSearchLiteLLM")
|
||||
actions = [stmt["Action"]] if isinstance(stmt["Action"], str) else stmt["Action"]
|
||||
assert stmt["Effect"] == "Allow"
|
||||
assert stmt["Resource"] == "*"
|
||||
assert "bedrock-websearch:*" not in actions
|
||||
assert (stmt.get("Condition") or {}).get("Bool", {}).get("aws:SecureTransport") == "true"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue