mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add ai_gateway_keys table and related RBAC (#25563)
Adds table to store keys that AI Gateway standalone replicas will use to authenticate into Coderd. Also adds RBAC and audit boilerplate.
This commit is contained in:
@@ -31,6 +31,7 @@ var AuditActionMap = map[string][]codersdk.AuditAction{
|
||||
"AiSeatState": {codersdk.AuditActionCreate},
|
||||
"AIProvider": {codersdk.AuditActionCreate, codersdk.AuditActionWrite, codersdk.AuditActionDelete},
|
||||
"AIProviderKey": {codersdk.AuditActionCreate, codersdk.AuditActionDelete},
|
||||
"AIGatewayKey": {codersdk.AuditActionCreate, codersdk.AuditActionDelete},
|
||||
"AuditableGroupAiBudget": {codersdk.AuditActionWrite, codersdk.AuditActionDelete},
|
||||
"Chat": {codersdk.AuditActionCreate, codersdk.AuditActionWrite}, // chats get 'archived' by users, not deleted.
|
||||
"UserSecret": {codersdk.AuditActionCreate, codersdk.AuditActionWrite, codersdk.AuditActionDelete},
|
||||
@@ -400,6 +401,14 @@ var auditableResourcesTypes = map[any]map[string]Action{
|
||||
"created_at": ActionIgnore, // Implicit; not useful in a diff.
|
||||
"updated_at": ActionIgnore, // Changes; not useful in a diff.
|
||||
},
|
||||
&database.AIGatewayKey{}: {
|
||||
"id": ActionTrack,
|
||||
"name": ActionTrack,
|
||||
"secret_prefix": ActionTrack,
|
||||
"hashed_secret": ActionSecret, // Bearer token hash, never expose.
|
||||
"created_at": ActionIgnore, // Implicit; not useful in a diff.
|
||||
"last_used_at": ActionIgnore, // Bumped on every use.
|
||||
},
|
||||
&database.TaskTable{}: {
|
||||
"id": ActionTrack,
|
||||
"organization_id": ActionIgnore, // Never changes.
|
||||
|
||||
Reference in New Issue
Block a user