Skip to content

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

fix: disallow SSO user to change password (#4526)

boojack7dfb88613879
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.go
index a74262ec2b..a7c6889a46 100644
--- a/backend/api/v1/auth_service.go
+++ b/backend/api/v1/auth_service.go
@@ -219,6 +219,9 @@ func (s *AuthService) UpdateUser(ctx context.Context, request *v1pb.UpdateUserRe
case "user.title":
patch.Name = &request.User.Title
case "user.password":
+ if user.IdentityProviderResourceID != nil {
+ return nil, status.Errorf(codes.PermissionDenied, "SSO user cannot modify password")
+ }
passwordHash, err := bcrypt.GenerateFromPassword([]byte(request.User.Password), bcrypt.DefaultCost)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to generate password hash, error: %v", err)
diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vue
index 43cef89751..5220e2cf57 100644
--- a/frontend/src/views/ProfileDashboard.vue
+++ b/frontend/src/views/ProfileDashboard.vue
@@ -120,14 +120,13 @@
</dt>
<dd class="mt-1 text-sm text-main">
<input
- v-if="state.editing"
+ v-if="state.editing && !isSSOUser"
id="email"
required
autocomplete="off"
name="email"
type="text"
class="textfield"
- :disabled="isSSOUser"
:value="state.editingPrincipal?.email"
@input="(e: any)=>updatePrincipal('email', e.target.value)"
/>
@@ -137,7 +136,7 @@
</dd>
</div>
- <template v-if="state.editing">
+ <template v-if="state.editing && !isSSOUser">
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-control-light">
{{ $t("settings.profile.password") }}