[Infra] Merge dev branch#25796
Conversation
Replace static Modal.confirm with DeleteResourceModal so attachment delete reliably triggers the API call. Add a regression test covering the confirm->delete flow. Made-with: Cursor
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Adopt a React Query mutation for policy attachment deletion and add a pending-state test on the policies index panel. This removes local delete-loading state and keeps modal loading tied to mutation status. Made-with: Cursor
…nup loop - proxy_server.py: disable allow_credentials when allow_origins=['*'] (wildcard + credentials is a browser security misconfiguration). Add LITELLM_CORS_ORIGINS env var to configure explicit allowed origins. - create_views.py: narrow broad 'except Exception' to only catch genuine 'view does not exist' errors; re-raise all other DB errors (auth, connection, etc.) that were previously silently swallowed. - spend_log_cleanup.py: validate execute_raw() return type is int before using it as a deletion count; break loop safely on unexpected types to prevent infinite deletion loops.
…w feedback) Add test_proxy_server_cors_invariant which directly imports and checks the module-level origins and allow_cors_credentials variables in proxy_server.py. This catches any future drift between the mirror helper and the real code.
…env vars reference
fix: harden CORS credentials, create_views exception handling, and spend log cleanup loop
Block cross-team key update/regenerate operations by raising when the caller is not a member of the target key's team, and add unit coverage for deny/allow team membership paths. Made-with: Cursor
…t-delete fix(ui): delete policy attachments via controlled modal
…auth-check fix(proxy): enforce team membership in team-scoped key management checks
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 29203053 | Triggered | Generic Password | ef774a1 | .circleci/config.yml | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Greptile SummaryThis infrastructure merge bundles four independent fixes: (1) CORS security hardening — Confidence Score: 5/5Safe to merge — all remaining findings are P2 style suggestions that do not affect runtime behaviour. No P0/P1 issues found. The open threads from prior review rounds (raw SQL, Tremor imports) are pre-existing and acknowledged. The one new comment is a return-type annotation inaccuracy that carries no runtime risk. All four code changes are well-tested with mock-only unit tests. litellm/proxy/management_helpers/team_member_permission_checks.py (minor return-type annotation fix)
|
| Filename | Overview |
|---|---|
| litellm/proxy/proxy_server.py | Extracts _get_cors_config() helper to make CORS configuration testable and fixes the wildcard-origin + allow_credentials security misconfiguration; allow_credentials now defaults to False when "*" is in origins. |
| litellm/proxy/management_helpers/team_member_permission_checks.py | Enforces team membership before team-scoped key management operations; does_team_member_have_permissions_for_endpoint now returns False (rather than None) when user is not a team member, and the caller raises a 401 with a clear message. Return type annotation Optional[bool] is inaccurate since None is never returned. |
| litellm/proxy/db/db_transaction_queue/spend_log_cleanup.py | Adds batched deletion logic with pod-lock guard, configurable retention period (string/int), and safety-abort on non-int execute_raw returns. Uses raw SQL for LIMIT-constrained DELETE (noted in previous review thread). |
| litellm/proxy/db/create_views.py | Extracts view-not-found error markers into _VIEW_NOT_FOUND_MARKERS constant and re-raises real DB errors (connection failures, permission denied) instead of silently treating them as missing views. |
| ui/litellm-dashboard/src/components/policies/index.tsx | Wires attachment deletion to useDeletePolicyAttachment mutation with a DeleteResourceModal confirmation; still imports Button, TabGroup, etc. from @tremor/react (noted in previous review thread). |
| ui/litellm-dashboard/src/hooks/policies/useDeletePolicyAttachment.ts | New useMutation hook encapsulating policy attachment deletion, with success/error callbacks and MessageManager notifications. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Key management request] --> B{user_role == PROXY_ADMIN?}
B -- Yes --> Z[Allow ✓]
B -- No --> C{existing_key_row.team_id is None?}
C -- Yes --> Z
C -- No --> D[Fetch team object from DB]
D --> E[_get_user_in_team for requesting user]
E --> F{team_member_object is None?}
F -- Yes --> G[Return False]
G --> H[Raise 401: user does not belong to team]
F -- No --> I{role == admin?}
I -- Yes --> Z
I -- No --> J[Get team member permissions + baseline]
J --> K{RouteChecks.check_route_access?}
K -- Passes --> Z
K -- Fails --> L[Raise 401: no permission for endpoint]
Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/lit..." | Re-trigger Greptile
| @@ -94,6 +94,17 @@ async def _delete_old_logs( | |||
| cutoff_date, | |||
| self.batch_size, | |||
| ) | |||
There was a problem hiding this comment.
Raw SQL instead of Prisma model methods
CLAUDE.md requires using prisma_client.db.<model> methods rather than execute_raw/query_raw for proxy DB operations. Prisma's delete_many doesn't natively support LIMIT, so the batch-with-subquery pattern here is understandable — but that exception should be documented with a short comment explaining why delete_many is insufficient, so future readers don't silently expand the raw-SQL surface.
Context Used: CLAUDE.md (source)
| @@ -1,8 +1,9 @@ | |||
| import React, { useState, useEffect, useCallback } from "react"; | |||
| import { Button, TabGroup, TabList, Tab, TabPanels, TabPanel } from "@tremor/react"; | |||
There was a problem hiding this comment.
@tremor/react imports in modified file
CLAUDE.md says not to introduce new @tremor/react imports in any modified file — the project is migrating to antd. Button → antd's Button; TabGroup/TabList/Tab/TabPanels/TabPanel → antd's Tabs + Tabs.TabPane (or items prop). If these imports pre-date this PR and can't be migrated in this pass, a follow-up ticket to track the migration would be appropriate.
Context Used: CLAUDE.md (source)
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
3914226
into
litellm_internal_staging
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
CI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Screenshots / Proof of Fix
Type
🚄 Infrastructure
Changes