Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Problem
Providers are currently gateway-wide shared resources that only admins can create. All sandboxes binding to a provider share the same credential (API key). This works for team-level LLM keys but breaks for credentials that are inherently per-user:
- Personal GitHub PATs
- Individual API keys with per-user billing/quota
- OAuth tokens scoped to a user's identity
- Any credential that should not be shared across team members
Proposed solution: per-user provider ownership (Option A)
Apply the same openshell.ai/owner pattern already proven for sandboxes to providers.
Design
- Relax
create_providerauth fromadmin→userrole (or add a dedicatedcreate_user_providerRPC). - Stamp
openshell.ai/owneron provider create from verified OIDC identity — same mechanism as sandbox ownership. - Filter provider list/get/delete by owner — users see only their own providers + shared (admin-created) providers.
- Sandbox-provider binding validation — a sandbox can reference:
- Providers owned by the same user
- Shared providers (no owner label — admin-created)
- ❌ NOT another user's providers
- Provider name uniqueness scoped to
(owner, name)— alice and bob can both have a provider namedgh.
Shared vs. user-owned providers
| Provider type | Owner label | Visible to | Created by |
|---|---|---|---|
| Shared (team) | none | All users | Admin |
| User-owned | openshell.ai/owner=<sub> |
Owner + admin | User |
What does NOT change
- Inference routes remain admin-only, gateway-wide routing config. A route references a provider by name — when a sandbox uses a user-owned provider, the inference proxy resolves that user's credential automatically.
- Policies are already per-sandbox (inherits sandbox ownership). No change needed.
- Admin bypass continues to work — admins can see/manage all providers.
- OIDC-disabled mode — ownership skipped, backward-compatible (same as sandboxes).
User experience
# Bob creates his own GitHub provider with his personal PAT
export GH_TOKEN="ghp_bob_xxx"
openshell provider create --name gh --type generic \
--credential GH_TOKEN \
--config BASE_URL=https://api.github.com
# Alice creates her own — no conflict, scoped by owner
export GH_TOKEN="ghp_alice_yyy"
openshell provider create --name gh --type generic \
--credential GH_TOKEN \
--config BASE_URL=https://api.github.com
# Bob's sandbox uses Bob's key
openshell sandbox create --provider gh -- bash
# Alice's sandbox uses Alice's key — no cross-contamination
openshell sandbox create --provider gh -- bash
# Admin can still create shared team providers
openshell provider create --name claude --type anthropic \
--credential ANTHROPIC_AUTH_TOKEN --sharedImplementation scope
| Component | Change |
|---|---|
Gateway auth/ownership.rs |
Extend ownership to Provider object type |
Gateway grpc/provider.rs |
Add owner stamp on create, filter on list/get/delete |
Gateway grpc/sandbox.rs |
Validate provider binding (same-owner or shared) |
| Gateway store layer | Provider name uniqueness scoped to (owner, name) |
| CLI | No change needed (already sends credentials at create time) |
| Helm/deploy scripts | No change needed |
Acceptance criteria
- On a shared gateway with OIDC enabled and two users (alice, bob):
- alice creates provider
ghwith her PAT → provider carriesopenshell.ai/owner=<alice-sub> - bob creates provider
ghwith his PAT → no conflict, separate provider - bob
list providersdoes not include alice'sgh; alice's list does not include bob's - bob cannot bind alice's provider to his sandbox → error
- both can use admin-created shared providers (e.g.,
claude) - admin can list/manage all providers across all users
- alice creates provider
- Backward compatible: existing shared providers (no owner) continue to work for all users
- e2e test covering cross-user provider isolation
Related
- Parent: Per-user sandbox ownership on a shared OpenShell gateway (owner-label approach) #1976 (per-user sandbox ownership — done)
- Gateway source:
kagenti/OpenShellcrates/openshell-server/src/auth/ownership.rs - Sandbox ownership PR: test: verify openshell.ai/owner label propagation via ComputeDriver openshell-driver-openshift#14
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Type
Projects
- StatusShow more project fieldsDone
Activity
pdettori commentedon Jun 16, 2026
Implementation Analysis
Codebase State
PR #18 (merged to
mvp-v2) established per-user sandbox ownership. The machinery lives in:crates/openshell-server/src/auth/ownership.rs—stamp_owner(),check_owner(),owner_selector()crates/openshell-server/src/grpc/sandbox.rs— uses all three at create/get/list/deleteThe provider handler (
crates/openshell-server/src/grpc/provider.rs) currently has no ownership logic. Auth is enforced purely at the RPC level:create_providerrole = "admin"get_providerrole = "user"(no ownership filter)list_providersrole = "user"(no ownership filter)update_providerrole = "admin"delete_providerrole = "admin"Implementation Plan
graph TD subgraph "Phase 1: Ownership plumbing" A[Relax create_provider role → user] --> B[Stamp ownership in handle_create_provider] B --> C[Add check_owner gate on get/update/delete] C --> D[Add owner_selector filtering on list_providers] end subgraph "Phase 2: Name uniqueness scoping" E[Scope provider name uniqueness to owner,name] --> F[Update store layer: UniqueViolation aware of owner scope] F --> G[Allow alice/gh + bob/gh to coexist] end subgraph "Phase 3: Sandbox-provider binding" H[Validate provider binding on sandbox create] --> I[Provider must be same-owner or shared] end subgraph "Phase 4: Tests" J[Unit tests: cross-user isolation] --> K[Unit tests: admin bypass] K --> L[Unit tests: backward compat for unowned providers] end A --> E D --> H G --> HKey Design Decisions
Ownership module is generic enough —
stamp_owner,check_owner,owner_selectorwork on anyHashMap<String, String>labels. The module docstring says "sandbox" but the code is entity-agnostic. I'll update the docstring.Name uniqueness scoping — Currently the store enforces name uniqueness per
ObjectType(i.e., all providers share a single namespace). For(owner, name)scoping, two approaches:{owner}/{name}internally, exposenamein API responses — simplest, no store changesRecommendation: Option (a) — composite key
{owner_value}:{name}in the store, with the API layer stripping the prefix. This parallels how sandbox ownership works with label selectors. Shared providers (admin-created) use an empty prefix.rpc_authrole changes:create_provider:admin→user(any authenticated user can create their own)update_provider:admin→user(ownership check inside handler gates access)delete_provider:admin→user(same)get_provider/list_providers: staysuser(ownership filtering added inside handler)Backward compatibility: Existing providers without
openshell.ai/ownerlabel → treated as shared (visible to all, manageable by admin). Same pattern as sandbox ownership.OIDC-disabled mode: When
principalisNone, skip ownership stamping — provider behaves as shared. Same backward-compat path as sandboxes.Acceptance Test Plan
gh→ stamped with her owner labelgh→ no conflict, separate recordgh+ any admin-created shared providersWork Plan
Branch:
feat/per-user-provider-ownership-1995offmvp-v2inkagenti/OpenShellEstimated: 4-5 commits (ownership plumbing, name scoping, binding validation, tests, docstring updates)
pdettori commentedon Jun 17, 2026
Progress: Per-user provider ownership — Implementation started
Branch:
feat/per-user-provider-ownership-1995on kagenti/OpenShell (commit32ae5d4c)Completed
ownership.rsdocstring updated;stamp_owner,check_owner,owner_selectoralready work for any entityApproach
flowchart LR subgraph "Role relaxation" A[provider CRUD] -->|was| B[admin role] A -->|now| C[user role] end subgraph "Ownership enforcement" D[create] --> E[stamp openshell.ai/owner] F[get/update/delete/refresh] --> G[check_provider_owner] H[list] --> I[filter: own + shared] end subgraph "Admin bypass" J[admin role] --> K[sees all, mutates all] endKey design decisions:
role = "admin"→role = "user"(exceptImportProviderProfiles/DeleteProviderProfilewhich remain admin — they're system-level operations)Deferred (follow-up)
(owner, name)put_if/ name-uniqueness constraintsThese are lower-risk enhancements that can be done in a separate PR once the core ownership enforcement is merged.
Test results
All 796 unit tests pass (12 new ownership isolation tests + 784 pre-existing).
Feat: Bump OpenShell to v0.0.56-rc.3 for per-user provider ownership
feat: per-user inference routes with ownership scoping
feat: per-user inference routes with ownership scoping