mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
Internal User Endpoint - vulnerability fix + response type fix (#8228)
* fix(key_management_endpoints.py): fix vulnerability where a user could update another user's keys Resolves https://github.com/BerriAI/litellm/issues/8031 * test(key_management_endpoints.py): return consistent 403 forbidden error when modifying key that doesn't belong to user * fix(internal_user_endpoints.py): return model max budget in internal user create response Fixes https://github.com/BerriAI/litellm/issues/7047 * test: fix test * test: update test to handle gemini token counter change * fix(factory.py): fix bedrock http:// handling * docs: fix typo in lm_studio.md (#8222) * test: fix testing * test: fix test --------- Co-authored-by: foreign-sub <51928805+foreign-sub@users.noreply.github.com>
This commit is contained in:
parent
f6bd48a1c5
commit
df93debbc7
7 changed files with 240 additions and 28 deletions
|
@ -1216,14 +1216,14 @@ def test_litellm_verification_token_view_response_with_budget_table(
|
|||
)
|
||||
|
||||
|
||||
def test_is_allowed_to_create_key():
|
||||
def test_is_allowed_to_make_key_request():
|
||||
from litellm.proxy._types import LitellmUserRoles
|
||||
from litellm.proxy.management_endpoints.key_management_endpoints import (
|
||||
_is_allowed_to_create_key,
|
||||
_is_allowed_to_make_key_request,
|
||||
)
|
||||
|
||||
assert (
|
||||
_is_allowed_to_create_key(
|
||||
_is_allowed_to_make_key_request(
|
||||
user_api_key_dict=UserAPIKeyAuth(
|
||||
user_id="test_user_id", user_role=LitellmUserRoles.PROXY_ADMIN
|
||||
),
|
||||
|
@ -1234,7 +1234,7 @@ def test_is_allowed_to_create_key():
|
|||
)
|
||||
|
||||
assert (
|
||||
_is_allowed_to_create_key(
|
||||
_is_allowed_to_make_key_request(
|
||||
user_api_key_dict=UserAPIKeyAuth(
|
||||
user_id="test_user_id",
|
||||
user_role=LitellmUserRoles.INTERNAL_USER,
|
||||
|
@ -1553,6 +1553,7 @@ async def test_spend_logs_cleanup_after_error():
|
|||
mock_client.spend_log_transactions == original_logs[100:]
|
||||
), "Should remove processed logs even after error"
|
||||
|
||||
|
||||
def test_provider_specific_header():
|
||||
from litellm.proxy.litellm_pre_call_utils import (
|
||||
add_provider_specific_headers_to_request,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue