Repository navigation
feat(proxy): app-scoped read access to Customer Management through object permissions - #52781
Conversation
…_permission.apps Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…admins Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… apps Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
bugbot run |
[High impact] The PR expands Customer Management reads from proxy admins to users with app-specific grants. The code changes appear ready, but the earlier requirement for rerunnable live proof must be completed before merging. Findings
|
| const apps = useQuery({ queryKey: ["apps", "access-selector"], queryFn: () => loadApps(), enabled: !disabled }); | ||
| const options = (apps.data ?? []).map((app) => ({ label: `${app.alias} (${app.app_id})`, value: app.app_id })); |
There was a problem hiding this comment.
Live grant proof is missing.
AGENTS.md requires live proof for new access checks and saved data, plus screenshots for UI flows. The description explicitly says neither exists. Add rerunnable before/after proof at 617445620ede5142a4112b10e284f380c5b86e3a, covering grant, scoped reads, denied writes, revocation and the dashboard.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Agreed, live proof is not there yet. A recorded run on a real proxy at the current tip is next and goes in the description.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@greptileai @veria-ai |
|
bugbot run |
…er write stored app grants back for non-admins Non-admin object permission edits no longer include apps in the upsert record, so a stale read cannot restore a revoked grant. The sidebar hides admin-only Customer Management pages from admin viewers. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…er Management The team form no longer carries the apps picker. A proxy admin picks a team on the new page and chooses the applications its members can view. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 similar comment
|
bugbot run |
Internal Access now picks a team, a user or an organization. A failed save shows an error next to the button. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@greptileai @veria-ai |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d2eb0f2. Configure here.
The app router authenticates at the router level again, so an unauthenticated read is rejected before a database transaction opens. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…er file (#52921) With provider_endpoints_support.json regenerated, code-quality on main stops at the next two checks: - check_workflow_job_name_collisions: test-merge-smoke.yml and test-unit.yml both publish a `rust-bridge` check run. The smoke job is now named smoke-rust-bridge; nothing reads that check by name. - check_unbounded_in_lists: the app_ids "in" filter #52781 added to AppStore.list had no written bound. It pages with skip/take, so it is marked bounded-ok (the apps granted to one caller) instead of chunked.
…ble (#52909) 20261119000000_app_association_base_budgets added columns and foreign keys without IF NOT EXISTS or DO $$ guards, which the migration DDL tests reject. No release carries it yet, so it is edited in place. Also pins the new object_permission.apps field in the customer endpoint response bodies, which #52781 added.
TLDR
Problem this solves:
How it solves it:
appstoobject_permission, next to MCP servers and vector storesapps. Anyone else may resend the stored list unchanged, and keys never carry app grantsIntentional product change: non-admins no longer see Customer Management in the view switcher unless they hold an app grant. Before, they could open it and got an admin-only notice.
User Flow
Before
GET /management/v1/appsreturns 403 for themAfter
/team/update,/user/updateor/organization/updatewithobject_permission.appsGET /management/v1/appsreturns only their apps, and another app's ID returns 403app_idset to a granted app, and 403 for another app or with noapp_idPre-Submission checklist
Screenshots / Proof of Fix
Live run on a local proxy started as AGENTS.md describes (two workers, one dedicated Redis for router and coordination state, local Postgres) with the dashboard dev server pointed at it. UI and API checks ran at
104655de64, and revocation and the proxy admin regression ran after983ddb2591reloaded. The Internal Access page, the admin viewer sidebar and bulk user creation ran atca7e71721e, and the user and organization tabs ran atd2eb0f2266. Before this PR the same grantee gets an admin-only notice and a 403 fromGET /management/v1/apps.A proxy admin opens Internal Access under Customer Management, picks a team, selects an app and saves. The grant is still selected after a reload, saving it kept the team's other object permission fields, and clearing it and saving removes it. The team edit form has no app field. An admin viewer with no grant sees none of the Customer Management links, and one with a grant sees only Applications.
POST /management/v1/users/bulkas a proxy admin withobject_permission.appsreturned 200, and the created user's key read the granted app with 200 and another app with 403. On the User and Organization tabs a grant persisted after a reload and left the user's role unchanged, an organization member with no other grant saw the app only while the organization grant was present, and a user with a direct grant for one app and a team grant for another saw both. A save against a deleted team returned 404 and showed the inline error.A member of that team signs in, picks Customer Management in the view switcher and sees only the granted app, with no edit controls.
A user with no grant has no Customer Management entry and gets the notice on
/ui/apps. After the admin clears the team's grant, the former grantee is in the same state and gets 403 from the app routes.API results as the grantee: the list returns only the granted app, the other app returns 403,
PATCHon the granted app returns 403, all four usage routes return 200 with the grantedapp_idand 403 with the other app or none, and an unknown member and a member outside the app both return404 {"detail":"Customer member not found."}./key/generateand/key/updatewithobject_permission.appsreturn the app grant 403 and still accept other object permission fields.API transcript (`api` runs fetch in the signed-in browser tab against the proxy, long responses cut)
Not reached live: a team admin and an organization admin are stopped by existing outer gates before the app grant check (
team_admin_editable_team_fieldsdoes not supportobject_permission, and the organization update routes returned 401 for a non proxy admin), so the unchanged-versus-changed grant comparison and the null clear are covered by unit tests only. The retry state for a failed grant read is also unit tested only. Usage responses had no spend rows, so the live run proves status codes and not row isolation.Mutations run against
tests/unit/proxy/management_endpoints/management_v1/test_apps.pyandtest_customer_usage.py, each reverted afterwards. Dropping team grants fromgranted_app_idsfails 4 tests. Removing the per-app check inreadablefails 3. Letting a grantee read usage with noapp_idfails 20.How to rerun (proxy command, config, dashboard and client helper)
Proxy, from the repo root at the commit under test, with
DATABASE_URLpointing at a local Postgres and a Redis on port 6389./tmp/52781-config.yamlwith secrets removed.Dashboard, from
litellm/ui/litellm-dashboard.Client helper used for every API line in the transcripts. It runs
fetchinside the signed-in browser tab.The before behavior was not rerun live at the merge base
89e0f3b771. There the app and usage routes are proxy admin only in code, andobject_permissionhas noappsfield.Type
🆕 New Feature
Caveats (if any)
Medium
app_idon the usage routes. There is no "all my apps" rollup yet.Low
uv syncon a machine withDATABASE_URLset needsSQLX_OFFLINE=trueto build the Rust extension. This PR does not change that.Details
Link to Devin session: https://app.devin.ai/sessions/aa7be44c847d4b629234d42cc84a4eb0
Open in Devin Desktop: https://app.devin.ai/desktop/session/aa7be44c847d4b629234d42cc84a4eb0?variant=devin
Requested by: @moe-berri
Migration
20261119000000_object_permission_appsadds oneTEXT[]column with an empty default and rewrites no rows.Note
High Risk
Introduces authorization on object permissions and management v1 routes; misconfiguration could expose app or usage data or block legitimate admin viewers without grants.
Overview
Adds an
appsgrant onobject_permission(schema migration + types), so Customer Management visibility is no longer all-or-nothing for proxy admins.Backend: New
granted_app_ids/AppAccessresolve the union of apps from a user's own, team, and organization object permissions./management/v1/appsand customer usage routes are scoped to those apps for non-admins (reads allowed; mutating app/customer routes stay admin-only).can_grant_appsgates who may set or clearobject_permission.appson user/team/org create and update flows; non-admins get 403 if they change app grants or unlink a permission that had apps.Dashboard: Proxy admins get Internal Access (
/customers/access) to assign apps to teams, users, or organizations. Grantees see a read-only Apps list, Customer Management in the view switcher only when they have grants, and nav hides admin Customer Management links for admin viewers without grants.Reviewed by Cursor Bugbot for commit d2eb0f2. Bugbot is set up for automated code reviews on this repo. Configure here.