Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: separate workspace iam pocliy perms (#15389)
p0ny9719a385cdf9
diff --git a/backend/component/iam/acl.yaml b/backend/component/iam/acl.yamlindex c36848b78d..28610f0714 100644--- a/backend/component/iam/acl.yaml+++ b/backend/component/iam/acl.yaml@@ -132,6 +132,8 @@ roles:- bb.users.update- bb.worksheets.get- bb.worksheets.manage+ - bb.workspaces.getIamPolicy+ - bb.workspaces.setIamPolicy- name: roles/workspaceDBAtitle: Workspace DBApermissions:@@ -258,6 +260,7 @@ roles:- bb.groups.list- bb.worksheets.get- bb.worksheets.manage+ - bb.workspaces.getIamPolicy- name: roles/workspaceMembertitle: Workspace memberpermissions:@@ -277,6 +280,7 @@ roles:- bb.groups.create- bb.groups.get- bb.groups.list+ - bb.workspaces.getIamPolicy- name: roles/projectOwnertitle: Project ownerpermissions:diff --git a/backend/component/iam/permission.go b/backend/component/iam/permission.goindex b3d4291b58..23dc540d93 100644--- a/backend/component/iam/permission.go+++ b/backend/component/iam/permission.go@@ -133,6 +133,8 @@ const (PermissionUsersUpdate Permission = "bb.users.update"PermissionWorksheetsGet Permission = "bb.worksheets.get"PermissionWorksheetsManage Permission = "bb.worksheets.manage"+ PermissionWorkspacesGetIamPolicy Permission = "bb.workspaces.getIamPolicy"+ PermissionWorkspacesSetIamPolicy Permission = "bb.workspaces.setIamPolicy")var allPermissions = []Permission{@@ -266,6 +268,8 @@ var allPermissions = []Permission{PermissionUsersUpdate,PermissionWorksheetsGet,PermissionWorksheetsManage,+ PermissionWorkspacesGetIamPolicy,+ PermissionWorkspacesSetIamPolicy,}var allPermissionsMap = func() map[Permission]bool {diff --git a/backend/component/iam/permission.yaml b/backend/component/iam/permission.yamlindex 7188d98787..b156233542 100644--- a/backend/component/iam/permission.yaml+++ b/backend/component/iam/permission.yaml@@ -129,3 +129,5 @@ permissions:- bb.users.update- bb.worksheets.get- bb.worksheets.manage+ - bb.workspaces.getIamPolicy+ - bb.workspaces.setIamPolicydiff --git a/frontend/src/types/iam/permission.ts b/frontend/src/types/iam/permission.tsindex 5dcd33635c..9c474efafb 100644--- a/frontend/src/types/iam/permission.ts+++ b/frontend/src/types/iam/permission.ts@@ -124,7 +124,10 @@ export type Permission =| "bb.users.undelete"| "bb.users.update"| "bb.worksheets.get"- | "bb.worksheets.manage";+ | "bb.worksheets.manage"+ | "bb.workspaces.getIamPolicy"+ | "bb.workspaces.setIamPolicy"+ ;export type QueryPermission = PickLiteral<Permission,diff --git a/frontend/src/types/proto/v1/workspace_service.ts b/frontend/src/types/proto/v1/workspace_service.tsindex 7e02f5c9a3..aac9b926e0 100644--- a/frontend/src/types/proto/v1/workspace_service.ts+++ b/frontend/src/types/proto/v1/workspace_service.ts@@ -22,7 +22,37 @@ export const WorkspaceServiceDefinition = {responseStream: false,options: {_unknownFields: {- 800010: [new Uint8Array([15, 98, 98, 46, 112, 111, 108, 105, 99, 105, 101, 115, 46, 103, 101, 116])],+ 800010: [+ new Uint8Array([+ 26,+ 98,+ 98,+ 46,+ 119,+ 111,+ 114,+ 107,+ 115,+ 112,+ 97,+ 99,+ 101,+ 115,+ 46,+ 103,+ 101,+ 116,+ 73,+ 97,+ 109,+ 80,+ 111,+ 108,+ 105,+ 99,+ 121,+ ]),+ ],800016: [new Uint8Array([1])],578365826: [new Uint8Array([@@ -83,7 +113,35 @@ export const WorkspaceServiceDefinition = {options: {_unknownFields: {800010: [- new Uint8Array([18, 98, 98, 46, 112, 111, 108, 105, 99, 105, 101, 115, 46, 117, 112, 100, 97, 116, 101]),+ new Uint8Array([+ 26,+ 98,+ 98,+ 46,+ 119,+ 111,+ 114,+ 107,+ 115,+ 112,+ 97,+ 99,+ 101,+ 115,+ 46,+ 115,+ 101,+ 116,+ 73,+ 97,+ 109,+ 80,+ 111,+ 108,+ 105,+ 99,+ 121,+ ]),],800016: [new Uint8Array([1])],800024: [new Uint8Array([1])],diff --git a/frontend/src/views/SettingWorkspaceMembers.vue b/frontend/src/views/SettingWorkspaceMembers.vueindex 7aa317e09e..4fca41e5ae 100644--- a/frontend/src/views/SettingWorkspaceMembers.vue+++ b/frontend/src/views/SettingWorkspaceMembers.vue@@ -129,7 +129,7 @@ const state = reactive<LocalState>({});const allowEdit = computed(() => {- return hasWorkspacePermissionV2("bb.policies.update");+ return hasWorkspacePermissionV2("bb.workspaces.setIamPolicy");});const handleRevokeSelectedMembers = () => {diff --git a/proto/generated-go/v1/workspace_service.pb.go b/proto/generated-go/v1/workspace_service.pb.goindex 9ed69ec366..c3f12c76e5 100644--- a/proto/generated-go/v1/workspace_service.pb.go+++ b/proto/generated-go/v1/workspace_service.pb.go@@ -31,29 +31,30 @@ var file_v1_workspace_service_proto_rawDesc = string([]byte{0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6e, 0x6f,0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x76, 0x31,0x2f, 0x69, 0x61, 0x6d, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74,- 0x6f, 0x32, 0xc4, 0x02, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53,- 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x91, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x49, 0x61,+ 0x6f, 0x32, 0xd7, 0x02, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53,+ 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9c, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x49, 0x61,0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69,0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x62, 0x79, 0x74, 0x65,0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63,- 0x79, 0x22, 0x47, 0x8a, 0xea, 0x30, 0x0f, 0x62, 0x62, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69,- 0x65, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a,- 0x12, 0x28, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3d,- 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x67, 0x65,- 0x74, 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x9b, 0x01, 0x0a, 0x0c, 0x53,- 0x65, 0x74, 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x20, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x49, 0x61, 0x6d,- 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x61, 0x6d, 0x50,- 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x51, 0x8a, 0xea, 0x30, 0x12, 0x62, 0x62, 0x2e, 0x70, 0x6f,- 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x90, 0xea, 0x30,- 0x01, 0x98, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x3a, 0x01, 0x2a, 0x22, 0x28,- 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3d, 0x77, 0x6f,- 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x49,- 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65,- 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,- 0x74, 0x6f, 0x33,+ 0x79, 0x22, 0x52, 0x8a, 0xea, 0x30, 0x1a, 0x62, 0x62, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70,+ 0x61, 0x63, 0x65, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63,+ 0x79, 0x90, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x76, 0x31,+ 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x3d, 0x77, 0x6f, 0x72, 0x6b, 0x73,+ 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x67, 0x65, 0x74, 0x49, 0x61, 0x6d, 0x50,+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0xa3, 0x01, 0x0a, 0x0c, 0x53, 0x65, 0x74, 0x49, 0x61, 0x6d,+ 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63,+ 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,+ 0x22, 0x59, 0x8a, 0xea, 0x30, 0x1a, 0x62, 0x62, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,+ 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,+ 0x90, 0xea, 0x30, 0x01, 0x98, 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x3a, 0x01,+ 0x2a, 0x22, 0x28, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,+ 0x3d, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x73,+ 0x65, 0x74, 0x49, 0x61, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0x11, 0x5a, 0x0f, 0x67,+ 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06,+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,})var file_v1_workspace_service_proto_goTypes = []any{diff --git a/proto/v1/workspace_service.proto b/proto/v1/workspace_service.protoindex a3c556bf42..78aa7b7d13 100644--- a/proto/v1/workspace_service.proto+++ b/proto/v1/workspace_service.proto@@ -11,7 +11,7 @@ option go_package = "generated-go/v1";service WorkspaceService {rpc GetIamPolicy(GetIamPolicyRequest) returns (IamPolicy) {option (google.api.http) = {get: "/v1/{resource=workspaces/*}:getIamPolicy"};- option (bytebase.v1.permission) = "bb.policies.get";+ option (bytebase.v1.permission) = "bb.workspaces.getIamPolicy";option (bytebase.v1.auth_method) = IAM;}@@ -20,7 +20,7 @@ service WorkspaceService {post: "/v1/{resource=workspaces/*}:setIamPolicy"body: "*"};- option (bytebase.v1.permission) = "bb.policies.update";+ option (bytebase.v1.permission) = "bb.workspaces.setIamPolicy";option (bytebase.v1.auth_method) = IAM;option (bytebase.v1.audit) = true;}