-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add organization-wide API keys with uniform permissions #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -720,17 +720,19 @@ model Invite { | |
| /// @property lastUsedAt - Timestamp of last usage | ||
| /// @property apiKeyEnvironments - Environments this key has access to | ||
| model ApiKey { | ||
| id String @id @default(cuid()) | ||
| createdAt DateTime @default(now()) | ||
| createdBy String? | ||
| lastUsedAt DateTime? | ||
| label String | ||
| hashedKey String @unique | ||
| organizationId String | ||
| organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade) | ||
| apiKeyEnvironments ApiKeyEnvironment[] | ||
| id String @id @default(cuid()) | ||
| createdAt DateTime @default(now()) | ||
| createdBy String? | ||
| lastUsedAt DateTime? | ||
| label String | ||
| hashedKey String @unique | ||
| organizationId String | ||
| organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade) | ||
| apiKeyEnvironments ApiKeyEnvironment[] | ||
| /// [OrganizationAccess] | ||
| organizationAccess Json @default("{}") | ||
| organizationAccess Json @default("{}") | ||
| allProjects Boolean @default(false) | ||
| allProjectsPermission ApiKeyPermission? | ||
|
Comment on lines
+734
to
+735
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This change introduces Useful? React with 👍 / 👎. |
||
|
|
||
| @@index([organizationId]) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getApiKeyWithPermissionsnow eagerly includes every project and environment in the organization for every API key lookup, even when the key is notallProjects. Because this function is used by v1/v2 authentication on request paths, this adds org-size-dependent query cost to normal API traffic and can cause significant latency for large organizations; fetch these relations only whenallProjectsis actually enabled.Useful? React with 👍 / 👎.