Conversation
Greptile SummaryThis PR significantly expands the resource limits system by adding 19 new configurable caps (teams, projects, service accounts, API keys, vector stores, files, conversations, prompts, SSO group mappings, domain verifications, and member counts). The best-effort enforcement model (documented in Key changes:
Issue found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Route as Admin Route (api_keys::create)
participant SASvc as ServiceAccountService
participant KeySvc as ApiKeyService
participant DB as Database
Client->>Route: POST /admin/api_keys (owner: ServiceAccount)
Route->>SASvc: get_by_id(service_account_id)
SASvc->>DB: SELECT * FROM service_accounts WHERE id = ?
DB-->>SASvc: sa { org_id }
SASvc-->>Route: sa
Route->>KeySvc: count_by_org(sa.org_id, false)
KeySvc->>DB: SELECT COUNT(*) FROM api_keys\nWHERE owner_type='organization' AND owner_id=?
Note over DB: ⚠️ Does NOT count\nowner_type='service_account' keys
DB-->>KeySvc: count (org-scoped keys only)
KeySvc-->>Route: count
alt count >= max_api_keys_per_org
Route-->>Client: 409 Conflict
else count < max (SA keys uncounted → limit bypassable)
Route->>KeySvc: create(owner: ServiceAccount)
KeySvc->>DB: INSERT INTO api_keys (owner_type='service_account', ...)
DB-->>KeySvc: new key
KeySvc-->>Route: api_key
Route-->>Client: 201 Created
end
|
No description provided.