Skip to content

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

fix: prevent MFA secret leak to unauthorized users (#17892)

boojack6cba678c6dd5
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.go
index 76184ecaa3..035c0f04b0 100644
--- a/backend/api/v1/auth_service.go
+++ b/backend/api/v1/auth_service.go
@@ -194,7 +194,7 @@ func (s *AuthService) Login(ctx context.Context, req *connect.Request[v1pb.Login
slog.Error("failed to update user profile", log.BBError(err), slog.String("user", loginUser.Email))
}
- response.User = convertToUser(loginUser)
+ response.User = convertToUser(ctx, loginUser)
s.metricReporter.Report(ctx, &metric.Metric{
Name: metricapi.PrincipalLoginMetricName,
diff --git a/backend/api/v1/user_service.go b/backend/api/v1/user_service.go
index b56612a82c..8d86035526 100644
--- a/backend/api/v1/user_service.go
+++ b/backend/api/v1/user_service.go
@@ -78,7 +78,7 @@ func (s *UserService) GetUser(ctx context.Context, request *connect.Request[v1pb
if user == nil {
return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("user %d not found", userID))
}
- return connect.NewResponse(convertToUser(user)), nil
+ return connect.NewResponse(convertToUser(ctx, user)), nil
}
// BatchGetUsers get users in batch.
@@ -100,7 +100,7 @@ func (*UserService) GetCurrentUser(ctx context.Context, _ *connect.Request[empty
if !ok || user == nil {
return nil, connect.NewError(connect.CodeUnauthenticated, errors.Errorf("authenticated user not found"))
}
- return connect.NewResponse(convertToUser(user)), nil
+ return connect.NewResponse(convertToUser(ctx, user)), nil
}
// ListUsers lists all users.
@@ -159,7 +159,7 @@ func (s *UserService) ListUsers(ctx context.Context, request *connect.Request[v1
NextPageToken: nextPageToken,
}
for _, user := range users {
- response.Users = append(response.Users, convertToUser(user))
+ response.Users = append(response.Users, convertToUser(ctx, user))
}
return connect.NewResponse(response), nil
}
@@ -293,7 +293,7 @@ func (s *UserService) CreateUser(ctx context.Context, request *connect.Request[v
},
})
- userResponse := convertToUser(user)
+ userResponse := convertToUser(ctx, user)
if request.Msg.User.UserType == v1pb.UserType_SERVICE_ACCOUNT {
userResponse.ServiceKey = password
}
@@ -506,7 +506,7 @@ func (s *UserService) UpdateUser(ctx context.Context, request *connect.Request[v
return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to update user, error: %v", err))
}
- userResponse := convertToUser(user)
+ userResponse := convertToUser(ctx, user)
if request.Msg.User.UserType == v1pb.UserType_SERVICE_ACCOUNT && passwordPatch != nil {
userResponse.ServiceKey = *passwordPatch
}
@@ -644,7 +644,7 @@ func (s *UserService) UndeleteUser(ctx context.Context, request *connect.Request
if err != nil {
return nil, connect.NewError(connect.CodeInternal, err)
}
- return connect.NewResponse(convertToUser(user)), nil
+ return connect.NewResponse(convertToUser(ctx, user)), nil
}
func convertToV1UserType(userType storepb.PrincipalType) v1pb.UserType {
@@ -660,7 +660,7 @@ func convertToV1UserType(userType storepb.PrincipalType) v1pb.UserType {
}
}
-func convertToUser(user *store.UserMessage) *v1pb.User {
+func convertToUser(ctx context.Context, user *store.UserMessage) *v1pb.User {
convertedUser := &v1pb.User{
Name: common.FormatUserUID(user.ID),
State: convertDeletedToState(user.MemberDeleted),
@@ -681,8 +681,11 @@ func convertToUser(user *store.UserMessage) *v1pb.User {
if user.MFAConfig != nil {
convertedUser.MfaEnabled = user.MFAConfig.OtpSecret != ""
- convertedUser.MfaSecret = user.MFAConfig.TempOtpSecret
- convertedUser.RecoveryCodes = user.MFAConfig.TempRecoveryCodes
+ // Only expose temporary MFA secrets and recovery codes to the user themselves
+ if currentUser, ok := GetUserFromContext(ctx); ok && currentUser.ID == user.ID {
+ convertedUser.TempOtpSecret = user.MFAConfig.TempOtpSecret
+ convertedUser.TempRecoveryCodes = user.MFAConfig.TempRecoveryCodes
+ }
}
return convertedUser
}
diff --git a/backend/generated-go/v1/user_service.pb.go b/backend/generated-go/v1/user_service.pb.go
index 6e7b2ea668..35ed1689dc 100644
--- a/backend/generated-go/v1/user_service.pb.go
+++ b/backend/generated-go/v1/user_service.pb.go
@@ -625,10 +625,10 @@ type User struct {
ServiceKey string `protobuf:"bytes,8,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,9,opt,name=mfa_enabled,json=mfaEnabled,proto3" json:"mfa_enabled,omitempty"`
- // The mfa_secret is the temporary secret using in two phase verification.
- MfaSecret string `protobuf:"bytes,10,opt,name=mfa_secret,json=mfaSecret,proto3" json:"mfa_secret,omitempty"`
- // The recovery_codes is the temporary recovery codes using in two phase verification.
- RecoveryCodes []string `protobuf:"bytes,11,rep,name=recovery_codes,json=recoveryCodes,proto3" json:"recovery_codes,omitempty"`
+ // Temporary OTP secret used during MFA setup and regeneration.
+ TempOtpSecret string `protobuf:"bytes,10,opt,name=temp_otp_secret,json=tempOtpSecret,proto3" json:"temp_otp_secret,omitempty"`
+ // Temporary recovery codes used during MFA setup and regeneration.
+ TempRecoveryCodes []string `protobuf:"bytes,11,rep,name=temp_recovery_codes,json=tempRecoveryCodes,proto3" json:"temp_recovery_codes,omitempty"`
// Should be a valid E.164 compliant phone number.
// Could be empty.
Phone string `protobuf:"bytes,12,opt,name=phone,proto3" json:"phone,omitempty"`
@@ -727,16 +727,16 @@ func (x *User) GetMfaEnabled() bool {
return false
}
-func (x *User) GetMfaSecret() string {
+func (x *User) GetTempOtpSecret() string {
if x != nil {
- return x.MfaSecret
+ return x.TempOtpSecret
}
return ""
}
-func (x *User) GetRecoveryCodes() []string {
+func (x *User) GetTempRecoveryCodes() []string {
if x != nil {
- return x.RecoveryCodes
+ return x.TempRecoveryCodes
}
return nil
}
@@ -863,7 +863,7 @@ const file_v1_user_service_proto_rawDesc = "" +
"\x11bytebase.com/UserR\x04name\"D\n" +
"\x13UndeleteUserRequest\x12-\n" +
"\x04name\x18\x01 \x01(\tB\x19\xe0A\x02\xfaA\x13\n" +
- "\x11bytebase.com/UserR\x04name\"\xa4\x05\n" +
+ "\x11bytebase.com/UserR\x04name\"\xb6\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" +
@@ -874,11 +874,10 @@ const file_v1_user_service_proto_rawDesc = "" +
"\vservice_key\x18\b \x01(\tB\x03\xe0A\x04R\n" +
"serviceKey\x12\x1f\n" +
"\vmfa_enabled\x18\t \x01(\bR\n" +
- "mfaEnabled\x12\x1d\n" +
- "\n" +
- "mfa_secret\x18\n" +
- " \x01(\tR\tmfaSecret\x12%\n" +
- "\x0erecovery_codes\x18\v \x03(\tR\rrecoveryCodes\x12\x14\n" +
+ "mfaEnabled\x12&\n" +
+ "\x0ftemp_otp_secret\x18\n" +
+ " \x01(\tR\rtempOtpSecret\x12.\n" +
+ "\x13temp_recovery_codes\x18\v \x03(\tR\x11tempRecoveryCodes\x12\x14\n" +
"\x05phone\x18\f \x01(\tR\x05phone\x123\n" +
"\aprofile\x18\r \x01(\v2\x19.bytebase.v1.User.ProfileR\aprofile\x12\x1b\n" +
"\x06groups\x18\x0e \x03(\tB\x03\xe0A\x03R\x06groups\x1a\xbc\x01\n" +
diff --git a/backend/generated-go/v1/user_service_equal.pb.go b/backend/generated-go/v1/user_service_equal.pb.go
index ac698d0f3a..b3dc0de560 100644
--- a/backend/generated-go/v1/user_service_equal.pb.go
+++ b/backend/generated-go/v1/user_service_equal.pb.go
@@ -221,14 +221,14 @@ func (x *User) Equal(y *User) bool {
if x.MfaEnabled != y.MfaEnabled {
return false
}
- if x.MfaSecret != y.MfaSecret {
+ if x.TempOtpSecret != y.TempOtpSecret {
return false
}
- if len(x.RecoveryCodes) != len(y.RecoveryCodes) {
+ if len(x.TempRecoveryCodes) != len(y.TempRecoveryCodes) {
return false
}
- for i := 0; i < len(x.RecoveryCodes); i++ {
- if x.RecoveryCodes[i] != y.RecoveryCodes[i] {
+ for i := 0; i < len(x.TempRecoveryCodes); i++ {
+ if x.TempRecoveryCodes[i] != y.TempRecoveryCodes[i] {
return false
}
}
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 0804a5b851..00664fb33e 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
@@ -338,18 +338,18 @@ export declare type User = Message<"bytebase.v1.User"> & {
mfaEnabled: boolean;
/**
- * The mfa_secret is the temporary secret using in two phase verification.
+ * Temporary OTP secret used during MFA setup and regeneration.
*
- * @generated from field: string mfa_secret = 10;
+ * @generated from field: string temp_otp_secret = 10;
*/
- mfaSecret: string;
+ tempOtpSecret: string;
/**
- * The recovery_codes is the temporary recovery codes using in two phase verification.
+ * Temporary recovery codes used during MFA setup and regeneration.
*
- * @generated from field: repeated string recovery_codes = 11;
+ * @generated from field: repeated string temp_recovery_codes = 11;
*/
- recoveryCodes: string[];
+ tempRecoveryCodes: string[];
/**
* Should be a valid E.164 compliant phone number.
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 4f8c7cfc8d..091812c15b 100644
--- a/frontend/src/types/proto-es/v1/user_service_pb.js
+++ b/frontend/src/types/proto-es/v1/user_service_pb.js
@@ -15,7 +15,7 @@ import { file_v1_common } from "./common_pb";
* Describes the file v1/user_service.proto.
*/
export const file_v1_user_service = /*@__PURE__*/
- fileDesc("ChV2MS91c2VyX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiQAoUQmF0Y2hHZXRVc2Vyc1JlcXVlc3QSKAoFbmFtZXMYASADKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiOQoVQmF0Y2hHZXRVc2Vyc1Jlc3BvbnNlEiAKBXVzZXJzGAEgAygLMhEuYnl0ZWJhc2UudjEuVXNlciJfChBMaXN0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FzZS52MS5MaXN0VXNlcnNSZXNwb25zZSIv2kEGcGFyZW50iuowDWJiLnVzZXJzLmxpc3SQ6jABgtPkkwILEgkvdjEvdXNlcnMSawoKQ3JlYXRlVXNlchIeLmJ5dGViYXNlLnYxLkNyZWF0ZVVzZXJSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciIq2kEEdXNlcoDqMAGQ6jACmOowAYLT5JMCEToEdXNlciIJL3YxL3VzZXJzEoEBCgpVcGRhdGVVc2VyEh4uYnl0ZWJhc2UudjEuVXBkYXRlVXNlclJlcXVlc3QaES5ieXRlYmFzZS52MS5Vc2VyIkDaQRB1c2VyLHVwZGF0ZV9tYXNrkOowApjqMAGC0+STAh86BHVzZXIyFy92MS97dXNlci5uYW1lPXVzZXJzLyp9Em8KCkRlbGV0ZVVzZXISHi5ieXRlYmFzZS52MS5EZWxldGVVc2VyUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIp2kEEbmFtZZDqMAKY6jABgtPkkwIUKhIvdjEve25hbWU9dXNlcnMvKn0ScwoMVW5kZWxldGVVc2VyEiAuYnl0ZWJhc2UudjEuVW5kZWxldGVVc2VyUmVxdWVzdBoRLmJ5dGViYXNlLnYxLlVzZXIiLpDqMAKY6jABgtPkkwIgOgEqIhsvdjEve25hbWU9dXNlcnMvKn06dW5kZWxldGVCNlo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z", [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("ChV2MS91c2VyX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIjkKDkdldFVzZXJSZXF1ZXN0EicKBG5hbWUYASABKAlCGeBBAvpBEwoRYnl0ZWJhc2UuY29tL1VzZXIiQAoUQmF0Y2hHZX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DkdldEN1cnJlbnRVc2VyEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5GhEuYnl0ZWJhc2UudjEuVXNlciIcgOowAZDqMAKC0+STAg4SDC92MS91c2Vycy9tZRJ7CglMaXN0VXNlcnMSHS5ieXRlYmFzZS52MS5MaXN0VXNlcnNSZXF1ZXN0Gh4uYnl0ZWJhc2UudjEuTGlzdFVzZXJzUmVzcG9uc2UiL9pBBnBhcmVudIrqMA1iYi51c2Vycy5saXN0kOowAYLT5JMCCxIJL3YxL3VzZXJzEmsKCkNyZWF0ZVVzZXISHi5ieXRlYmFzZS52MS5DcmVhdGVVc2VyUmVxdWVzdBoRLmJ5dGViYXNlLnYxLlVzZXIiKtpBBHVzZXKA6jABkOowApjqMAGC0+STAhE6BHVzZXIiCS92MS91c2VycxKBAQoKVXBkYXRlVXNlchIeLmJ5dGViYXNlLnYxLlVwZGF0ZVVzZXJSZXF1ZXN0GhEuYnl0ZWJhc2UudjEuVXNlciJA2kEQdXNlcix1cGRhdGVfbWFza5DqMAKY6jABgtPkkwIfOgR1c2VyMhcvdjEve3VzZXIubmFtZT11c2Vycy8qfRJvCgpEZWxldGVVc2VyEh4uYnl0ZWJhc2UudjEuRGVsZXRlVXNlclJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiKdpBBG5hbWWQ6jACmOowAYLT5JMCFCoSL3YxL3tuYW1lPXVzZXJzLyp9EnMKDFVuZGVsZXRlVXNlchIgLmJ5dGViYXNlLnYxLlVuZGVsZXRlVXNlclJlcXVlc3QaES5ieXRlYmFzZS52MS5Vc2VyIi6Q6jACmOowAYLT5JMCIDoBKiIbL3YxL3tuYW1lPXVzZXJzLyp9OnVuZGVsZXRlQjZaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjFiBnByb3RvMw", [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/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vue
index 51ffddb8d3..758e9cfb9b 100644
--- a/frontend/src/views/ProfileDashboard.vue
+++ b/frontend/src/views/ProfileDashboard.vue
@@ -192,7 +192,7 @@
</p>
<RegenerateRecoveryCodesView
v-if="state.showRegenerateRecoveryCodesView"
- :recovery-codes="currentUser.recoveryCodes"
+ :recovery-codes="currentUser.tempRecoveryCodes"
@close="state.showRegenerateRecoveryCodesView = false"
/>
</template>
diff --git a/frontend/src/views/TwoFactorSetup.vue b/frontend/src/views/TwoFactorSetup.vue
index 71021d01ca..daf594900d 100644
--- a/frontend/src/views/TwoFactorSetup.vue
+++ b/frontend/src/views/TwoFactorSetup.vue
@@ -65,7 +65,7 @@
<template #1>
<div class="w-full max-w-2xl mx-auto">
<RecoveryCodesView
- :recovery-codes="currentUser.recoveryCodes"
+ :recovery-codes="currentUser.tempRecoveryCodes"
@download="state.recoveryCodesDownloaded = true"
/>
</div>
@@ -74,7 +74,7 @@
<TwoFactorSecretModal
v-if="state.showSecretModal"
- :secret="currentUser.mfaSecret"
+ :secret="currentUser.tempOtpSecret"
@close="state.showSecretModal = false"
/>
</template>
@@ -239,7 +239,7 @@ const tryFinishSetup = async () => {
watch(
[currentUser],
async () => {
- const otpauthUrl = `otpauth://totp/${issuerName}:${currentUser.value.email}?algorithm=SHA1&digits=6&issuer=${issuerName}&period=30&secret=${currentUser.value.mfaSecret}`;
+ const otpauthUrl = `otpauth://totp/${issuerName}:${currentUser.value.email}?algorithm=SHA1&digits=6&issuer=${issuerName}&period=30&secret=${currentUser.value.tempOtpSecret}`;
state.qrcodeDataUrl = await QRCode.toDataURL(otpauthUrl);
},
{ deep: true, immediate: true }
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 4a90ab53da..6f8323a5fd 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -14653,14 +14653,14 @@ components:
mfaEnabled:
type: boolean
description: The mfa_enabled flag means if the user has enabled MFA.
- mfaSecret:
+ tempOtpSecret:
type: string
- description: The mfa_secret is the temporary secret using in two phase verification.
- recoveryCodes:
+ description: Temporary OTP secret used during MFA setup and regeneration.
+ tempRecoveryCodes:
type: array
items:
type: string
- description: The recovery_codes is the temporary recovery codes using in two phase verification.
+ description: Temporary recovery codes used during MFA setup and regeneration.
phone:
type: string
description: |-
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 0dafde5bb0..41e0e8a165 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -5068,8 +5068,8 @@ The user&#39;s `name` field is used to identify the user to update. Format: 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. Only used for service accounts. |
| mfa_enabled | [bool](#bool) | | The mfa_enabled flag means if the user has enabled MFA. |
-| mfa_secret | [string](#string) | | The mfa_secret is the temporary secret using in two phase verification. |
-| recovery_codes | [string](#string) | repeated | The recovery_codes is the temporary recovery codes using in two phase verification. |
+| 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. |
| phone | [string](#string) | | Should be a valid E.164 compliant phone number. Could be empty. |
| profile | [User.Profile](#bytebase-v1-User-Profile) | | User profile metadata. |
| groups | [string](#string) | repeated | The groups for the user. Format: groups/{email} |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index c80825f119..f1a0dec83e 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -14738,17 +14738,17 @@ Format: users/{user}. {user} is a system-generated unique ID. </p></td>
</tr>
<tr>
- <td>mfa_secret</td>
+ <td>temp_otp_secret</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The mfa_secret is the temporary secret using in two phase verification. </p></td>
+ <td><p>Temporary OTP secret used during MFA setup and regeneration. </p></td>
</tr>
<tr>
- <td>recovery_codes</td>
+ <td>temp_recovery_codes</td>
<td><a href="#string">string</a></td>
<td>repeated</td>
- <td><p>The recovery_codes is the temporary recovery codes using in two phase verification. </p></td>
+ <td><p>Temporary recovery codes used during MFA setup and regeneration. </p></td>
</tr>
<tr>
diff --git a/proto/v1/v1/user_service.proto b/proto/v1/v1/user_service.proto
index 9b471bcdac..6d5e0708fb 100644
--- a/proto/v1/v1/user_service.proto
+++ b/proto/v1/v1/user_service.proto
@@ -253,11 +253,11 @@ message User {
// The mfa_enabled flag means if the user has enabled MFA.
bool mfa_enabled = 9;
- // The mfa_secret is the temporary secret using in two phase verification.
- string mfa_secret = 10;
+ // Temporary OTP secret used during MFA setup and regeneration.
+ string temp_otp_secret = 10;
- // The recovery_codes is the temporary recovery codes using in two phase verification.
- repeated string recovery_codes = 11;
+ // Temporary recovery codes used during MFA setup and regeneration.
+ repeated string temp_recovery_codes = 11;
// Should be a valid E.164 compliant phone number.
// Could be empty.