Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor(api): remove service_key from the User proto (#21223)

Danny Xu1e8a07e888a0
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 2baca287b6..b416379b21 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -21114,10 +21114,6 @@ components:
type: string
title: password
description: The password for authentication. Only used during user creation or password updates.
- serviceKey:
- type: string
- title: service_key
- description: The service key for service account authentication.
mfaEnabled:
type: boolean
title: mfa_enabled
diff --git a/backend/api/v1/mcp_sql_clamp.go b/backend/api/v1/mcp_sql_clamp.go
index 01d7dafa87..f6ec01a520 100644
--- a/backend/api/v1/mcp_sql_clamp.go
+++ b/backend/api/v1/mcp_sql_clamp.go
@@ -52,9 +52,10 @@ func mcpReadOnlyClampApplies(ctx context.Context) (bool, error) {
// changed default_transaction_read_only to the next transaction, so
// "SET default_transaction_read_only = off" followed by a classifier-admitted
// read disarms the depth layer and writes (verified, PG 17). The same bool
-// carries the other rebinding statements — Trino USE and SET ROLE, Redis
-// SELECT — which repoint the connection so a later read resolves somewhere the
-// caller never named.
+// carries the other rebinding statements — Trino USE and SET ROLE — which
+// repoint the connection so a later read resolves somewhere the caller never
+// named. Redis SELECT rebinds the same way but its classifier refuses it as
+// not a read, so it never reaches this tier.
//
// Not closed: a structurally-reading statement can still call a function that
// rewrites the same setting (set_config, BOT-88).
diff --git a/backend/api/v1/mcp_sql_clamp_test.go b/backend/api/v1/mcp_sql_clamp_test.go
index f0e05e70b9..744d33b8c5 100644
--- a/backend/api/v1/mcp_sql_clamp_test.go
+++ b/backend/api/v1/mcp_sql_clamp_test.go
@@ -304,12 +304,15 @@ func TestMCPClampRefusesWhatItCannotShowIsARead(t *testing.T) {
},
{
// Redis SELECT switches the connection's logical database, so the
- // GET after it reads a database the caller did not ask for.
+ // GET after it reads a database the caller did not ask for. The
+ // Redis classifier refuses SELECT as not a read outright — Redis
+ // does not flag it readonly — so the clamp never reaches the
+ // returns-no-data tier.
name: "Redis SELECT switches the logical database",
engine: storepb.Engine_REDIS,
statement: "SELECT 1\nGET secret",
refused: true,
- reason: "returns no data",
+ reason: "the statement is not a read",
},
{
name: "an unseparated batch is refused rather than read on its first statement",
diff --git a/backend/generated-go/v1/user_service.pb.go b/backend/generated-go/v1/user_service.pb.go
index f5bd6b0615..0f6f2ac668 100644
--- a/backend/generated-go/v1/user_service.pb.go
+++ b/backend/generated-go/v1/user_service.pb.go
@@ -616,8 +616,6 @@ type User struct {
Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"`
// The password for authentication. Only used during user creation or password updates.
Password string `protobuf:"bytes,6,opt,name=password,proto3" json:"password,omitempty"`
- // The service key for service account authentication.
- ServiceKey string `protobuf:"bytes,7,opt,name=service_key,json=serviceKey,proto3" json:"service_key,omitempty"`
// The mfa_enabled flag means if the user has enabled MFA.
MfaEnabled bool `protobuf:"varint,8,opt,name=mfa_enabled,json=mfaEnabled,proto3" json:"mfa_enabled,omitempty"`
// Temporary OTP secret used during MFA setup and regeneration.
@@ -706,13 +704,6 @@ func (x *User) GetPassword() string {
return ""
}
-func (x *User) GetServiceKey() string {
- if x != nil {
- return x.ServiceKey
- }
- return ""
-}
-
func (x *User) GetMfaEnabled() bool {
if x != nil {
return x.MfaEnabled
@@ -874,15 +865,13 @@ const file_v1_user_service_proto_rawDesc = "" +
"\x12UpdateEmailRequest\x12-\n" +
"\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" +
"\x11bytebase.com/UserR\x04name\x12\x19\n" +
- "\x05email\x18\x02 \x01(\tB\x03\xe0A\x02R\x05email\"\x93\x06\n" +
+ "\x05email\x18\x02 \x01(\tB\x03\xe0A\x02R\x05email\"\xf8\x05\n" +
"\x04User\x12\x17\n" +
"\x04name\x18\x01 \x01(\tB\x03\xe0A\x03R\x04name\x12(\n" +
"\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x14\n" +
"\x05email\x18\x03 \x01(\tR\x05email\x12\x1e\n" +
"\x05title\x18\x04 \x01(\tB\b\xbaH\x05r\x03\x18\xc8\x01R\x05title\x12\x1f\n" +
"\bpassword\x18\x06 \x01(\tB\x03\xe0A\x04R\bpassword\x12\x1f\n" +
- "\vservice_key\x18\a \x01(\tR\n" +
- "serviceKey\x12\x1f\n" +
"\vmfa_enabled\x18\b \x01(\bR\n" +
"mfaEnabled\x12&\n" +
"\x0ftemp_otp_secret\x18\t \x01(\tR\rtempOtpSecret\x12.\n" +
@@ -897,7 +886,7 @@ const file_v1_user_service_proto_rawDesc = "" +
"\x0flast_login_time\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\rlastLoginTime\x12U\n" +
"\x19last_change_password_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x16lastChangePasswordTime\x12\x16\n" +
"\x06source\x18\x03 \x01(\tR\x06source:%\xeaA\"\n" +
- "\x11bytebase.com/User\x12\rusers/{email}J\x04\b\x05\x10\x06J\x04\b\x0f\x10\x102\xa8\t\n" +
+ "\x11bytebase.com/User\x12\rusers/{email}J\x04\b\x05\x10\x06J\x04\b\a\x10\bJ\x04\b\x0f\x10\x102\xa8\t\n" +
"\vUserService\x12x\n" +
"\aGetUser\x12\x1b.bytebase.v1.GetUserRequest\x1a\x11.bytebase.v1.User\"=\xdaA\x04name\x8a\xea0\fbb.users.get\x90\xea0\x01\xa0\xea0\x04\xa8\xea0\t\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/{name=users/*}\x12\x8e\x01\n" +
"\rBatchGetUsers\x12!.bytebase.v1.BatchGetUsersRequest\x1a\".bytebase.v1.BatchGetUsersResponse\"6\x8a\xea0\fbb.users.get\x90\xea0\x01\xa0\xea0\x04\xa8\xea0\t\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/users:batchGet\x12]\n" +
diff --git a/backend/generated-go/v1/user_service_equal.pb.go b/backend/generated-go/v1/user_service_equal.pb.go
index c351f8776d..d5b260408f 100644
--- a/backend/generated-go/v1/user_service_equal.pb.go
+++ b/backend/generated-go/v1/user_service_equal.pb.go
@@ -228,9 +228,6 @@ func (x *User) Equal(y *User) bool {
if x.Password != y.Password {
return false
}
- if x.ServiceKey != y.ServiceKey {
- return false
- }
if x.MfaEnabled != y.MfaEnabled {
return false
}
diff --git a/backend/plugin/parser/redis/query.go b/backend/plugin/parser/redis/query.go
index 5cb27b13bc..9324eb2338 100644
--- a/backend/plugin/parser/redis/query.go
+++ b/backend/plugin/parser/redis/query.go
@@ -207,7 +207,6 @@ func init() {
}
func validateQuery(statement string) (bool, bool, error) {
- returnsData := true
lines := strings.Split(statement, "\n")
for _, line := range lines {
fields, err := shlex.Split(line)
@@ -217,16 +216,13 @@ func validateQuery(statement string) (bool, bool, error) {
if len(fields) == 0 {
continue
}
+ // SELECT is not a read command: it switches the connection's logical
+ // database, so a later command runs somewhere the caller did not name.
if !isReadCommand(fields) {
return false, false, nil
}
- // SELECT switches the connection's logical database, so a later command
- // runs somewhere the caller did not name.
- if strings.EqualFold(fields[0], "select") {
- returnsData = false
- }
}
- return true, returnsData, nil
+ return true, true, nil
}
func isReadCommand(fields []string) bool {
diff --git a/frontend/src/lib/memberBindings.ts b/frontend/src/lib/memberBindings.ts
index 9fc1316d27..5cad9a20ca 100644
--- a/frontend/src/lib/memberBindings.ts
+++ b/frontend/src/lib/memberBindings.ts
@@ -2,7 +2,6 @@ import { create } from "@bufbuild/protobuf";
import { orderBy } from "lodash-es";
import { extractGroupEmail } from "@/stores";
import { useAppStore } from "@/stores/app";
-import { serviceAccountToUser } from "@/stores/app/serviceAccount";
import { workloadIdentityToUser } from "@/stores/app/workloadIdentity";
import {
extractUserEmail,
@@ -66,8 +65,15 @@ const getMemberBinding = (
let isPending = false;
const fullname = convertMemberToFullname(member);
if (fullname.startsWith(serviceAccountNamePrefix)) {
+ // Display-only projection: members surfaces render every principal
+ // kind through the User shape.
const sa = appStore.getServiceAccount(fullname);
- user = serviceAccountToUser(sa);
+ user = create(UserSchema, {
+ name: `users/${sa.email}`,
+ email: sa.email,
+ title: sa.title,
+ state: sa.state,
+ });
} else if (fullname.startsWith(workloadIdentityNamePrefix)) {
const wi = appStore.getWorkloadIdentity(fullname);
user = workloadIdentityToUser(wi);
diff --git a/frontend/src/routes/workspace/ServiceAccountsPage.tsx b/frontend/src/routes/workspace/ServiceAccountsPage.tsx
index 1906982ef4..ffb92f01b0 100644
--- a/frontend/src/routes/workspace/ServiceAccountsPage.tsx
+++ b/frontend/src/routes/workspace/ServiceAccountsPage.tsx
@@ -42,10 +42,6 @@ import { writeTextToClipboard } from "@/lib/clipboard";
import { cn } from "@/lib/utils";
import { pushNotification } from "@/stores";
import { useAppStore } from "@/stores/app";
-import {
- ensureServiceAccountFullName,
- serviceAccountToUser,
-} from "@/stores/app/serviceAccount";
import { projectNamePrefix } from "@/stores/modules/v1/common";
import {
getServiceAccountNameInBinding,
@@ -54,8 +50,10 @@ import {
import { State } from "@/types/proto-es/v1/common_pb";
import { BindingSchema } from "@/types/proto-es/v1/iam_policy_pb";
import type { Project } from "@/types/proto-es/v1/project_service_pb";
-import type { ServiceAccount } from "@/types/proto-es/v1/service_account_service_pb";
-import { type User, UserSchema } from "@/types/proto-es/v1/user_service_pb";
+import {
+ type ServiceAccount,
+ ServiceAccountSchema,
+} from "@/types/proto-es/v1/service_account_service_pb";
import { hasProjectPermissionV2, hasWorkspacePermissionV2 } from "@/utils";
// ============================================================
@@ -63,15 +61,15 @@ import { hasProjectPermissionV2, hasWorkspacePermissionV2 } from "@/utils";
// ============================================================
function ServiceAccountTable({
- users,
+ serviceAccounts,
project,
- onUserUpdated,
- onUserSelected,
+ onUpdated,
+ onSelected,
}: {
- users: User[];
+ serviceAccounts: ServiceAccount[];
project?: Project;
- onUserUpdated: (user: User) => void;
- onUserSelected?: (user: User) => void;
+ onUpdated: (sa: ServiceAccount) => void;
+ onSelected?: (sa: ServiceAccount) => void;
}) {
const { t } = useTranslation();
const deleteServiceAccount = useAppStore(
@@ -84,16 +82,15 @@ function ServiceAccountTable({
(state) => state.updateServiceAccount
);
- const handleDeactivate = async (user: User) => {
+ const handleDeactivate = async (sa: ServiceAccount) => {
const confirmed = window.confirm(
t("settings.members.action.deactivate-confirm-title")
);
if (!confirmed) return;
try {
- await deleteServiceAccount(ensureServiceAccountFullName(user.email));
- const updated = create(UserSchema, { ...user, state: State.DELETED });
- onUserUpdated(updated);
+ await deleteServiceAccount(sa.name);
+ onUpdated(create(ServiceAccountSchema, { ...sa, state: State.DELETED }));
pushNotification({
module: "bytebase",
style: "SUCCESS",
@@ -104,11 +101,10 @@ function ServiceAccountTable({
}
};
- const handleRestore = async (user: User) => {
+ const handleRestore = async (sa: ServiceAccount) => {
try {
- await undeleteServiceAccount(ensureServiceAccountFullName(user.email));
- const updated = create(UserSchema, { ...user, state: State.ACTIVE });
- onUserUpdated(updated);
+ const updated = await undeleteServiceAccount(sa.name);
+ onUpdated(updated);
pushNotification({
module: "bytebase",
style: "SUCCESS",
@@ -119,18 +115,19 @@ function ServiceAccountTable({
}
};
- const [resetConfirmUser, setResetConfirmUser] = useState<User | undefined>();
+ const [resetConfirmSa, setResetConfirmSa] = useState<
+ ServiceAccount | undefined
+ >();
const [copiedKeys, setCopiedKeys] = useState<Set<string>>(new Set());
- const handleResetKey = async (user: User) => {
- setResetConfirmUser(undefined);
+ const handleResetKey = async (sa: ServiceAccount) => {
+ setResetConfirmSa(undefined);
try {
- const sa = await updateServiceAccount(
- { name: ensureServiceAccountFullName(user.email) },
+ const updated = await updateServiceAccount(
+ { name: sa.name },
create(FieldMaskSchema, { paths: ["service_key"] })
);
- const updated = serviceAccountToUser(sa);
- onUserUpdated(updated);
+ onUpdated(updated);
if (
updated.serviceKey &&
(await writeTextToClipboard(updated.serviceKey))
@@ -147,9 +144,9 @@ function ServiceAccountTable({
}
};
- const handleCopyKey = async (user: User) => {
- if (!(await writeTextToClipboard(user.serviceKey))) return;
- setCopiedKeys((prev) => new Set(prev).add(user.name));
+ const handleCopyKey = async (sa: ServiceAccount) => {
+ if (!(await writeTextToClipboard(sa.serviceKey))) return;
+ setCopiedKeys((prev) => new Set(prev).add(sa.name));
pushNotification({
module: "bytebase",
style: "INFO",
@@ -157,6 +154,66 @@ function ServiceAccountTable({
});
};
+ const renderKeyAction = (sa: ServiceAccount) => {
+ if (sa.serviceKey && !copiedKeys.has(sa.name)) {
+ return (
+ <Button
+ appearance="outline"
+ size="xs"
+ onClick={(e) => {
+ e.stopPropagation();
+ handleCopyKey(sa);
+ }}
+ >
+ <Copy className="h-3 w-3 mr-1" />
+ {t("settings.members.copy-service-key")}
+ </Button>
+ );
+ }
+ if (resetConfirmSa?.name === sa.name) {
+ return (
+ <div className="flex items-center gap-x-1">
+ <span className="text-xs text-error">
+ {t("settings.members.reset-service-key-alert")}
+ </span>
+ <Button
+ variant="destructive"
+ size="xs"
+ onClick={(e) => {
+ e.stopPropagation();
+ handleResetKey(sa);
+ }}
+ >
+ {t("common.reset")}
+ </Button>
+ <Button
+ appearance="outline"
+ size="xs"
+ onClick={(e) => {
+ e.stopPropagation();
+ setResetConfirmSa(undefined);
+ }}
+ >
+ {t("common.cancel")}
+ </Button>
+ </div>
+ );
+ }
+ return (
+ <Button
+ appearance="outline"
+ size="xs"
+ onClick={(e) => {
+ e.stopPropagation();
+ setResetConfirmSa(sa);
+ }}
+ >
+ <KeyRound className="h-3 w-3 mr-1" />
+ {t("settings.members.reset-service-key")}
+ </Button>
+ );
+ };
+
return (
<div className="border rounded-sm overflow-hidden">
<Table>
@@ -171,7 +228,7 @@ function ServiceAccountTable({
</TableRow>
</TableHeader>
<TableBody>
- {users.length === 0 ? (
+ {serviceAccounts.length === 0 ? (
<TableRow>
<TableCell
colSpan={2}
@@ -181,35 +238,31 @@ function ServiceAccountTable({
</TableCell>
</TableRow>
) : (
- users.map((user) => {
- const isDeleted = user.state === State.DELETED;
+ serviceAccounts.map((sa) => {
+ const isDeleted = sa.state === State.DELETED;
const canOpenDetail =
- !!onUserSelected &&
+ !!onSelected &&
(project
? hasProjectPermissionV2(project, "bb.serviceAccounts.get")
: hasWorkspacePermissionV2("bb.serviceAccounts.get"));
return (
<TableRow
- key={user.name}
+ key={sa.name}
className={cn(
canOpenDetail &&
"cursor-pointer focus-visible:outline-none focus-visible:bg-control-bg"
)}
tabIndex={canOpenDetail ? 0 : undefined}
role={canOpenDetail ? "button" : undefined}
- aria-label={
- canOpenDetail ? user.title || user.email : undefined
- }
- onClick={
- canOpenDetail ? () => onUserSelected(user) : undefined
- }
+ aria-label={canOpenDetail ? sa.title || sa.email : undefined}
+ onClick={canOpenDetail ? () => onSelected(sa) : undefined}
onKeyDown={
canOpenDetail
? (e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
- onUserSelected(user);
+ onSelected(sa);
}
}
: undefined
@@ -219,8 +272,8 @@ function ServiceAccountTable({
<TableCell>
<div className="flex items-center gap-x-3">
<UserCell
- title={user.title}
- subtitle={user.email}
+ title={sa.title}
+ subtitle={sa.email}
nameClassName={
isDeleted
? "line-through !text-control-light"
@@ -234,57 +287,7 @@ function ServiceAccountTable({
/>
{!isDeleted && (
<div className="ml-auto text-xs shrink-0">
- {user.serviceKey && !copiedKeys.has(user.name) ? (
- <Button
- appearance="outline"
- size="xs"
- onClick={(e) => {
- e.stopPropagation();
- handleCopyKey(user);
- }}
- >
- <Copy className="h-3 w-3 mr-1" />
- {t("settings.members.copy-service-key")}
- </Button>
- ) : resetConfirmUser?.name === user.name ? (
- <div className="flex items-center gap-x-1">
- <span className="text-xs text-error">
- {t("settings.members.reset-service-key-alert")}
- </span>
- <Button
- variant="destructive"
- size="xs"
- onClick={(e) => {
- e.stopPropagation();
- handleResetKey(user);
- }}
- >
- {t("common.reset")}
- </Button>
- <Button
- appearance="outline"
- size="xs"
- onClick={(e) => {
- e.stopPropagation();
- setResetConfirmUser(undefined);
- }}
- >
- {t("common.cancel")}
- </Button>
- </div>
- ) : (
- <Button
- appearance="outline"
- size="xs"
- onClick={(e) => {
- e.stopPropagation();
- setResetConfirmUser(user);
- }}
- >
- <KeyRound className="h-3 w-3 mr-1" />
- {t("settings.members.reset-service-key")}
- </Button>
- )}
+ {renderKeyAction(sa)}
</div>
)}
</div>
@@ -314,7 +317,7 @@ function ServiceAccountTable({
className="text-error hover:text-error"
onClick={(e) => {
e.stopPropagation();
- handleDeactivate(user);
+ handleDeactivate(sa);
}}
>
<Trash2 className="h-4 w-4" />
@@ -340,7 +343,7 @@ function ServiceAccountTable({
size="sm"
onClick={(e) => {
e.stopPropagation();
- handleRestore(user);
+ handleRestore(sa);
}}
>
<Undo2 className="h-4 w-4" />
@@ -549,7 +552,7 @@ function ServiceAccountForm({
if (updateMask.length > 0) {
updatedSa = await updateServiceAccount(
{
- name: ensureServiceAccountFullName(serviceAccount.email),
+ name: serviceAccount.name,
title,
},
create(FieldMaskSchema, { paths: [...updateMask] })
@@ -655,7 +658,6 @@ export function ServiceAccountsPage({ projectId }: { projectId?: string }) {
const workspaceResourceName = useAppStore((s) => s.workspaceResourceName());
const projectsByName = useAppStore((s) => s.projectsByName);
const listServiceAccounts = useAppStore((state) => state.listServiceAccounts);
- const getServiceAccount = useAppStore((state) => state.getServiceAccount);
const projectName = projectId
? `${projectNamePrefix}${projectId}`
@@ -682,13 +684,15 @@ export function ServiceAccountsPage({ projectId }: { projectId?: string }) {
pageToken: params.pageToken,
showDeleted: false,
});
- const list: User[] = response.serviceAccounts.map(serviceAccountToUser);
- return { list, nextPageToken: response.nextPageToken };
+ return {
+ list: response.serviceAccounts,
+ nextPageToken: response.nextPageToken,
+ };
},
[listServiceAccounts, parent]
);
- const activeData = usePagedData<User>({
+ const activeData = usePagedData<ServiceAccount>({
sessionKey: `bb.service-accounts${projectName ? `.${projectName}` : ""}.active.page-size`,
fetchList: fetchActive,
});
@@ -703,48 +707,49 @@ export function ServiceAccountsPage({ projectId }: { projectId?: string }) {
showDeleted: true,
filter: { state: State.DELETED },
});
- const list: User[] = response.serviceAccounts.map(serviceAccountToUser);
- return { list, nextPageToken: response.nextPageToken };
+ return {
+ list: response.serviceAccounts,
+ nextPageToken: response.nextPageToken,
+ };
},
[listServiceAccounts, parent]
);
- const inactiveData = usePagedData<User>({
+ const inactiveData = usePagedData<ServiceAccount>({
sessionKey: `bb.service-accounts${projectName ? `.${projectName}` : ""}.inactive.page-size`,
enabled: showInactive,
fetchList: fetchInactive,
});
- const handleActiveUserUpdated = (user: User) => {
- if (user.state === State.DELETED) {
- activeData.removeCache(user);
- inactiveData.updateCache([user]);
+ const handleActiveUpdated = (sa: ServiceAccount) => {
+ if (sa.state === State.DELETED) {
+ activeData.removeCache(sa);
+ inactiveData.updateCache([sa]);
} else {
- activeData.updateCache([user]);
+ activeData.updateCache([sa]);
}
};
- const handleInactiveUserUpdated = (user: User) => {
- if (user.state === State.ACTIVE) {
- inactiveData.removeCache(user);
- activeData.updateCache([user]);
+ const handleInactiveUpdated = (sa: ServiceAccount) => {
+ if (sa.state === State.ACTIVE) {
+ inactiveData.removeCache(sa);
+ activeData.updateCache([sa]);
} else {
- inactiveData.updateCache([user]);
+ inactiveData.updateCache([sa]);
}
};
- const handleOpenEdit = (user: User) => {
- const sa = getServiceAccount(user.email);
+ const handleOpenEdit = (sa: ServiceAccount) => {
setEditingSa(sa);
setShowDrawer(true);
};
const handleCreated = (sa: ServiceAccount) => {
- activeData.updateCache([serviceAccountToUser(sa)]);
+ activeData.updateCache([sa]);
};
const handleUpdated = (sa: ServiceAccount) => {
- activeData.updateCache([serviceAccountToUser(sa)]);
+ activeData.updateCache([sa]);
};
const PageLayout = projectName ? ProjectPageLayout : WorkspacePageLayout;
@@ -788,10 +793,10 @@ export function ServiceAccountsPage({ projectId }: { projectId?: string }) {
) : (
<>
<ServiceAccountTable
- users={activeData.dataList}
+ serviceAccounts={activeData.dataList}
project={project}
- onUserUpdated={handleActiveUserUpdated}
- onUserSelected={handleOpenEdit}
+ onUpdated={handleActiveUpdated}
+ onSelected={handleOpenEdit}
/>
<PagedTableFooter
pageSize={activeData.pageSize}
@@ -829,9 +834,9 @@ export function ServiceAccountsPage({ projectId }: { projectId?: string }) {
) : (
<>
<ServiceAccountTable
- users={inactiveData.dataList}
+ serviceAccounts={inactiveData.dataList}
project={project}
- onUserUpdated={handleInactiveUserUpdated}
+ onUpdated={handleInactiveUpdated}
/>
<PagedTableFooter
pageSize={inactiveData.pageSize}
diff --git a/frontend/src/stores/app/serviceAccount.ts b/frontend/src/stores/app/serviceAccount.ts
index 67b1218474..47e3831683 100644
--- a/frontend/src/stores/app/serviceAccount.ts
+++ b/frontend/src/stores/app/serviceAccount.ts
@@ -13,7 +13,6 @@ import {
UndeleteServiceAccountRequestSchema,
UpdateServiceAccountRequestSchema,
} from "@/types/proto-es/v1/service_account_service_pb";
-import { type User, UserSchema } from "@/types/proto-es/v1/user_service_pb";
import type {
AccountFilter,
AppSliceCreator,
@@ -46,16 +45,6 @@ export const buildAccountListFilter = (params: AccountFilter) => {
return filter.join(" && ");
};
-export const serviceAccountToUser = (sa: ServiceAccount): User => {
- return createProto(UserSchema, {
- name: `users/${sa.email}`,
- email: sa.email,
- title: sa.title,
- state: sa.state,
- serviceKey: sa.serviceKey,
- });
-};
-
export const createServiceAccountSlice: AppSliceCreator<ServiceAccountSlice> = (
set,
get
diff --git a/frontend/src/types/proto-es/v1/user_service_pb.d.ts b/frontend/src/types/proto-es/v1/user_service_pb.d.ts
index 57baa4b2df..9bb2bcf0b9 100644
--- a/frontend/src/types/proto-es/v1/user_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/user_service_pb.d.ts
@@ -339,13 +339,6 @@ export declare type User = Message<"bytebase.v1.User"> & {
*/
password: string;
- /**
- * The service key for service account authentication.
- *
- * @generated from field: string service_key = 7;
- */
- serviceKey: string;
-
/**
* The mfa_enabled flag means if the user has enabled MFA.
*
diff --git a/frontend/src/types/proto-es/v1/user_service_pb.js b/frontend/src/types/proto-es/v1/user_service_pb.js
index 7afca2a1be..543a730dc8 100644
--- a/frontend/src/types/proto-es/v1/user_service_pb.js
+++ b/frontend/src/types/proto-es/v1/user_service_pb.js
@@ -16,7 +16,7 @@ import { file_v1_common } from "./common_pb";
* Describes the file v1/user_service.proto.
*/
export const file_v1_user_service = /*@__PURE__*/
- fileDesc("ChV2MS91c2VyX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiQAoUQmF0Y2hHZXRVc2Vyc1JlcXVlc3QSKAoFbmFtZXMYASADKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiOQoVQmF0Y2hHZXRVc2Vyc1Jlc3BvbnNlEiAKBXVzZXJzGAEgAygLMhEuYnl0ZWJhc2UudjEuVXNlciJfChBMaXN0VXNlcnNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJEhQKDHNob3dfZGVsZXRlZBgDIAEoCBIOCgZmaWx0ZXIYBCABKAkiTgoRTGlzdFVzZXJzUmVzcG9uc2USIAoFdXNlcnMYASADKAsyES5ieXRlYmFzZS52MS5Vc2VyEhcKD25leHRfcGFnZV90b2tlbhgCIAEoCSI5ChFDcmVhdGVVc2VyUmVxdWVzdBIkCgR1c2VyGAEgASgLMhEuYnl0ZWJhc2UudjEuVXNlckID4EECIuwBChFVcGRhdGVVc2VyUmVxdWVzdBIkCgR1c2VyGAEgASgLMhEuYnl0ZWJhc2UudjEuVXNlckID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzaxIVCghvdHBfY29kZRgDIAEoCUgAiAEBEiIKGnJlZ2VuZXJhdGVfdGVtcF9tZmFfc2VjcmV0GAQgASgIEiEKGXJlZ2VuZXJhdGVfcmVjb3ZlcnlfY29kZXMYBSABKAgSFQoNYWxsb3dfbWlzc2luZxgGIAEoCEILCglfb3RwX2NvZGUi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ViYXNlLnYxLkRlbGV0ZVVzZXJSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjHaQQRuYW1lkOowApjqMAGg6jAEqOowCYLT5JMCFCoSL3YxL3tuYW1lPXVzZXJzLyp9EnsKDFVuZGVsZXRlVXNlchIgLmJ5dGViYXNlLnYxLlVuZGVsZXRlVXNlclJlcXVlc3QaES5ieXRlYmFzZS52MS5Vc2VyIjaQ6jACmOowAaDqMASo6jAJgtPkkwIgOgEqIhsvdjEve25hbWU9dXNlcnMvKn06dW5kZWxldGUSoQEKC1VwZGF0ZUVtYWlsEh8uYnl0ZWJhc2UudjEuVXBkYXRlRW1haWxSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciJe2kEKbmFtZSxlbWFpbIrqMBRiYi51c2Vycy51cGRhdGVFbWFpbJDqMAGY6jABoOowA6jqMAaC0+STAiM6ASoiHi92MS97bmFtZT11c2Vycy8qfTp1cGRhdGVFbWFpbEKmAQoPY29tLmJ5dGViYXNlLnYxQhBVc2VyU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common]);
+ fileDesc("ChV2MS91c2VyX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiQAoUQmF0Y2hHZXRVc2Vyc1JlcXVlc3QSKAoFbmFtZXMYASADKA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uYnl0ZWJhc2UudjEuVXBkYXRlRW1haWxSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciJe2kEKbmFtZSxlbWFpbIrqMBRiYi51c2Vycy51cGRhdGVFbWFpbJDqMAGY6jABoOowA6jqMAaC0+STAiM6ASoiHi92MS97bmFtZT11c2Vycy8qfTp1cGRhdGVFbWFpbEKmAQoPY29tLmJ5dGViYXNlLnYxQhBVc2VyU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common]);
/**
* Describes the message bytebase.v1.GetUserRequest.
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 57c69a68c2..4146a252d3 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -32292,10 +32292,6 @@ components:
title: password
description: The password for authentication. Only used during user creation or password updates.
writeOnly: true
- serviceKey:
- type: string
- title: service_key
- description: The service key for service account authentication.
mfaEnabled:
type: boolean
title: mfa_enabled
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 3dc4e7c621..ff87056269 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -5522,7 +5522,6 @@ The user&#39;s `name` field is used to identify the user to update. Format: user
| email | [string](#string) | | The email address of the user, used for login and notifications. |
| title | [string](#string) | | The display title or full name of the user. |
| password | [string](#string) | | The password for authentication. Only used during user creation or password updates. |
-| service_key | [string](#string) | | The service key for service account authentication. |
| mfa_enabled | [bool](#bool) | | The mfa_enabled flag means if the user has enabled MFA. |
| temp_otp_secret | [string](#string) | | Temporary OTP secret used during MFA setup and regeneration. |
| temp_recovery_codes | [string](#string) | repeated | Temporary recovery codes used during MFA setup and regeneration. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index a7b277625b..4a25366892 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -15759,13 +15759,6 @@ Format: users/{email} </p></td>
<td><p>The password for authentication. Only used during user creation or password updates. </p></td>
</tr>
- <tr>
- <td>service_key</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The service key for service account authentication. </p></td>
- </tr>
-
<tr>
<td>mfa_enabled</td>
<td><a href="#bool">bool</a></td>
diff --git a/proto/v1/v1/user_service.proto b/proto/v1/v1/user_service.proto
index a13d0ce6ea..df98c7b6c8 100644
--- a/proto/v1/v1/user_service.proto
+++ b/proto/v1/v1/user_service.proto
@@ -265,7 +265,7 @@ message UpdateEmailRequest {
}
message User {
- reserved 5, 15;
+ reserved 5, 7, 15;
option (google.api.resource) = {
type: "bytebase.com/User"
@@ -288,9 +288,6 @@ message User {
// The password for authentication. Only used during user creation or password updates.
string password = 6 [(google.api.field_behavior) = INPUT_ONLY];
- // The service key for service account authentication.
- string service_key = 7;
-
// The mfa_enabled flag means if the user has enabled MFA.
bool mfa_enabled = 8;