Commit graph

18 commits

Author SHA1 Message Date
Krish Dholakia
df93debbc7
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>
2025-02-04 06:41:14 -08:00
Krish Dholakia
2eaa0079f2
feat(handle_jwt.py): initial commit adding custom RBAC support on jwt… (#8037)
* feat(handle_jwt.py): initial commit adding custom RBAC support on jwt auth

allows admin to define user role field and allowed roles which map to 'internal_user' on litellm

* fix(auth_checks.py): ensure user allowed to access model, when calling via personal keys

Fixes https://github.com/BerriAI/litellm/issues/8029

* feat(handle_jwt.py): support role based access with model permission control on proxy

Allows admin to just grant users roles on IDP (e.g. Azure AD/Keycloak) and user can immediately start calling models

* docs(rbac): add docs on rbac for model access control

make it clear how admin can use roles to control model access on proxy

* fix: fix linting errors

* test(test_user_api_key_auth.py): add unit testing to ensure rbac role is correctly enforced

* test(test_user_api_key_auth.py): add more testing

* test(test_users.py): add unit testing to ensure user model access is always checked for new keys

Resolves https://github.com/BerriAI/litellm/issues/8029

* test: fix unit test

* fix(dot_notation_indexing.py): fix typing to work with python 3.8
2025-01-28 16:27:06 -08:00
Krish Dholakia
9695c1af10
LiteLLM Minor Fixes & Improvements (10/08/2024) (#6119)
* refactor(cost_calculator.py): move error line to debug - https://github.com/BerriAI/litellm/issues/5683#issuecomment-2398599498

* fix(migrate-hidden-params-to-read-from-standard-logging-payload): Fixes https://github.com/BerriAI/litellm/issues/5546#issuecomment-2399994026

* fix(types/utils.py): mark weight as a litellm param

Fixes https://github.com/BerriAI/litellm/issues/5781

* feat(internal_user_endpoints.py): fix /user/info + show user max budget as default max budget

Fixes https://github.com/BerriAI/litellm/issues/6117

* feat: support returning team member budget in `/user/info`

Sets user max budget in team as max budget on ui

  Closes https://github.com/BerriAI/litellm/issues/6117

* bug fix for optional parameter passing to replicate (#6067)

Signed-off-by: Mandana Vaziri <mvaziri@us.ibm.com>

* fix(o1_transformation.py): handle o1 temperature=0

o1 doesn't support temp=0, allow admin to drop this param

* test: fix test

---------

Signed-off-by: Mandana Vaziri <mvaziri@us.ibm.com>
Co-authored-by: Mandana Vaziri <mvaziri@us.ibm.com>
2024-10-08 21:57:03 -07:00
Krish Dholakia
d57be47b0f
Litellm ruff linting enforcement (#5992)
* ci(config.yml): add a 'check_code_quality' step

Addresses https://github.com/BerriAI/litellm/issues/5991

* ci(config.yml): check why circle ci doesn't pick up this test

* ci(config.yml): fix to run 'check_code_quality' tests

* fix(__init__.py): fix unprotected import

* fix(__init__.py): don't remove unused imports

* build(ruff.toml): update ruff.toml to ignore unused imports

* fix: fix: ruff + pyright - fix linting + type-checking errors

* fix: fix linting errors

* fix(lago.py): fix module init error

* fix: fix linting errors

* ci(config.yml): cd into correct dir for checks

* fix(proxy_server.py): fix linting error

* fix(utils.py): fix bare except

causes ruff linting errors

* fix: ruff - fix remaining linting errors

* fix(clickhouse.py): use standard logging object

* fix(__init__.py): fix unprotected import

* fix: ruff - fix linting errors

* fix: fix linting errors

* ci(config.yml): cleanup code qa step (formatting handled in local_testing)

* fix(_health_endpoints.py): fix ruff linting errors

* ci(config.yml): just use ruff in check_code_quality pipeline for now

* build(custom_guardrail.py): include missing file

* style(embedding_handler.py): fix ruff check
2024-10-01 19:44:20 -04:00
Krrish Dholakia
d1d28487f7 refactor(test_users.py): refactor test for user info to use mock endpoints 2024-08-12 18:48:43 -07:00
Krrish Dholakia
575afa8029 fix(internal_user_endpoints.py): return all teams if user is admin 2024-08-10 16:36:43 -07:00
Krrish Dholakia
60f89faf1c test: cleanup 2024-03-30 21:40:43 -07:00
Krrish Dholakia
066346b8c8 test: handle flaky tests locally - causing db timeout issues on circle ci 2024-03-19 20:39:53 -07:00
Krrish Dholakia
2dfdc8dd69 Revert "Merge pull request #2593 from BerriAI/litellm_reset_budget_fix"
This reverts commit afd363129f, reversing
changes made to c94bc94ad5.
2024-03-19 20:25:41 -07:00
Krrish Dholakia
b9f222f8fb test(test_users.py): skip flaky circle ci test 2024-03-19 20:09:38 -07:00
Krrish Dholakia
97e7113b87 test(test_users.py): fix test 2024-03-19 19:48:44 -07:00
Krrish Dholakia
9140453d0c test: make test call more reliable 2024-03-19 19:47:18 -07:00
Krrish Dholakia
0822f6283f test(test_users.py): reposition test
trying to identify why endpoint isn't being called
2024-03-19 19:40:41 -07:00
Krrish Dholakia
b9854a99d2 test: increase time before checking budget reset - avoid deadlocking 2024-03-06 22:16:59 -08:00
Krrish Dholakia
a0022410fa test(test_users.py): add more reattempts and delays 2024-01-31 10:05:35 -08:00
Krrish Dholakia
624da17698 test(test_users.py): add testing for global proxy spend tracking 2024-01-24 16:24:50 -08:00
Krrish Dholakia
bb7705b494 test(test_users.py): test budgets with resets 2024-01-24 15:30:30 -08:00
Krrish Dholakia
f5ced089d6 test(tests/): add unit testing for proxy server endpoints 2024-01-19 14:54:29 -08:00