Skip to content

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

feat: hash the SCIM directory sync token at rest

Danny3d9ba0c20907
diff --git a/backend/api/directory-sync/webhook.go b/backend/api/directory-sync/webhook.go
index 4142b8584d..2bcbe3bc41 100644
--- a/backend/api/directory-sync/webhook.go
+++ b/backend/api/directory-sync/webhook.go
@@ -845,14 +845,22 @@ func (s *Service) validRequestURL(ctx context.Context, c *echo.Context) error {
if err != nil {
return errors.Wrapf(err, "failed to get workspace profile setting")
}
- if workspaceProfileSetting.DirectorySyncToken == "" {
+
+ return checkDirectorySyncToken(workspaceProfileSetting, authorization)
+}
+
+// checkDirectorySyncToken validates a presented SCIM bearer token against the
+// stored SHA-256 hash. The token value itself is never stored, so a leaked
+// database gives an attacker nothing they can present here.
+func checkDirectorySyncToken(setting *storepb.WorkspaceProfileSetting, presented string) error {
+ hash := setting.GetDirectorySyncTokenHash()
+ if hash == "" {
return errors.Errorf("directory sync token is not configured")
}
- if subtle.ConstantTimeCompare([]byte(workspaceProfileSetting.DirectorySyncToken), []byte(authorization)) != 1 {
+ if subtle.ConstantTimeCompare([]byte(common.HashDirectorySyncToken(presented)), []byte(hash)) != 1 {
return errors.Errorf("invalid authorization token")
}
-
return nil
}
diff --git a/backend/api/directory-sync/webhook_token_test.go b/backend/api/directory-sync/webhook_token_test.go
new file mode 100644
index 0000000000..9a27d02b6e
--- /dev/null
+++ b/backend/api/directory-sync/webhook_token_test.go
@@ -0,0 +1,99 @@
+package directorysync
+
+import (
+ "crypto/sha256"
+ "encoding/hex"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/bytebase/bytebase/backend/common"
+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"
+)
+
+// The rotate handler stores common.HashDirectorySyncToken(token); this path must
+// accept the plaintext behind it. Computing the expected hash independently here
+// (rather than calling the shared helper) means a change to the digest or the
+// encoding shows up as a failure instead of both sides moving together.
+func TestCheckDirectorySyncTokenAcceptsWhatRotateStores(t *testing.T) {
+ const token = "3f4e5d6c-4444-4000-8000-112233445566"
+
+ sum := sha256.Sum256([]byte(token))
+ stored := common.HashDirectorySyncToken(token)
+ require.Equal(t, hex.EncodeToString(sum[:]), stored,
+ "stored hash must stay hex-encoded SHA-256; the SQL migration writes the same encoding")
+
+ require.NoError(t, checkDirectorySyncToken(
+ &storepb.WorkspaceProfileSetting{DirectorySyncTokenHash: stored}, token))
+
+ // A rotation replaces the hash, so the previous token must stop working.
+ rotated := common.HashDirectorySyncToken("a-different-token")
+ require.Error(t, checkDirectorySyncToken(
+ &storepb.WorkspaceProfileSetting{DirectorySyncTokenHash: rotated}, token),
+ "the pre-rotation token must be rejected after rotation")
+}
+
+func TestCheckDirectorySyncToken(t *testing.T) {
+ const token = "7a1b9f30-1111-4000-8000-abcdefabcdef"
+ hashOf := func(s string) string {
+ sum := sha256.Sum256([]byte(s))
+ return hex.EncodeToString(sum[:])
+ }
+
+ for _, tt := range []struct {
+ name string
+ setting *storepb.WorkspaceProfileSetting
+ presented string
+ wantErr bool
+ }{
+ {
+ // The migration hashes the existing token in place, so a token an IdP
+ // was already configured with keeps authenticating.
+ name: "accepts the plaintext behind the stored hash",
+ setting: &storepb.WorkspaceProfileSetting{DirectorySyncTokenHash: hashOf(token)},
+ presented: token,
+ },
+ {
+ name: "rejects a different token",
+ setting: &storepb.WorkspaceProfileSetting{DirectorySyncTokenHash: hashOf(token)},
+ presented: "not-the-token",
+ wantErr: true,
+ },
+ {
+ // Presenting the stored hash itself must not authenticate, otherwise
+ // reading the database would be as good as holding the token.
+ name: "rejects the hash itself",
+ setting: &storepb.WorkspaceProfileSetting{DirectorySyncTokenHash: hashOf(token)},
+ presented: hashOf(token),
+ wantErr: true,
+ },
+ {
+ name: "rejects when no token is configured",
+ setting: &storepb.WorkspaceProfileSetting{},
+ presented: token,
+ wantErr: true,
+ },
+ {
+ name: "rejects an empty presentation",
+ setting: &storepb.WorkspaceProfileSetting{DirectorySyncTokenHash: hashOf(token)},
+ presented: "",
+ wantErr: true,
+ },
+ {
+ // An empty hash must not be treated as "matches the empty token".
+ name: "rejects an empty presentation against an empty hash",
+ setting: &storepb.WorkspaceProfileSetting{DirectorySyncTokenHash: ""},
+ presented: "",
+ wantErr: true,
+ },
+ } {
+ t.Run(tt.name, func(t *testing.T) {
+ err := checkDirectorySyncToken(tt.setting, tt.presented)
+ if tt.wantErr {
+ require.Error(t, err)
+ return
+ }
+ require.NoError(t, err)
+ })
+ }
+}
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 8898e0a51c..831c2aa006 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -7718,6 +7718,47 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.ListWorkspacesResponse'
+ /bytebase.v1.WorkspaceService/RotateDirectorySyncToken:
+ post:
+ tags:
+ - bytebase.v1.WorkspaceService
+ summary: RotateDirectorySyncToken
+ description: |-
+ Mints a new directory sync (SCIM) token, immediately invalidating the
+ previous one. The plaintext token is returned exactly once and cannot be
+ retrieved afterwards; only its hash is stored. Callers that lose it must
+ rotate again and update their identity provider.
+ Permissions required: bb.workspaces.rotateDirectorySyncToken
+ operationId: bytebase.v1.WorkspaceService.RotateDirectorySyncToken
+ parameters:
+ - name: Connect-Protocol-Version
+ in: header
+ required: true
+ schema:
+ $ref: '#/components/schemas/connect-protocol-version'
+ - name: Connect-Timeout-Ms
+ in: header
+ schema:
+ $ref: '#/components/schemas/connect-timeout-header'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.RotateDirectorySyncTokenRequest'
+ required: true
+ responses:
+ default:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/connect.error'
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.RotateDirectorySyncTokenResponse'
/bytebase.v1.WorkspaceService/SetIamPolicy:
post:
tags:
@@ -17065,6 +17106,26 @@ components:
title: RolloutPolicy
additionalProperties: false
description: Rollout policy configuration.
+ bytebase.v1.RotateDirectorySyncTokenRequest:
+ type: object
+ properties:
+ name:
+ type: string
+ title: name
+ description: |-
+ The workspace whose directory sync token is rotated.
+ Format: workspaces/{workspace}
+ title: RotateDirectorySyncTokenRequest
+ additionalProperties: false
+ bytebase.v1.RotateDirectorySyncTokenResponse:
+ type: object
+ properties:
+ token:
+ type: string
+ title: token
+ description: The new token, in plaintext. This is the only time it is ever returned.
+ title: RotateDirectorySyncTokenResponse
+ additionalProperties: false
bytebase.v1.RowValue:
type: object
oneOf:
@@ -21145,10 +21206,6 @@ components:
description: |-
Whether to display watermark on pages.
Requires ENTERPRISE license.
- directorySyncToken:
- type: string
- title: directory_sync_token
- description: The token for directory sync authentication.
passwordRestriction:
title: password_restriction
description: Password restriction settings.
@@ -21207,6 +21264,13 @@ components:
connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —
omit the update mask path to leave the ceiling unset.
$ref: '#/components/schemas/bytebase.v1.WorkspaceProfileSetting.MCPCapability'
+ directorySyncTokenConfigured:
+ type: boolean
+ title: directory_sync_token_configured
+ description: |-
+ Whether a directory sync token has been generated for this workspace.
+ The token itself is never returned; this only lets the UI decide between
+ offering "generate" and "regenerate".
title: WorkspaceProfileSetting
additionalProperties: false
bytebase.v1.WorkspaceProfileSetting.MCPCapability:
diff --git a/backend/api/v1/audit.go b/backend/api/v1/audit.go
index 796e5a4020..4da9435525 100644
--- a/backend/api/v1/audit.go
+++ b/backend/api/v1/audit.go
@@ -517,6 +517,8 @@ func getResponseString(response any) (string, error) {
return redactLoginResponse(r)
case *v1pb.ExchangeTokenResponse:
return redactExchangeTokenResponse(r)
+ case *v1pb.RotateDirectorySyncTokenResponse:
+ return redactRotateDirectorySyncTokenResponse(r)
case *v1pb.User:
return redactUser(r)
case *v1pb.Instance:
@@ -627,6 +629,18 @@ func redactExchangeTokenResponse(r *v1pb.ExchangeTokenResponse) *v1pb.ExchangeTo
return &v1pb.ExchangeTokenResponse{}
}
+// redactRotateDirectorySyncTokenResponse drops the newly minted SCIM token. The
+// whole point of hashing it at rest is that the plaintext exists only in the
+// single response to the admin who rotated it; writing it to the audit log would
+// hand a working credential to anyone who can read that log. Returns an empty
+// response so the audit entry still records that the rotation happened.
+func redactRotateDirectorySyncTokenResponse(r *v1pb.RotateDirectorySyncTokenResponse) *v1pb.RotateDirectorySyncTokenResponse {
+ if r == nil {
+ return nil
+ }
+ return &v1pb.RotateDirectorySyncTokenResponse{}
+}
+
func redactCreateUserRequest(r *v1pb.CreateUserRequest) *v1pb.CreateUserRequest {
if r == nil {
return nil
diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.go
index 1c59cb3972..ae414e6fd5 100644
--- a/backend/api/v1/setting_service.go
+++ b/backend/api/v1/setting_service.go
@@ -8,7 +8,6 @@ import (
"time"
"connectrpc.com/connect"
- "github.com/google/uuid"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto" // Added
@@ -889,13 +888,6 @@ func mergeWorkspaceProfilePaths(request *connect.Request[v1pb.UpdateSettingReque
oldSetting.EnableAuditLogStdout = payload.EnableAuditLogStdout
case "value.workspace_profile.watermark":
oldSetting.Watermark = payload.Watermark
- case "value.workspace_profile.directory_sync_token":
- // Generate a new token if the payload is empty.
- // This handles both initial setup and token reset (when user explicitly sends empty string).
- if payload.DirectorySyncToken == "" {
- payload.DirectorySyncToken = uuid.New().String()
- }
- oldSetting.DirectorySyncToken = payload.DirectorySyncToken
case "value.workspace_profile.password_restriction":
oldSetting.PasswordRestriction = payload.PasswordRestriction
case "value.workspace_profile.sql_result_size":
diff --git a/backend/api/v1/setting_service_converter.go b/backend/api/v1/setting_service_converter.go
index ae3c2a922b..bc22ce90a9 100644
--- a/backend/api/v1/setting_service_converter.go
+++ b/backend/api/v1/setting_service_converter.go
@@ -270,14 +270,17 @@ func convertWorkspaceProfileSetting(v1Setting *v1pb.WorkspaceProfileSetting) *st
EnableMetricCollection: v1Setting.EnableMetricCollection,
EnableAuditLogStdout: v1Setting.EnableAuditLogStdout,
Watermark: v1Setting.Watermark,
- DirectorySyncToken: v1Setting.DirectorySyncToken,
- PasswordRestriction: convertToStorePasswordRestriction(v1Setting.PasswordRestriction),
- EnableDebug: v1Setting.EnableDebug,
- SqlResultSize: v1Setting.SqlResultSize,
- QueryTimeout: v1Setting.QueryTimeout,
- SqlEditorThemeId: v1Setting.SqlEditorThemeId,
- SqlEditorCustomTheme: convertToStoreSQLEditorThemeSetting(v1Setting.SqlEditorCustomTheme),
- McpCapability: storepb.WorkspaceProfileSetting_MCPCapability(v1Setting.McpCapability),
+ // The directory sync token is not settable through this blob; it is minted
+ // by WorkspaceService.RotateDirectorySyncToken. Callers of UpdateSetting
+ // must not be able to choose it, so nothing is carried over here — the
+ // update path preserves the stored hash instead.
+ PasswordRestriction: convertToStorePasswordRestriction(v1Setting.PasswordRestriction),
+ EnableDebug: v1Setting.EnableDebug,
+ SqlResultSize: v1Setting.SqlResultSize,
+ QueryTimeout: v1Setting.QueryTimeout,
+ SqlEditorThemeId: v1Setting.SqlEditorThemeId,
+ SqlEditorCustomTheme: convertToStoreSQLEditorThemeSetting(v1Setting.SqlEditorCustomTheme),
+ McpCapability: storepb.WorkspaceProfileSetting_MCPCapability(v1Setting.McpCapability),
}
// Convert announcement if present. The store only holds the theme colors.
@@ -345,15 +348,18 @@ func convertToWorkspaceProfileSetting(storeSetting *storepb.WorkspaceProfileSett
EnableMetricCollection: storeSetting.EnableMetricCollection,
EnableAuditLogStdout: storeSetting.EnableAuditLogStdout,
Watermark: storeSetting.Watermark,
- DirectorySyncToken: storeSetting.DirectorySyncToken,
- PasswordRestriction: convertToPasswordRestrictionSetting(storeSetting.PasswordRestriction),
- Announcement: convertToV1Announcement(storeSetting.Announcement),
- EnableDebug: storeSetting.EnableDebug,
- SqlResultSize: storeSetting.SqlResultSize,
- QueryTimeout: storeSetting.QueryTimeout,
- SqlEditorThemeId: storeSetting.SqlEditorThemeId,
- SqlEditorCustomTheme: convertToV1SQLEditorThemeSetting(storeSetting.SqlEditorCustomTheme),
- McpCapability: v1pb.WorkspaceProfileSetting_MCPCapability(storeSetting.McpCapability),
+ // The token itself is never returned: this blob is readable by every
+ // workspace member. Only whether one exists, so the UI can offer
+ // "generate" vs "regenerate".
+ DirectorySyncTokenConfigured: storeSetting.GetDirectorySyncTokenHash() != "",
+ PasswordRestriction: convertToPasswordRestrictionSetting(storeSetting.PasswordRestriction),
+ Announcement: convertToV1Announcement(storeSetting.Announcement),
+ EnableDebug: storeSetting.EnableDebug,
+ SqlResultSize: storeSetting.SqlResultSize,
+ QueryTimeout: storeSetting.QueryTimeout,
+ SqlEditorThemeId: storeSetting.SqlEditorThemeId,
+ SqlEditorCustomTheme: convertToV1SQLEditorThemeSetting(storeSetting.SqlEditorCustomTheme),
+ McpCapability: v1pb.WorkspaceProfileSetting_MCPCapability(storeSetting.McpCapability),
}
}
diff --git a/backend/api/v1/setting_service_directory_sync_test.go b/backend/api/v1/setting_service_directory_sync_test.go
new file mode 100644
index 0000000000..1396caada1
--- /dev/null
+++ b/backend/api/v1/setting_service_directory_sync_test.go
@@ -0,0 +1,82 @@
+package v1
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+ "google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/reflect/protoreflect"
+
+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
+)
+
+// The WORKSPACE_PROFILE setting is readable by every workspace member
+// (bb.settings.getWorkspaceProfile is in the default member role), so no secret
+// may ever be converted into it. The directory sync token used to be, which is
+// how it leaked to every member.
+func TestWorkspaceProfileNeverExposesDirectorySyncToken(t *testing.T) {
+ const tokenHash = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
+
+ got := convertToWorkspaceProfileSetting(&storepb.WorkspaceProfileSetting{
+ DirectorySyncTokenHash: tokenHash,
+ })
+
+ // The hash must not appear anywhere in the serialized message, whatever
+ // field a future change might place it in.
+ raw, err := proto.Marshal(got)
+ require.NoError(t, err)
+ require.NotContains(t, string(raw), tokenHash, "token hash leaked into WorkspaceProfileSetting")
+}
+
+func TestWorkspaceProfileReportsTokenConfigured(t *testing.T) {
+ for _, tt := range []struct {
+ name string
+ store *storepb.WorkspaceProfileSetting
+ want bool
+ }{
+ {"hashed", &storepb.WorkspaceProfileSetting{DirectorySyncTokenHash: "abc123"}, true},
+ {"absent", &storepb.WorkspaceProfileSetting{}, false},
+ } {
+ t.Run(tt.name, func(t *testing.T) {
+ require.Equal(t, tt.want, convertToWorkspaceProfileSetting(tt.store).GetDirectorySyncTokenConfigured())
+ })
+ }
+}
+
+// The rotate RPC is audited, and the audit log records the response. The
+// plaintext token exists only in that one response, so it must be stripped
+// before it is written — otherwise anyone with audit-log read access gets a
+// working SCIM credential.
+func TestRotateDirectorySyncTokenResponseIsRedactedForAudit(t *testing.T) {
+ const token = "b17c0d9e-2222-4000-8000-fedcbafedcba"
+
+ got, err := getResponseString(&v1pb.RotateDirectorySyncTokenResponse{Token: token})
+ require.NoError(t, err)
+ require.NotContains(t, got, token, "minted SCIM token written to the audit log")
+}
+
+// Guard against the next secret being dropped into this member-readable blob.
+// If this fails, either redact the new field or move it out of WORKSPACE_PROFILE.
+func TestWorkspaceProfileHasNoSecretShapedFields(t *testing.T) {
+ // Only string/bytes fields can carry a credential. Booleans like
+ // disallow_password_signin and durations like refresh_token_duration name a
+ // policy, not a secret, so restricting by kind keeps this guard free of an
+ // allowlist that would rot.
+ secretish := []string{"token", "secret", "password", "key"}
+
+ fields := (&v1pb.WorkspaceProfileSetting{}).ProtoReflect().Descriptor().Fields()
+ for i := range fields.Len() {
+ field := fields.Get(i)
+ if field.Kind() != protoreflect.StringKind && field.Kind() != protoreflect.BytesKind {
+ continue
+ }
+ name := string(field.Name())
+ for _, needle := range secretish {
+ require.NotContains(t, name, needle,
+ "field %q looks like a secret but lives in WorkspaceProfileSetting, which every workspace member can read", name)
+ }
+ }
+ // Keep the guard honest: it must still be looking at a populated message.
+ require.NotNil(t, fields.ByName(protoreflect.Name("directory_sync_token_configured")))
+}
diff --git a/backend/api/v1/workspace_service.go b/backend/api/v1/workspace_service.go
index 2ad9a8ff64..71ea1b5dde 100644
--- a/backend/api/v1/workspace_service.go
+++ b/backend/api/v1/workspace_service.go
@@ -8,8 +8,10 @@ import (
"strings"
"connectrpc.com/connect"
+ "github.com/google/uuid"
"github.com/pkg/errors"
"google.golang.org/protobuf/encoding/protojson"
+ "google.golang.org/protobuf/proto"
"github.com/bytebase/bytebase/backend/api/auth"
"github.com/bytebase/bytebase/backend/common"
@@ -191,6 +193,38 @@ func (s *WorkspaceService) UpdateWorkspace(ctx context.Context, req *connect.Req
}), nil
}
+// RotateDirectorySyncToken mints a new SCIM token and returns it once. Only the
+// hash is persisted, so the plaintext cannot be recovered afterwards.
+//
+// The request's name is resolved and matched against the caller's workspace by
+// the ACL interceptor, so the workspace is taken from context here.
+func (s *WorkspaceService) RotateDirectorySyncToken(ctx context.Context, _ *connect.Request[v1pb.RotateDirectorySyncTokenRequest]) (*connect.Response[v1pb.RotateDirectorySyncTokenResponse], error) {
+ workspaceID := common.GetWorkspaceIDFromContext(ctx)
+
+ setting, err := s.store.GetWorkspaceProfileSetting(ctx, workspaceID)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get workspace profile setting"))
+ }
+
+ token := uuid.New().String()
+
+ updated, ok := proto.Clone(setting).(*storepb.WorkspaceProfileSetting)
+ if !ok {
+ return nil, connect.NewError(connect.CodeInternal, errors.New("failed to clone workspace profile setting"))
+ }
+ updated.DirectorySyncTokenHash = common.HashDirectorySyncToken(token)
+
+ if _, err := s.store.UpsertSetting(ctx, &store.SettingMessage{
+ Name: storepb.SettingName_WORKSPACE_PROFILE,
+ Workspace: workspaceID,
+ Value: updated,
+ }); err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to store directory sync token"))
+ }
+
+ return connect.NewResponse(&v1pb.RotateDirectorySyncTokenResponse{Token: token}), nil
+}
+
func (s *WorkspaceService) GetIamPolicy(ctx context.Context, _ *connect.Request[v1pb.GetIamPolicyRequest]) (*connect.Response[v1pb.IamPolicy], error) {
policy, err := s.store.GetWorkspaceIamPolicy(ctx, common.GetWorkspaceIDFromContext(ctx))
if err != nil {
diff --git a/backend/common/directory_sync.go b/backend/common/directory_sync.go
new file mode 100644
index 0000000000..c401ec86b2
--- /dev/null
+++ b/backend/common/directory_sync.go
@@ -0,0 +1,27 @@
+package common
+
+import (
+ "crypto/sha256"
+ "encoding/hex"
+)
+
+// HashDirectorySyncToken returns the hex-encoded SHA-256 of a SCIM directory
+// sync token. Only this hash is persisted; the plaintext is shown once at
+// rotation and never stored.
+//
+// Every producer and consumer of the stored value must go through this function.
+// There are three implementations of the same hash in the tree — the rotate
+// handler, the SCIM authentication path, and the SQL in migration
+// 3.22/0003##hash_directory_sync_token.sql — and if any of them disagrees on the
+// digest or the encoding, every configured Okta/Entra integration stops
+// authenticating. Keeping the two Go call sites on one function reduces that to
+// a single SQL-versus-Go agreement, which
+// TestHashDirectorySyncTokenMigration pins.
+//
+// SHA-256 rather than a password KDF is deliberate: the token is 122 bits from
+// crypto/rand, not a human-chosen secret, so key stretching buys nothing and
+// would add latency to every SCIM request.
+func HashDirectorySyncToken(token string) string {
+ sum := sha256.Sum256([]byte(token))
+ return hex.EncodeToString(sum[:])
+}
diff --git a/backend/common/permission/permission.go b/backend/common/permission/permission.go
index 4c7b5812a9..4009676e5b 100644
--- a/backend/common/permission/permission.go
+++ b/backend/common/permission/permission.go
@@ -157,6 +157,7 @@ const (
WorkspacesSetIamPolicy Permission = "bb.workspaces.setIamPolicy"
WorkspacesUpdate Permission = "bb.workspaces.update"
WorkspacesDelete Permission = "bb.workspaces.delete"
+ WorkspacesRotateDirectorySyncToken Permission = "bb.workspaces.rotateDirectorySyncToken"
)
var allPermissions = func() []Permission {
diff --git a/backend/common/permission/permission.yaml b/backend/common/permission/permission.yaml
index 258c2a361f..24930136c5 100644
--- a/backend/common/permission/permission.yaml
+++ b/backend/common/permission/permission.yaml
@@ -144,3 +144,4 @@ permissions:
- bb.workspaces.getIamPolicy
- bb.workspaces.update
- bb.workspaces.setIamPolicy
+ - bb.workspaces.rotateDirectorySyncToken
diff --git a/backend/generated-go/store/setting.pb.go b/backend/generated-go/store/setting.pb.go
index d51480d987..968d9adf31 100644
--- a/backend/generated-go/store/setting.pb.go
+++ b/backend/generated-go/store/setting.pb.go
@@ -599,8 +599,6 @@ type WorkspaceProfileSetting struct {
// Whether to display watermark on pages.
// Requires ENTERPRISE license.
Watermark bool `protobuf:"varint,14,opt,name=watermark,proto3" json:"watermark,omitempty"`
- // The token for directory sync authentication.
- DirectorySyncToken string `protobuf:"bytes,15,opt,name=directory_sync_token,json=directorySyncToken,proto3" json:"directory_sync_token,omitempty"`
// Password restriction settings.
PasswordRestriction *WorkspaceProfileSetting_PasswordRestriction `protobuf:"bytes,17,opt,name=password_restriction,json=passwordRestriction,proto3" json:"password_restriction,omitempty"`
// The duration for access token. Default is 1 hour.
@@ -629,8 +627,12 @@ type WorkspaceProfileSetting struct {
// READ_WRITE for backward compatibility; DISABLED rejects all MCP
// connections. Enforced server-side by the /mcp endpoint.
McpCapability WorkspaceProfileSetting_MCPCapability `protobuf:"varint,26,opt,name=mcp_capability,json=mcpCapability,proto3,enum=bytebase.store.WorkspaceProfileSetting_MCPCapability" json:"mcp_capability,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ // Hex-encoded SHA-256 of the SCIM directory sync token. The plaintext is shown
+ // once at rotation and never stored. SHA-256 rather than a slow KDF because the
+ // token is 122 bits of crypto/rand, not a human-chosen secret.
+ DirectorySyncTokenHash string `protobuf:"bytes,27,opt,name=directory_sync_token_hash,json=directorySyncTokenHash,proto3" json:"directory_sync_token_hash,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *WorkspaceProfileSetting) Reset() {
@@ -761,13 +763,6 @@ func (x *WorkspaceProfileSetting) GetWatermark() bool {
return false
}
-func (x *WorkspaceProfileSetting) GetDirectorySyncToken() string {
- if x != nil {
- return x.DirectorySyncToken
- }
- return ""
-}
-
func (x *WorkspaceProfileSetting) GetPasswordRestriction() *WorkspaceProfileSetting_PasswordRestriction {
if x != nil {
return x.PasswordRestriction
@@ -838,6 +833,13 @@ func (x *WorkspaceProfileSetting) GetMcpCapability() WorkspaceProfileSetting_MCP
return WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED
}
+func (x *WorkspaceProfileSetting) GetDirectorySyncTokenHash() string {
+ if x != nil {
+ return x.DirectorySyncTokenHash
+ }
+ return ""
+}
+
type SQLEditorThemeSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
@@ -2884,7 +2886,7 @@ const file_store_setting_proto_rawDesc = "" +
"\n" +
"\x13store/setting.proto\x12\x0ebytebase.store\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x17google/type/color.proto\x1a\x16google/type/expr.proto\x1a\x14store/approval.proto\x1a\x12store/common.proto\"P\n" +
"\rSystemSetting\x12\x18\n" +
- "\alicense\x18\x03 \x01(\tR\alicenseJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03R\vauth_secretR\fworkspace_id\"\xc4\x13\n" +
+ "\alicense\x18\x03 \x01(\tR\alicenseJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03R\vauth_secretR\fworkspace_id\"\xcd\x13\n" +
"\x17WorkspaceProfileSetting\x12!\n" +
"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +
"\x0fdisallow_signup\x18\x02 \x01(\bR\x0edisallowSignup\x12\x1f\n" +
@@ -2901,8 +2903,7 @@ const file_store_setting_proto_rawDesc = "" +
"\x18enable_metric_collection\x18\v \x01(\bR\x16enableMetricCollection\x12S\n" +
"\x18inactive_session_timeout\x18\f \x01(\v2\x19.google.protobuf.DurationR\x16inactiveSessionTimeout\x125\n" +
"\x17enable_audit_log_stdout\x18\r \x01(\bR\x14enableAuditLogStdout\x12\x1c\n" +
- "\twatermark\x18\x0e \x01(\bR\twatermark\x120\n" +
- "\x14directory_sync_token\x18\x0f \x01(\tR\x12directorySyncToken\x12n\n" +
+ "\twatermark\x18\x0e \x01(\bR\twatermark\x12n\n" +
"\x14password_restriction\x18\x11 \x01(\v2;.bytebase.store.WorkspaceProfileSetting.PasswordRestrictionR\x13passwordRestriction\x12M\n" +
"\x15access_token_duration\x18\x12 \x01(\v2\x19.google.protobuf.DurationR\x13accessTokenDuration\x12!\n" +
"\fenable_debug\x18\x13 \x01(\bR\venableDebug\x12&\n" +
@@ -2912,7 +2913,8 @@ const file_store_setting_proto_rawDesc = "" +
"\x13sql_editor_theme_id\x18\x17 \x01(\tR\x10sqlEditorThemeId\x12\\\n" +
"\x17sql_editor_custom_theme\x18\x18 \x01(\v2%.bytebase.store.SQLEditorThemeSettingR\x14sqlEditorCustomTheme\x12Q\n" +
"\x17maximum_role_expiration\x18\x19 \x01(\v2\x19.google.protobuf.DurationR\x15maximumRoleExpiration\x12\\\n" +
- "\x0emcp_capability\x18\x1a \x01(\x0e25.bytebase.store.WorkspaceProfileSetting.MCPCapabilityR\rmcpCapability\x1a\x92\x02\n" +
+ "\x0emcp_capability\x18\x1a \x01(\x0e25.bytebase.store.WorkspaceProfileSetting.MCPCapabilityR\rmcpCapability\x129\n" +
+ "\x19directory_sync_token_hash\x18\x1b \x01(\tR\x16directorySyncTokenHash\x1a\x92\x02\n" +
"\fAnnouncement\x12\x12\n" +
"\x04text\x18\x02 \x01(\tR\x04text\x12\x12\n" +
"\x04link\x18\x03 \x01(\tR\x04link\x12\\\n" +
diff --git a/backend/generated-go/store/setting_equal.pb.go b/backend/generated-go/store/setting_equal.pb.go
index 21dd3ac77a..db2702da27 100644
--- a/backend/generated-go/store/setting_equal.pb.go
+++ b/backend/generated-go/store/setting_equal.pb.go
@@ -146,9 +146,6 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {
if x.Watermark != y.Watermark {
return false
}
- if x.DirectorySyncToken != y.DirectorySyncToken {
- return false
- }
if !x.PasswordRestriction.Equal(y.PasswordRestriction) {
return false
}
@@ -179,6 +176,9 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {
if x.McpCapability != y.McpCapability {
return false
}
+ if x.DirectorySyncTokenHash != y.DirectorySyncTokenHash {
+ return false
+ }
return true
}
diff --git a/backend/generated-go/v1/setting_service.pb.go b/backend/generated-go/v1/setting_service.pb.go
index 1ae46c7289..02874ca59f 100644
--- a/backend/generated-go/v1/setting_service.pb.go
+++ b/backend/generated-go/v1/setting_service.pb.go
@@ -1074,8 +1074,6 @@ type WorkspaceProfileSetting struct {
// Whether to display watermark on pages.
// Requires ENTERPRISE license.
Watermark bool `protobuf:"varint,14,opt,name=watermark,proto3" json:"watermark,omitempty"`
- // The token for directory sync authentication.
- DirectorySyncToken string `protobuf:"bytes,15,opt,name=directory_sync_token,json=directorySyncToken,proto3" json:"directory_sync_token,omitempty"`
// Password restriction settings.
PasswordRestriction *WorkspaceProfileSetting_PasswordRestriction `protobuf:"bytes,17,opt,name=password_restriction,json=passwordRestriction,proto3" json:"password_restriction,omitempty"`
// The duration for access token. Default is 1 hour.
@@ -1105,8 +1103,12 @@ type WorkspaceProfileSetting struct {
// connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —
// omit the update mask path to leave the ceiling unset.
McpCapability WorkspaceProfileSetting_MCPCapability `protobuf:"varint,26,opt,name=mcp_capability,json=mcpCapability,proto3,enum=bytebase.v1.WorkspaceProfileSetting_MCPCapability" json:"mcp_capability,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ // Whether a directory sync token has been generated for this workspace.
+ // The token itself is never returned; this only lets the UI decide between
+ // offering "generate" and "regenerate".
+ DirectorySyncTokenConfigured bool `protobuf:"varint,27,opt,name=directory_sync_token_configured,json=directorySyncTokenConfigured,proto3" json:"directory_sync_token_configured,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *WorkspaceProfileSetting) Reset() {
@@ -1237,13 +1239,6 @@ func (x *WorkspaceProfileSetting) GetWatermark() bool {
return false
}
-func (x *WorkspaceProfileSetting) GetDirectorySyncToken() string {
- if x != nil {
- return x.DirectorySyncToken
- }
- return ""
-}
-
func (x *WorkspaceProfileSetting) GetPasswordRestriction() *WorkspaceProfileSetting_PasswordRestriction {
if x != nil {
return x.PasswordRestriction
@@ -1314,6 +1309,13 @@ func (x *WorkspaceProfileSetting) GetMcpCapability() WorkspaceProfileSetting_MCP
return WorkspaceProfileSetting_MCP_CAPABILITY_UNSPECIFIED
}
+func (x *WorkspaceProfileSetting) GetDirectorySyncTokenConfigured() bool {
+ if x != nil {
+ return x.DirectorySyncTokenConfigured
+ }
+ return false
+}
+
type SQLEditorThemeSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
@@ -3528,7 +3530,7 @@ const file_v1_setting_service_proto_rawDesc = "" +
"\x04lark\x18\x05 \x01(\v2\x1e.bytebase.v1.AppIMSetting.LarkH\x00R\x04lark\x12@\n" +
"\bdingtalk\x18\x06 \x01(\v2\".bytebase.v1.AppIMSetting.DingTalkH\x00R\bdingtalk\x127\n" +
"\x05teams\x18\a \x01(\v2\x1f.bytebase.v1.AppIMSetting.TeamsH\x00R\x05teamsB\t\n" +
- "\apayload\"\x9a\x10\n" +
+ "\apayload\"\xb4\x10\n" +
"\x17WorkspaceProfileSetting\x12!\n" +
"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +
"\x0fdisallow_signup\x18\x02 \x01(\bR\x0edisallowSignup\x12\x1f\n" +
@@ -3545,8 +3547,7 @@ const file_v1_setting_service_proto_rawDesc = "" +
"\x18enable_metric_collection\x18\v \x01(\bR\x16enableMetricCollection\x12S\n" +
"\x18inactive_session_timeout\x18\f \x01(\v2\x19.google.protobuf.DurationR\x16inactiveSessionTimeout\x125\n" +
"\x17enable_audit_log_stdout\x18\r \x01(\bR\x14enableAuditLogStdout\x12\x1c\n" +
- "\twatermark\x18\x0e \x01(\bR\twatermark\x120\n" +
- "\x14directory_sync_token\x18\x0f \x01(\tR\x12directorySyncToken\x12k\n" +
+ "\twatermark\x18\x0e \x01(\bR\twatermark\x12k\n" +
"\x14password_restriction\x18\x11 \x01(\v28.bytebase.v1.WorkspaceProfileSetting.PasswordRestrictionR\x13passwordRestriction\x12M\n" +
"\x15access_token_duration\x18\x12 \x01(\v2\x19.google.protobuf.DurationR\x13accessTokenDuration\x12!\n" +
"\fenable_debug\x18\x13 \x01(\bR\venableDebug\x12&\n" +
@@ -3556,7 +3557,8 @@ const file_v1_setting_service_proto_rawDesc = "" +
"\x13sql_editor_theme_id\x18\x17 \x01(\tR\x10sqlEditorThemeId\x12Y\n" +
"\x17sql_editor_custom_theme\x18\x18 \x01(\v2\".bytebase.v1.SQLEditorThemeSettingR\x14sqlEditorCustomTheme\x12Q\n" +
"\x17maximum_role_expiration\x18\x19 \x01(\v2\x19.google.protobuf.DurationR\x15maximumRoleExpiration\x12Y\n" +
- "\x0emcp_capability\x18\x1a \x01(\x0e22.bytebase.v1.WorkspaceProfileSetting.MCPCapabilityR\rmcpCapability\x1a\x93\x03\n" +
+ "\x0emcp_capability\x18\x1a \x01(\x0e22.bytebase.v1.WorkspaceProfileSetting.MCPCapabilityR\rmcpCapability\x12J\n" +
+ "\x1fdirectory_sync_token_configured\x18\x1b \x01(\bB\x03\xe0A\x03R\x1cdirectorySyncTokenConfigured\x1a\x93\x03\n" +
"\x13PasswordRestriction\x12\x1d\n" +
"\n" +
"min_length\x18\x01 \x01(\x05R\tminLength\x12%\n" +
diff --git a/backend/generated-go/v1/setting_service_equal.pb.go b/backend/generated-go/v1/setting_service_equal.pb.go
index f0fcd9168d..a96ec6e0de 100644
--- a/backend/generated-go/v1/setting_service_equal.pb.go
+++ b/backend/generated-go/v1/setting_service_equal.pb.go
@@ -376,9 +376,6 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {
if x.Watermark != y.Watermark {
return false
}
- if x.DirectorySyncToken != y.DirectorySyncToken {
- return false
- }
if !x.PasswordRestriction.Equal(y.PasswordRestriction) {
return false
}
@@ -409,6 +406,9 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {
if x.McpCapability != y.McpCapability {
return false
}
+ if x.DirectorySyncTokenConfigured != y.DirectorySyncTokenConfigured {
+ return false
+ }
return true
}
diff --git a/backend/generated-go/v1/v1connect/workspace_service.connect.go b/backend/generated-go/v1/v1connect/workspace_service.connect.go
index 69c5aeb47a..ad4cf7e22d 100644
--- a/backend/generated-go/v1/v1connect/workspace_service.connect.go
+++ b/backend/generated-go/v1/v1connect/workspace_service.connect.go
@@ -54,6 +54,9 @@ const (
// WorkspaceServiceSetIamPolicyProcedure is the fully-qualified name of the WorkspaceService's
// SetIamPolicy RPC.
WorkspaceServiceSetIamPolicyProcedure = "/bytebase.v1.WorkspaceService/SetIamPolicy"
+ // WorkspaceServiceRotateDirectorySyncTokenProcedure is the fully-qualified name of the
+ // WorkspaceService's RotateDirectorySyncToken RPC.
+ WorkspaceServiceRotateDirectorySyncTokenProcedure = "/bytebase.v1.WorkspaceService/RotateDirectorySyncToken"
)
// WorkspaceServiceClient is a client for the bytebase.v1.WorkspaceService service.
@@ -82,6 +85,12 @@ type WorkspaceServiceClient interface {
// Sets IAM policy for the workspace.
// Permissions required: bb.workspaces.setIamPolicy
SetIamPolicy(context.Context, *connect.Request[v1.SetIamPolicyRequest]) (*connect.Response[v1.IamPolicy], error)
+ // Mints a new directory sync (SCIM) token, immediately invalidating the
+ // previous one. The plaintext token is returned exactly once and cannot be
+ // retrieved afterwards; only its hash is stored. Callers that lose it must
+ // rotate again and update their identity provider.
+ // Permissions required: bb.workspaces.rotateDirectorySyncToken
+ RotateDirectorySyncToken(context.Context, *connect.Request[v1.RotateDirectorySyncTokenRequest]) (*connect.Response[v1.RotateDirectorySyncTokenResponse], error)
}
// NewWorkspaceServiceClient constructs a client for the bytebase.v1.WorkspaceService service. By
@@ -137,18 +146,25 @@ func NewWorkspaceServiceClient(httpClient connect.HTTPClient, baseURL string, op
connect.WithSchema(workspaceServiceMethods.ByName("SetIamPolicy")),
connect.WithClientOptions(opts...),
),
+ rotateDirectorySyncToken: connect.NewClient[v1.RotateDirectorySyncTokenRequest, v1.RotateDirectorySyncTokenResponse](
+ httpClient,
+ baseURL+WorkspaceServiceRotateDirectorySyncTokenProcedure,
+ connect.WithSchema(workspaceServiceMethods.ByName("RotateDirectorySyncToken")),
+ connect.WithClientOptions(opts...),
+ ),
}
}
// workspaceServiceClient implements WorkspaceServiceClient.
type workspaceServiceClient struct {
- getWorkspace *connect.Client[v1.GetWorkspaceRequest, v1.Workspace]
- listWorkspaces *connect.Client[v1.ListWorkspacesRequest, v1.ListWorkspacesResponse]
- updateWorkspace *connect.Client[v1.UpdateWorkspaceRequest, v1.Workspace]
- getIamPolicy *connect.Client[v1.GetIamPolicyRequest, v1.IamPolicy]
- deleteWorkspace *connect.Client[v1.DeleteWorkspaceRequest, v1.LoginResponse]
- leaveWorkspace *connect.Client[v1.LeaveWorkspaceRequest, v1.LoginResponse]
- setIamPolicy *connect.Client[v1.SetIamPolicyRequest, v1.IamPolicy]
+ getWorkspace *connect.Client[v1.GetWorkspaceRequest, v1.Workspace]
+ listWorkspaces *connect.Client[v1.ListWorkspacesRequest, v1.ListWorkspacesResponse]
+ updateWorkspace *connect.Client[v1.UpdateWorkspaceRequest, v1.Workspace]
+ getIamPolicy *connect.Client[v1.GetIamPolicyRequest, v1.IamPolicy]
+ deleteWorkspace *connect.Client[v1.DeleteWorkspaceRequest, v1.LoginResponse]
+ leaveWorkspace *connect.Client[v1.LeaveWorkspaceRequest, v1.LoginResponse]
+ setIamPolicy *connect.Client[v1.SetIamPolicyRequest, v1.IamPolicy]
+ rotateDirectorySyncToken *connect.Client[v1.RotateDirectorySyncTokenRequest, v1.RotateDirectorySyncTokenResponse]
}
// GetWorkspace calls bytebase.v1.WorkspaceService.GetWorkspace.
@@ -186,6 +202,11 @@ func (c *workspaceServiceClient) SetIamPolicy(ctx context.Context, req *connect.
return c.setIamPolicy.CallUnary(ctx, req)
}
+// RotateDirectorySyncToken calls bytebase.v1.WorkspaceService.RotateDirectorySyncToken.
+func (c *workspaceServiceClient) RotateDirectorySyncToken(ctx context.Context, req *connect.Request[v1.RotateDirectorySyncTokenRequest]) (*connect.Response[v1.RotateDirectorySyncTokenResponse], error) {
+ return c.rotateDirectorySyncToken.CallUnary(ctx, req)
+}
+
// WorkspaceServiceHandler is an implementation of the bytebase.v1.WorkspaceService service.
type WorkspaceServiceHandler interface {
// Gets a workspace by name.
@@ -212,6 +233,12 @@ type WorkspaceServiceHandler interface {
// Sets IAM policy for the workspace.
// Permissions required: bb.workspaces.setIamPolicy
SetIamPolicy(context.Context, *connect.Request[v1.SetIamPolicyRequest]) (*connect.Response[v1.IamPolicy], error)
+ // Mints a new directory sync (SCIM) token, immediately invalidating the
+ // previous one. The plaintext token is returned exactly once and cannot be
+ // retrieved afterwards; only its hash is stored. Callers that lose it must
+ // rotate again and update their identity provider.
+ // Permissions required: bb.workspaces.rotateDirectorySyncToken
+ RotateDirectorySyncToken(context.Context, *connect.Request[v1.RotateDirectorySyncTokenRequest]) (*connect.Response[v1.RotateDirectorySyncTokenResponse], error)
}
// NewWorkspaceServiceHandler builds an HTTP handler from the service implementation. It returns the
@@ -263,6 +290,12 @@ func NewWorkspaceServiceHandler(svc WorkspaceServiceHandler, opts ...connect.Han
connect.WithSchema(workspaceServiceMethods.ByName("SetIamPolicy")),
connect.WithHandlerOptions(opts...),
)
+ workspaceServiceRotateDirectorySyncTokenHandler := connect.NewUnaryHandler(
+ WorkspaceServiceRotateDirectorySyncTokenProcedure,
+ svc.RotateDirectorySyncToken,
+ connect.WithSchema(workspaceServiceMethods.ByName("RotateDirectorySyncToken")),
+ connect.WithHandlerOptions(opts...),
+ )
return "/bytebase.v1.WorkspaceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case WorkspaceServiceGetWorkspaceProcedure:
@@ -279,6 +312,8 @@ func NewWorkspaceServiceHandler(svc WorkspaceServiceHandler, opts ...connect.Han
workspaceServiceLeaveWorkspaceHandler.ServeHTTP(w, r)
case WorkspaceServiceSetIamPolicyProcedure:
workspaceServiceSetIamPolicyHandler.ServeHTTP(w, r)
+ case WorkspaceServiceRotateDirectorySyncTokenProcedure:
+ workspaceServiceRotateDirectorySyncTokenHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
@@ -315,3 +350,7 @@ func (UnimplementedWorkspaceServiceHandler) LeaveWorkspace(context.Context, *con
func (UnimplementedWorkspaceServiceHandler) SetIamPolicy(context.Context, *connect.Request[v1.SetIamPolicyRequest]) (*connect.Response[v1.IamPolicy], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.WorkspaceService.SetIamPolicy is not implemented"))
}
+
+func (UnimplementedWorkspaceServiceHandler) RotateDirectorySyncToken(context.Context, *connect.Request[v1.RotateDirectorySyncTokenRequest]) (*connect.Response[v1.RotateDirectorySyncTokenResponse], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.WorkspaceService.RotateDirectorySyncToken is not implemented"))
+}
diff --git a/backend/generated-go/v1/workspace_service.pb.go b/backend/generated-go/v1/workspace_service.pb.go
index ae417a80f5..585bc95bca 100644
--- a/backend/generated-go/v1/workspace_service.pb.go
+++ b/backend/generated-go/v1/workspace_service.pb.go
@@ -23,6 +23,97 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
+type RotateDirectorySyncTokenRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The workspace whose directory sync token is rotated.
+ // Format: workspaces/{workspace}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *RotateDirectorySyncTokenRequest) Reset() {
+ *x = RotateDirectorySyncTokenRequest{}
+ mi := &file_v1_workspace_service_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *RotateDirectorySyncTokenRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RotateDirectorySyncTokenRequest) ProtoMessage() {}
+
+func (x *RotateDirectorySyncTokenRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_workspace_service_proto_msgTypes[0]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RotateDirectorySyncTokenRequest.ProtoReflect.Descriptor instead.
+func (*RotateDirectorySyncTokenRequest) Descriptor() ([]byte, []int) {
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *RotateDirectorySyncTokenRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+type RotateDirectorySyncTokenResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The new token, in plaintext. This is the only time it is ever returned.
+ Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *RotateDirectorySyncTokenResponse) Reset() {
+ *x = RotateDirectorySyncTokenResponse{}
+ mi := &file_v1_workspace_service_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *RotateDirectorySyncTokenResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RotateDirectorySyncTokenResponse) ProtoMessage() {}
+
+func (x *RotateDirectorySyncTokenResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_workspace_service_proto_msgTypes[1]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RotateDirectorySyncTokenResponse.ProtoReflect.Descriptor instead.
+func (*RotateDirectorySyncTokenResponse) Descriptor() ([]byte, []int) {
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *RotateDirectorySyncTokenResponse) GetToken() string {
+ if x != nil {
+ return x.Token
+ }
+ return ""
+}
+
type ListWorkspacesRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
@@ -31,7 +122,7 @@ type ListWorkspacesRequest struct {
func (x *ListWorkspacesRequest) Reset() {
*x = ListWorkspacesRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[0]
+ mi := &file_v1_workspace_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -43,7 +134,7 @@ func (x *ListWorkspacesRequest) String() string {
func (*ListWorkspacesRequest) ProtoMessage() {}
func (x *ListWorkspacesRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[0]
+ mi := &file_v1_workspace_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -56,7 +147,7 @@ func (x *ListWorkspacesRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListWorkspacesRequest.ProtoReflect.Descriptor instead.
func (*ListWorkspacesRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{0}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{2}
}
type ListWorkspacesResponse struct {
@@ -68,7 +159,7 @@ type ListWorkspacesResponse struct {
func (x *ListWorkspacesResponse) Reset() {
*x = ListWorkspacesResponse{}
- mi := &file_v1_workspace_service_proto_msgTypes[1]
+ mi := &file_v1_workspace_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -80,7 +171,7 @@ func (x *ListWorkspacesResponse) String() string {
func (*ListWorkspacesResponse) ProtoMessage() {}
func (x *ListWorkspacesResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[1]
+ mi := &file_v1_workspace_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -93,7 +184,7 @@ func (x *ListWorkspacesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListWorkspacesResponse.ProtoReflect.Descriptor instead.
func (*ListWorkspacesResponse) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{1}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{3}
}
func (x *ListWorkspacesResponse) GetWorkspaces() []*Workspace {
@@ -114,7 +205,7 @@ type GetWorkspaceRequest struct {
func (x *GetWorkspaceRequest) Reset() {
*x = GetWorkspaceRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[2]
+ mi := &file_v1_workspace_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -126,7 +217,7 @@ func (x *GetWorkspaceRequest) String() string {
func (*GetWorkspaceRequest) ProtoMessage() {}
func (x *GetWorkspaceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[2]
+ mi := &file_v1_workspace_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -139,7 +230,7 @@ func (x *GetWorkspaceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetWorkspaceRequest.ProtoReflect.Descriptor instead.
func (*GetWorkspaceRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{2}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{4}
}
func (x *GetWorkspaceRequest) GetName() string {
@@ -162,7 +253,7 @@ type Workspace struct {
func (x *Workspace) Reset() {
*x = Workspace{}
- mi := &file_v1_workspace_service_proto_msgTypes[3]
+ mi := &file_v1_workspace_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -174,7 +265,7 @@ func (x *Workspace) String() string {
func (*Workspace) ProtoMessage() {}
func (x *Workspace) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[3]
+ mi := &file_v1_workspace_service_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -187,7 +278,7 @@ func (x *Workspace) ProtoReflect() protoreflect.Message {
// Deprecated: Use Workspace.ProtoReflect.Descriptor instead.
func (*Workspace) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{3}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{5}
}
func (x *Workspace) GetName() string {
@@ -221,7 +312,7 @@ type DeleteWorkspaceRequest struct {
func (x *DeleteWorkspaceRequest) Reset() {
*x = DeleteWorkspaceRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[4]
+ mi := &file_v1_workspace_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -233,7 +324,7 @@ func (x *DeleteWorkspaceRequest) String() string {
func (*DeleteWorkspaceRequest) ProtoMessage() {}
func (x *DeleteWorkspaceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[4]
+ mi := &file_v1_workspace_service_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -246,7 +337,7 @@ func (x *DeleteWorkspaceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteWorkspaceRequest.ProtoReflect.Descriptor instead.
func (*DeleteWorkspaceRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{4}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{6}
}
func (x *DeleteWorkspaceRequest) GetName() string {
@@ -266,7 +357,7 @@ type UpdateWorkspaceRequest struct {
func (x *UpdateWorkspaceRequest) Reset() {
*x = UpdateWorkspaceRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[5]
+ mi := &file_v1_workspace_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -278,7 +369,7 @@ func (x *UpdateWorkspaceRequest) String() string {
func (*UpdateWorkspaceRequest) ProtoMessage() {}
func (x *UpdateWorkspaceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[5]
+ mi := &file_v1_workspace_service_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -291,7 +382,7 @@ func (x *UpdateWorkspaceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateWorkspaceRequest.ProtoReflect.Descriptor instead.
func (*UpdateWorkspaceRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{5}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{7}
}
func (x *UpdateWorkspaceRequest) GetWorkspace() *Workspace {
@@ -318,7 +409,7 @@ type LeaveWorkspaceRequest struct {
func (x *LeaveWorkspaceRequest) Reset() {
*x = LeaveWorkspaceRequest{}
- mi := &file_v1_workspace_service_proto_msgTypes[6]
+ mi := &file_v1_workspace_service_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -330,7 +421,7 @@ func (x *LeaveWorkspaceRequest) String() string {
func (*LeaveWorkspaceRequest) ProtoMessage() {}
func (x *LeaveWorkspaceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_workspace_service_proto_msgTypes[6]
+ mi := &file_v1_workspace_service_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -343,7 +434,7 @@ func (x *LeaveWorkspaceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use LeaveWorkspaceRequest.ProtoReflect.Descriptor instead.
func (*LeaveWorkspaceRequest) Descriptor() ([]byte, []int) {
- return file_v1_workspace_service_proto_rawDescGZIP(), []int{6}
+ return file_v1_workspace_service_proto_rawDescGZIP(), []int{8}
}
func (x *LeaveWorkspaceRequest) GetName() string {
@@ -357,7 +448,12 @@ var File_v1_workspace_service_proto protoreflect.FileDescriptor
const file_v1_workspace_service_proto_rawDesc = "" +
"\n" +
- "\x1av1/workspace_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a google/protobuf/field_mask.proto\x1a\x13v1/annotation.proto\x1a\x15v1/auth_service.proto\x1a\x13v1/iam_policy.proto\"\x17\n" +
+ "\x1av1/workspace_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a google/protobuf/field_mask.proto\x1a\x13v1/annotation.proto\x1a\x15v1/auth_service.proto\x1a\x13v1/iam_policy.proto\"U\n" +
+ "\x1fRotateDirectorySyncTokenRequest\x122\n" +
+ "\x04name\x18\x01 \x01(\tB\x1e\xe0A\x02\xfaA\x18\n" +
+ "\x16bytebase.com/WorkspaceR\x04name\"=\n" +
+ " RotateDirectorySyncTokenResponse\x12\x19\n" +
+ "\x05token\x18\x01 \x01(\tB\x03\xe0A\x03R\x05token\"\x17\n" +
"\x15ListWorkspacesRequest\"P\n" +
"\x16ListWorkspacesResponse\x126\n" +
"\n" +
@@ -376,7 +472,7 @@ const file_v1_workspace_service_proto_rawDesc = "" +
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" +
"updateMask\"0\n" +
"\x15LeaveWorkspaceRequest\x12\x17\n" +
- "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name2\xf7\a\n" +
+ "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name2\xe7\t\n" +
"\x10WorkspaceService\x12m\n" +
"\fGetWorkspace\x12 .bytebase.v1.GetWorkspaceRequest\x1a\x16.bytebase.v1.Workspace\"#\x80\xea0\x01\x82\xd3\xe4\x93\x02\x19\x12\x17/v1/{name=workspaces/*}\x12u\n" +
"\x0eListWorkspaces\x12\".bytebase.v1.ListWorkspacesRequest\x1a#.bytebase.v1.ListWorkspacesResponse\"\x1a\x90\xea0\x02\x82\xd3\xe4\x93\x02\x10\x12\x0e/v1/workspaces\x12\x9c\x01\n" +
@@ -384,7 +480,8 @@ const file_v1_workspace_service_proto_rawDesc = "" +
"\fGetIamPolicy\x12 .bytebase.v1.GetIamPolicyRequest\x1a\x16.bytebase.v1.IamPolicy\"R\x8a\xea0\x1abb.workspaces.getIamPolicy\x90\xea0\x01\x82\xd3\xe4\x93\x02*\x12(/v1/{resource=workspaces/*}:getIamPolicy\x12\x93\x01\n" +
"\x0fDeleteWorkspace\x12#.bytebase.v1.DeleteWorkspaceRequest\x1a\x1a.bytebase.v1.LoginResponse\"?\x8a\xea0\x14bb.workspaces.delete\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02\x19*\x17/v1/{name=workspaces/*}\x12\x82\x01\n" +
"\x0eLeaveWorkspace\x12\".bytebase.v1.LeaveWorkspaceRequest\x1a\x1a.bytebase.v1.LoginResponse\"0\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/v1/{name=workspaces/*}:leave\x12\xa3\x01\n" +
- "\fSetIamPolicy\x12 .bytebase.v1.SetIamPolicyRequest\x1a\x16.bytebase.v1.IamPolicy\"Y\x8a\xea0\x1abb.workspaces.setIamPolicy\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02-:\x01*\"(/v1/{resource=workspaces/*}:setIamPolicyB\xab\x01\n" +
+ "\fSetIamPolicy\x12 .bytebase.v1.SetIamPolicyRequest\x1a\x16.bytebase.v1.IamPolicy\"Y\x8a\xea0\x1abb.workspaces.setIamPolicy\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x02-:\x01*\"(/v1/{resource=workspaces/*}:setIamPolicy\x12\xed\x01\n" +
+ "\x18RotateDirectorySyncToken\x12,.bytebase.v1.RotateDirectorySyncTokenRequest\x1a-.bytebase.v1.RotateDirectorySyncTokenResponse\"t\xdaA\x04name\x8a\xea0&bb.workspaces.rotateDirectorySyncToken\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x025:\x01*\"0/v1/{name=workspaces/*}:rotateDirectorySyncTokenB\xab\x01\n" +
"\x0fcom.bytebase.v1B\x15WorkspaceServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"
var (
@@ -399,41 +496,45 @@ func file_v1_workspace_service_proto_rawDescGZIP() []byte {
return file_v1_workspace_service_proto_rawDescData
}
-var file_v1_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
+var file_v1_workspace_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_v1_workspace_service_proto_goTypes = []any{
- (*ListWorkspacesRequest)(nil), // 0: bytebase.v1.ListWorkspacesRequest
- (*ListWorkspacesResponse)(nil), // 1: bytebase.v1.ListWorkspacesResponse
- (*GetWorkspaceRequest)(nil), // 2: bytebase.v1.GetWorkspaceRequest
- (*Workspace)(nil), // 3: bytebase.v1.Workspace
- (*DeleteWorkspaceRequest)(nil), // 4: bytebase.v1.DeleteWorkspaceRequest
- (*UpdateWorkspaceRequest)(nil), // 5: bytebase.v1.UpdateWorkspaceRequest
- (*LeaveWorkspaceRequest)(nil), // 6: bytebase.v1.LeaveWorkspaceRequest
- (*fieldmaskpb.FieldMask)(nil), // 7: google.protobuf.FieldMask
- (*GetIamPolicyRequest)(nil), // 8: bytebase.v1.GetIamPolicyRequest
- (*SetIamPolicyRequest)(nil), // 9: bytebase.v1.SetIamPolicyRequest
- (*IamPolicy)(nil), // 10: bytebase.v1.IamPolicy
- (*LoginResponse)(nil), // 11: bytebase.v1.LoginResponse
+ (*RotateDirectorySyncTokenRequest)(nil), // 0: bytebase.v1.RotateDirectorySyncTokenRequest
+ (*RotateDirectorySyncTokenResponse)(nil), // 1: bytebase.v1.RotateDirectorySyncTokenResponse
+ (*ListWorkspacesRequest)(nil), // 2: bytebase.v1.ListWorkspacesRequest
+ (*ListWorkspacesResponse)(nil), // 3: bytebase.v1.ListWorkspacesResponse
+ (*GetWorkspaceRequest)(nil), // 4: bytebase.v1.GetWorkspaceRequest
+ (*Workspace)(nil), // 5: bytebase.v1.Workspace
+ (*DeleteWorkspaceRequest)(nil), // 6: bytebase.v1.DeleteWorkspaceRequest
+ (*UpdateWorkspaceRequest)(nil), // 7: bytebase.v1.UpdateWorkspaceRequest
+ (*LeaveWorkspaceRequest)(nil), // 8: bytebase.v1.LeaveWorkspaceRequest
+ (*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask
+ (*GetIamPolicyRequest)(nil), // 10: bytebase.v1.GetIamPolicyRequest
+ (*SetIamPolicyRequest)(nil), // 11: bytebase.v1.SetIamPolicyRequest
+ (*IamPolicy)(nil), // 12: bytebase.v1.IamPolicy
+ (*LoginResponse)(nil), // 13: bytebase.v1.LoginResponse
}
var file_v1_workspace_service_proto_depIdxs = []int32{
- 3, // 0: bytebase.v1.ListWorkspacesResponse.workspaces:type_name -> bytebase.v1.Workspace
- 3, // 1: bytebase.v1.UpdateWorkspaceRequest.workspace:type_name -> bytebase.v1.Workspace
- 7, // 2: bytebase.v1.UpdateWorkspaceRequest.update_mask:type_name -> google.protobuf.FieldMask
- 2, // 3: bytebase.v1.WorkspaceService.GetWorkspace:input_type -> bytebase.v1.GetWorkspaceRequest
- 0, // 4: bytebase.v1.WorkspaceService.ListWorkspaces:input_type -> bytebase.v1.ListWorkspacesRequest
- 5, // 5: bytebase.v1.WorkspaceService.UpdateWorkspace:input_type -> bytebase.v1.UpdateWorkspaceRequest
- 8, // 6: bytebase.v1.WorkspaceService.GetIamPolicy:input_type -> bytebase.v1.GetIamPolicyRequest
- 4, // 7: bytebase.v1.WorkspaceService.DeleteWorkspace:input_type -> bytebase.v1.DeleteWorkspaceRequest
- 6, // 8: bytebase.v1.WorkspaceService.LeaveWorkspace:input_type -> bytebase.v1.LeaveWorkspaceRequest
- 9, // 9: bytebase.v1.WorkspaceService.SetIamPolicy:input_type -> bytebase.v1.SetIamPolicyRequest
- 3, // 10: bytebase.v1.WorkspaceService.GetWorkspace:output_type -> bytebase.v1.Workspace
- 1, // 11: bytebase.v1.WorkspaceService.ListWorkspaces:output_type -> bytebase.v1.ListWorkspacesResponse
- 3, // 12: bytebase.v1.WorkspaceService.UpdateWorkspace:output_type -> bytebase.v1.Workspace
- 10, // 13: bytebase.v1.WorkspaceService.GetIamPolicy:output_type -> bytebase.v1.IamPolicy
- 11, // 14: bytebase.v1.WorkspaceService.DeleteWorkspace:output_type -> bytebase.v1.LoginResponse
- 11, // 15: bytebase.v1.WorkspaceService.LeaveWorkspace:output_type -> bytebase.v1.LoginResponse
- 10, // 16: bytebase.v1.WorkspaceService.SetIamPolicy:output_type -> bytebase.v1.IamPolicy
- 10, // [10:17] is the sub-list for method output_type
- 3, // [3:10] is the sub-list for method input_type
+ 5, // 0: bytebase.v1.ListWorkspacesResponse.workspaces:type_name -> bytebase.v1.Workspace
+ 5, // 1: bytebase.v1.UpdateWorkspaceRequest.workspace:type_name -> bytebase.v1.Workspace
+ 9, // 2: bytebase.v1.UpdateWorkspaceRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 4, // 3: bytebase.v1.WorkspaceService.GetWorkspace:input_type -> bytebase.v1.GetWorkspaceRequest
+ 2, // 4: bytebase.v1.WorkspaceService.ListWorkspaces:input_type -> bytebase.v1.ListWorkspacesRequest
+ 7, // 5: bytebase.v1.WorkspaceService.UpdateWorkspace:input_type -> bytebase.v1.UpdateWorkspaceRequest
+ 10, // 6: bytebase.v1.WorkspaceService.GetIamPolicy:input_type -> bytebase.v1.GetIamPolicyRequest
+ 6, // 7: bytebase.v1.WorkspaceService.DeleteWorkspace:input_type -> bytebase.v1.DeleteWorkspaceRequest
+ 8, // 8: bytebase.v1.WorkspaceService.LeaveWorkspace:input_type -> bytebase.v1.LeaveWorkspaceRequest
+ 11, // 9: bytebase.v1.WorkspaceService.SetIamPolicy:input_type -> bytebase.v1.SetIamPolicyRequest
+ 0, // 10: bytebase.v1.WorkspaceService.RotateDirectorySyncToken:input_type -> bytebase.v1.RotateDirectorySyncTokenRequest
+ 5, // 11: bytebase.v1.WorkspaceService.GetWorkspace:output_type -> bytebase.v1.Workspace
+ 3, // 12: bytebase.v1.WorkspaceService.ListWorkspaces:output_type -> bytebase.v1.ListWorkspacesResponse
+ 5, // 13: bytebase.v1.WorkspaceService.UpdateWorkspace:output_type -> bytebase.v1.Workspace
+ 12, // 14: bytebase.v1.WorkspaceService.GetIamPolicy:output_type -> bytebase.v1.IamPolicy
+ 13, // 15: bytebase.v1.WorkspaceService.DeleteWorkspace:output_type -> bytebase.v1.LoginResponse
+ 13, // 16: bytebase.v1.WorkspaceService.LeaveWorkspace:output_type -> bytebase.v1.LoginResponse
+ 12, // 17: bytebase.v1.WorkspaceService.SetIamPolicy:output_type -> bytebase.v1.IamPolicy
+ 1, // 18: bytebase.v1.WorkspaceService.RotateDirectorySyncToken:output_type -> bytebase.v1.RotateDirectorySyncTokenResponse
+ 11, // [11:19] is the sub-list for method output_type
+ 3, // [3:11] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
@@ -453,7 +554,7 @@ func file_v1_workspace_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_workspace_service_proto_rawDesc), len(file_v1_workspace_service_proto_rawDesc)),
NumEnums: 0,
- NumMessages: 7,
+ NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/backend/generated-go/v1/workspace_service.pb.gw.go b/backend/generated-go/v1/workspace_service.pb.gw.go
index 6855d16158..c5137d4bed 100644
--- a/backend/generated-go/v1/workspace_service.pb.gw.go
+++ b/backend/generated-go/v1/workspace_service.pb.gw.go
@@ -308,6 +308,51 @@ func local_request_WorkspaceService_SetIamPolicy_0(ctx context.Context, marshale
return msg, metadata, err
}
+func request_WorkspaceService_RotateDirectorySyncToken_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq RotateDirectorySyncTokenRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ val, ok := pathParams["name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
+ }
+ protoReq.Name, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
+ }
+ msg, err := client.RotateDirectorySyncToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_WorkspaceService_RotateDirectorySyncToken_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq RotateDirectorySyncTokenRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ val, ok := pathParams["name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
+ }
+ protoReq.Name, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
+ }
+ msg, err := server.RotateDirectorySyncToken(ctx, &protoReq)
+ return msg, metadata, err
+}
+
// RegisterWorkspaceServiceHandlerServer registers the http handlers for service WorkspaceService to "mux".
// UnaryRPC :call WorkspaceServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -454,6 +499,26 @@ func RegisterWorkspaceServiceHandlerServer(ctx context.Context, mux *runtime.Ser
}
forward_WorkspaceService_SetIamPolicy_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodPost, pattern_WorkspaceService_RotateDirectorySyncToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorkspaceService/RotateDirectorySyncToken", runtime.WithHTTPPathPattern("/v1/{name=workspaces/*}:rotateDirectorySyncToken"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_WorkspaceService_RotateDirectorySyncToken_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_WorkspaceService_RotateDirectorySyncToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
return nil
}
@@ -613,25 +678,44 @@ func RegisterWorkspaceServiceHandlerClient(ctx context.Context, mux *runtime.Ser
}
forward_WorkspaceService_SetIamPolicy_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodPost, pattern_WorkspaceService_RotateDirectorySyncToken_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorkspaceService/RotateDirectorySyncToken", runtime.WithHTTPPathPattern("/v1/{name=workspaces/*}:rotateDirectorySyncToken"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_WorkspaceService_RotateDirectorySyncToken_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_WorkspaceService_RotateDirectorySyncToken_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
return nil
}
var (
- pattern_WorkspaceService_GetWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "name"}, ""))
- pattern_WorkspaceService_ListWorkspaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "workspaces"}, ""))
- pattern_WorkspaceService_UpdateWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "workspace.name"}, ""))
- pattern_WorkspaceService_GetIamPolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "resource"}, "getIamPolicy"))
- pattern_WorkspaceService_DeleteWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "name"}, ""))
- pattern_WorkspaceService_LeaveWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "name"}, "leave"))
- pattern_WorkspaceService_SetIamPolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "resource"}, "setIamPolicy"))
+ pattern_WorkspaceService_GetWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "name"}, ""))
+ pattern_WorkspaceService_ListWorkspaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "workspaces"}, ""))
+ pattern_WorkspaceService_UpdateWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "workspace.name"}, ""))
+ pattern_WorkspaceService_GetIamPolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "resource"}, "getIamPolicy"))
+ pattern_WorkspaceService_DeleteWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "name"}, ""))
+ pattern_WorkspaceService_LeaveWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "name"}, "leave"))
+ pattern_WorkspaceService_SetIamPolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "resource"}, "setIamPolicy"))
+ pattern_WorkspaceService_RotateDirectorySyncToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workspaces", "name"}, "rotateDirectorySyncToken"))
)
var (
- forward_WorkspaceService_GetWorkspace_0 = runtime.ForwardResponseMessage
- forward_WorkspaceService_ListWorkspaces_0 = runtime.ForwardResponseMessage
- forward_WorkspaceService_UpdateWorkspace_0 = runtime.ForwardResponseMessage
- forward_WorkspaceService_GetIamPolicy_0 = runtime.ForwardResponseMessage
- forward_WorkspaceService_DeleteWorkspace_0 = runtime.ForwardResponseMessage
- forward_WorkspaceService_LeaveWorkspace_0 = runtime.ForwardResponseMessage
- forward_WorkspaceService_SetIamPolicy_0 = runtime.ForwardResponseMessage
+ forward_WorkspaceService_GetWorkspace_0 = runtime.ForwardResponseMessage
+ forward_WorkspaceService_ListWorkspaces_0 = runtime.ForwardResponseMessage
+ forward_WorkspaceService_UpdateWorkspace_0 = runtime.ForwardResponseMessage
+ forward_WorkspaceService_GetIamPolicy_0 = runtime.ForwardResponseMessage
+ forward_WorkspaceService_DeleteWorkspace_0 = runtime.ForwardResponseMessage
+ forward_WorkspaceService_LeaveWorkspace_0 = runtime.ForwardResponseMessage
+ forward_WorkspaceService_SetIamPolicy_0 = runtime.ForwardResponseMessage
+ forward_WorkspaceService_RotateDirectorySyncToken_0 = runtime.ForwardResponseMessage
)
diff --git a/backend/generated-go/v1/workspace_service_equal.pb.go b/backend/generated-go/v1/workspace_service_equal.pb.go
index 247ad2ec5c..331ff3293e 100644
--- a/backend/generated-go/v1/workspace_service_equal.pb.go
+++ b/backend/generated-go/v1/workspace_service_equal.pb.go
@@ -8,6 +8,32 @@ import (
fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
)
+func (x *RotateDirectorySyncTokenRequest) Equal(y *RotateDirectorySyncTokenRequest) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if x.Name != y.Name {
+ return false
+ }
+ return true
+}
+
+func (x *RotateDirectorySyncTokenResponse) Equal(y *RotateDirectorySyncTokenResponse) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if x.Token != y.Token {
+ return false
+ }
+ return true
+}
+
func (x *ListWorkspacesRequest) Equal(y *ListWorkspacesRequest) bool {
if x == y {
return true
diff --git a/backend/generated-go/v1/workspace_service_grpc.pb.go b/backend/generated-go/v1/workspace_service_grpc.pb.go
index bd8aa6c719..ea339d6178 100644
--- a/backend/generated-go/v1/workspace_service_grpc.pb.go
+++ b/backend/generated-go/v1/workspace_service_grpc.pb.go
@@ -19,13 +19,14 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
- WorkspaceService_GetWorkspace_FullMethodName = "/bytebase.v1.WorkspaceService/GetWorkspace"
- WorkspaceService_ListWorkspaces_FullMethodName = "/bytebase.v1.WorkspaceService/ListWorkspaces"
- WorkspaceService_UpdateWorkspace_FullMethodName = "/bytebase.v1.WorkspaceService/UpdateWorkspace"
- WorkspaceService_GetIamPolicy_FullMethodName = "/bytebase.v1.WorkspaceService/GetIamPolicy"
- WorkspaceService_DeleteWorkspace_FullMethodName = "/bytebase.v1.WorkspaceService/DeleteWorkspace"
- WorkspaceService_LeaveWorkspace_FullMethodName = "/bytebase.v1.WorkspaceService/LeaveWorkspace"
- WorkspaceService_SetIamPolicy_FullMethodName = "/bytebase.v1.WorkspaceService/SetIamPolicy"
+ WorkspaceService_GetWorkspace_FullMethodName = "/bytebase.v1.WorkspaceService/GetWorkspace"
+ WorkspaceService_ListWorkspaces_FullMethodName = "/bytebase.v1.WorkspaceService/ListWorkspaces"
+ WorkspaceService_UpdateWorkspace_FullMethodName = "/bytebase.v1.WorkspaceService/UpdateWorkspace"
+ WorkspaceService_GetIamPolicy_FullMethodName = "/bytebase.v1.WorkspaceService/GetIamPolicy"
+ WorkspaceService_DeleteWorkspace_FullMethodName = "/bytebase.v1.WorkspaceService/DeleteWorkspace"
+ WorkspaceService_LeaveWorkspace_FullMethodName = "/bytebase.v1.WorkspaceService/LeaveWorkspace"
+ WorkspaceService_SetIamPolicy_FullMethodName = "/bytebase.v1.WorkspaceService/SetIamPolicy"
+ WorkspaceService_RotateDirectorySyncToken_FullMethodName = "/bytebase.v1.WorkspaceService/RotateDirectorySyncToken"
)
// WorkspaceServiceClient is the client API for WorkspaceService service.
@@ -58,6 +59,12 @@ type WorkspaceServiceClient interface {
// Sets IAM policy for the workspace.
// Permissions required: bb.workspaces.setIamPolicy
SetIamPolicy(ctx context.Context, in *SetIamPolicyRequest, opts ...grpc.CallOption) (*IamPolicy, error)
+ // Mints a new directory sync (SCIM) token, immediately invalidating the
+ // previous one. The plaintext token is returned exactly once and cannot be
+ // retrieved afterwards; only its hash is stored. Callers that lose it must
+ // rotate again and update their identity provider.
+ // Permissions required: bb.workspaces.rotateDirectorySyncToken
+ RotateDirectorySyncToken(ctx context.Context, in *RotateDirectorySyncTokenRequest, opts ...grpc.CallOption) (*RotateDirectorySyncTokenResponse, error)
}
type workspaceServiceClient struct {
@@ -138,6 +145,16 @@ func (c *workspaceServiceClient) SetIamPolicy(ctx context.Context, in *SetIamPol
return out, nil
}
+func (c *workspaceServiceClient) RotateDirectorySyncToken(ctx context.Context, in *RotateDirectorySyncTokenRequest, opts ...grpc.CallOption) (*RotateDirectorySyncTokenResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(RotateDirectorySyncTokenResponse)
+ err := c.cc.Invoke(ctx, WorkspaceService_RotateDirectorySyncToken_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// WorkspaceServiceServer is the server API for WorkspaceService service.
// All implementations must embed UnimplementedWorkspaceServiceServer
// for forward compatibility.
@@ -168,6 +185,12 @@ type WorkspaceServiceServer interface {
// Sets IAM policy for the workspace.
// Permissions required: bb.workspaces.setIamPolicy
SetIamPolicy(context.Context, *SetIamPolicyRequest) (*IamPolicy, error)
+ // Mints a new directory sync (SCIM) token, immediately invalidating the
+ // previous one. The plaintext token is returned exactly once and cannot be
+ // retrieved afterwards; only its hash is stored. Callers that lose it must
+ // rotate again and update their identity provider.
+ // Permissions required: bb.workspaces.rotateDirectorySyncToken
+ RotateDirectorySyncToken(context.Context, *RotateDirectorySyncTokenRequest) (*RotateDirectorySyncTokenResponse, error)
mustEmbedUnimplementedWorkspaceServiceServer()
}
@@ -199,6 +222,9 @@ func (UnimplementedWorkspaceServiceServer) LeaveWorkspace(context.Context, *Leav
func (UnimplementedWorkspaceServiceServer) SetIamPolicy(context.Context, *SetIamPolicyRequest) (*IamPolicy, error) {
return nil, status.Error(codes.Unimplemented, "method SetIamPolicy not implemented")
}
+func (UnimplementedWorkspaceServiceServer) RotateDirectorySyncToken(context.Context, *RotateDirectorySyncTokenRequest) (*RotateDirectorySyncTokenResponse, error) {
+ return nil, status.Error(codes.Unimplemented, "method RotateDirectorySyncToken not implemented")
+}
func (UnimplementedWorkspaceServiceServer) mustEmbedUnimplementedWorkspaceServiceServer() {}
func (UnimplementedWorkspaceServiceServer) testEmbeddedByValue() {}
@@ -346,6 +372,24 @@ func _WorkspaceService_SetIamPolicy_Handler(srv interface{}, ctx context.Context
return interceptor(ctx, in, info, handler)
}
+func _WorkspaceService_RotateDirectorySyncToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(RotateDirectorySyncTokenRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(WorkspaceServiceServer).RotateDirectorySyncToken(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: WorkspaceService_RotateDirectorySyncToken_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(WorkspaceServiceServer).RotateDirectorySyncToken(ctx, req.(*RotateDirectorySyncTokenRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
// WorkspaceService_ServiceDesc is the grpc.ServiceDesc for WorkspaceService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -381,6 +425,10 @@ var WorkspaceService_ServiceDesc = grpc.ServiceDesc{
MethodName: "SetIamPolicy",
Handler: _WorkspaceService_SetIamPolicy_Handler,
},
+ {
+ MethodName: "RotateDirectorySyncToken",
+ Handler: _WorkspaceService_RotateDirectorySyncToken_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "v1/workspace_service.proto",
diff --git a/backend/migrator/migration/3.22/0003##hash_directory_sync_token.sql b/backend/migrator/migration/3.22/0003##hash_directory_sync_token.sql
new file mode 100644
index 0000000000..bb949b4a74
--- /dev/null
+++ b/backend/migrator/migration/3.22/0003##hash_directory_sync_token.sql
@@ -0,0 +1,39 @@
+-- Store the SCIM directory sync token as a SHA-256 hash instead of plaintext.
+--
+-- The token is a bearer credential that lived in plaintext inside
+-- WORKSPACE_PROFILE, a setting every workspace member can read. The API no
+-- longer returns it, and after this migration the plaintext is not retained
+-- anywhere: only its hash is, so a leaked database yields nothing presentable.
+--
+-- The token VALUE is unchanged, so every configured Okta/Entra integration keeps
+-- authenticating without the customer re-pasting anything.
+--
+-- SHA-256 rather than a slow KDF: the token is 122 bits from crypto/rand, not a
+-- human-chosen secret, so key stretching buys nothing and would cost latency on
+-- every SCIM request. sha256() is built into PostgreSQL 11+; no pgcrypto needed.
+--
+-- JSONB keys are protojson camelCase, hence directorySyncToken / *Hash.
+
+-- 1. Hash any real token that does not already have one. Reads the plaintext
+-- before step 2 removes it.
+UPDATE setting
+SET value = jsonb_set(
+ value,
+ '{workspaceProfile,directorySyncTokenHash}',
+ to_jsonb(
+ encode(
+ sha256(convert_to(value -> 'workspaceProfile' ->> 'directorySyncToken', 'UTF8')),
+ 'hex'
+ )
+ )
+ )
+WHERE name = 'WORKSPACE_PROFILE'
+ AND coalesce(value -> 'workspaceProfile' ->> 'directorySyncToken', '') <> ''
+ AND NOT (value -> 'workspaceProfile' ? 'directorySyncTokenHash');
+
+-- 2. Drop the plaintext wherever it still appears, including the empty-string
+-- rows step 1 skips and any row already carrying a hash.
+UPDATE setting
+SET value = value #- '{workspaceProfile,directorySyncToken}'
+WHERE name = 'WORKSPACE_PROFILE'
+ AND value -> 'workspaceProfile' ? 'directorySyncToken';
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 07e8e2a76f..09a5cb9f66 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -17,8 +17,8 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.22.2"), *files[len(files)-1].version)
- require.Equal(t, "migration/3.22/0002##add_instance_project.sql", files[len(files)-1].path)
+ require.Equal(t, semver.MustParse("3.22.3"), *files[len(files)-1].version)
+ require.Equal(t, "migration/3.22/0003##hash_directory_sync_token.sql", files[len(files)-1].path)
}
func TestVersionUnique(t *testing.T) {
diff --git a/backend/store/predefined_roles.go b/backend/store/predefined_roles.go
index 3d5037e296..665f01384d 100644
--- a/backend/store/predefined_roles.go
+++ b/backend/store/predefined_roles.go
@@ -162,6 +162,7 @@ var PredefinedRoles = []*RoleMessage{
permission.WorkspacesUpdate,
permission.WorkspacesDelete,
permission.WorkspacesSetIamPolicy,
+ permission.WorkspacesRotateDirectorySyncToken,
permission.SubscriptionManage,
permission.ServiceAccountsCreate,
permission.ServiceAccountsDelete,
diff --git a/backend/store/workspace.go b/backend/store/workspace.go
index 09d729abdf..496393c885 100644
--- a/backend/store/workspace.go
+++ b/backend/store/workspace.go
@@ -5,7 +5,6 @@ import (
"database/sql"
"fmt"
- "github.com/google/uuid"
"github.com/pkg/errors"
colorpb "google.golang.org/genproto/googleapis/type/color"
"google.golang.org/genproto/googleapis/type/expr"
@@ -131,9 +130,12 @@ func (s *Store) CreateWorkspace(ctx context.Context, create *WorkspaceMessage, a
},
},
}},
+ // No directory sync token is minted here on purpose. It is a bearer
+ // credential, and generating one for every workspace left a live secret
+ // sitting on workspaces that never enable SCIM. Admins mint one on demand
+ // via WorkspaceService.RotateDirectorySyncToken.
{storepb.SettingName_WORKSPACE_PROFILE, &storepb.WorkspaceProfileSetting{
EnableMetricCollection: true,
- DirectorySyncToken: uuid.New().String(),
DisallowSignup: false,
DisallowPasswordSignin: false,
PasswordRestriction: &storepb.WorkspaceProfileSetting_PasswordRestriction{MinLength: 8},
diff --git a/docs/design/scim-token-standard-handling.md b/docs/design/scim-token-standard-handling.md
new file mode 100644
index 0000000000..1a1ef9342f
--- /dev/null
+++ b/docs/design/scim-token-standard-handling.md
@@ -0,0 +1,188 @@
+# SCIM directory-sync token: move to the standard SaaS pattern
+
+Status: proposal · 2026-08-04 · addresses T1 of `v1-api-audit-2026-08.md`
+
+## Problem
+
+`directory_sync_token` is a bearer credential stored in plaintext inside
+`WorkspaceProfileSetting` — a blob that is deliberately readable by every workspace member
+(`bb.settings.getWorkspaceProfile` is in the default member role,
+`backend/store/predefined_roles.go:320`). The converter returns it verbatim
+(`backend/api/v1/setting_service_converter.go:348`), so it reaches every logged-in user's
+browser store via the profile fetch that all clients make for watermark and password rules.
+
+It is also minted for **every** workspace at creation (`backend/store/workspace.go:136`) whether
+or not SCIM is ever used, so every workspace carries a dormant live credential.
+
+The cryptographic mechanics are already correct — UUIDv4 from `crypto/rand` (122 bits, satisfies
+RFC 7644's entropy requirement) and `subtle.ConstantTimeCompare` at
+`backend/api/directory-sync/webhook.go:852`. What is missing is the lifecycle model.
+
+## What the standard is
+
+RFC 7644 is permissive: bearer tokens MAY be used with TLS, MUST carry sufficient entropy, and
+validation is explicitly out of scope. The convention among SaaS SCIM service providers is
+consistent:
+
+1. Admin generates the token in the app's console.
+2. Shown **exactly once**, copy-to-clipboard; not retrievable afterwards.
+3. Stored **hashed** (or encrypted); never returned by any read API.
+4. Regenerating invalidates the previous token immediately.
+5. Constant-time comparison on validation.
+6. Scoped to SCIM only.
+
+Non-expiring is common and acceptable; TTLs are best practice but silently break sync when they
+lapse. OAuth 2.0 client credentials is the direction of travel, but Okta and Entra generally
+support it only for pre-built gallery apps, not custom SCIM connections — so static bearer
+remains correct for us today.
+
+## Proposal
+
+### 1. Hash at rest
+
+Add `directory_sync_token_hash` (hex SHA-256) as **field 27** — free on both sides — to
+`WorkspaceProfileSetting` in `proto/store/store/setting.proto`. Reserve field 15 there once
+migrated. The SCIM handler hashes the presented token and compares against the stored hash,
+still with `subtle.ConstantTimeCompare`.
+
+Plain SHA-256, deliberately — not bcrypt/argon2. Slow KDFs exist to defend low-entropy
+human-chosen secrets. This is a 122-bit random token; a slow KDF buys nothing and costs latency
+on every SCIM request. Same reasoning behind GitHub PAT storage.
+
+The hash is not exposed by any API. It is not a credential, so its presence in the blob is
+harmless by construction — which is the property that makes this bug class unable to recur here.
+
+### 2. Remove the read path from the v1 API
+
+Delete `directory_sync_token` (field 15) from `proto/v1/v1/setting_service.proto`; reserve 15.
+Add `bool directory_sync_token_configured` (field 27) so the UI can render state without the
+secret.
+
+New custom method on `WorkspaceService`:
+
+```proto
+// Mints a new directory sync token, invalidating the previous one.
+// The plaintext token is returned exactly once and cannot be retrieved later.
+rpc RotateDirectorySyncToken(RotateDirectorySyncTokenRequest) returns (RotateDirectorySyncTokenResponse) {
+ option (google.api.http) = {
+ post: "/v1/{name=workspaces/*}:rotateDirectorySyncToken"
+ body: "*"
+ };
+ option (bytebase.v1.permission) = "bb.workspaces.rotateDirectorySyncToken";
+ option (bytebase.v1.auth_method) = IAM;
+ option (bytebase.v1.audit) = true;
+}
+```
+
+`WorkspaceService` rather than `SettingService`: the token is a workspace-scoped credential, not
+a setting, and moving it out of the settings blob is the point of the change.
+
+**Permission.** A dedicated `bb.workspaces.rotateDirectorySyncToken` granted to workspace admin
+only, rather than reusing `bb.settings.set`. Minting a credential that bypasses the v1 ACL
+entirely is a strictly larger capability than editing SMTP config, and the audit already found
+that conflating permissions is how this class of problem starts. Costs a role-definition change
+and a regenerated frontend permission list.
+
+### 3. Lazy generation
+
+Drop `DirectorySyncToken: uuid.New().String()` from `backend/store/workspace.go:136`. No token
+exists until an admin generates one. This eliminates the dormant-credential-on-every-workspace
+problem and closes the "scraped while on Free, used after upgrading to Enterprise" vector, which
+redaction alone does not.
+
+### 4. Migration — non-breaking for live SCIM
+
+The key property: **hash the existing plaintext in place**. The token value does not change, so
+every configured Okta/Entra integration keeps working untouched. Only readability goes away.
+Customers do not re-paste anything.
+
+`backend/migrator/migration/3.22/0003##hash_directory_sync_token.sql`:
+
+```sql
+UPDATE setting
+SET value = jsonb_set(
+ value #- '{workspaceProfile,directorySyncToken}',
+ '{workspaceProfile,directorySyncTokenHash}',
+ to_jsonb(encode(sha256(convert_to(value->'workspaceProfile'->>'directorySyncToken', 'UTF8')), 'hex'))
+ )
+WHERE name = 'WORKSPACE_PROFILE'
+ AND value->'workspaceProfile' ? 'directorySyncToken'
+ AND value->'workspaceProfile'->>'directorySyncToken' <> '';
+```
+
+JSONB keys are protojson camelCase per AGENTS.md. Postgres has native `sha256(bytea)` — no
+pgcrypto dependency. `TestLatestVersion` in `backend/migrator/migrator_test.go:20-21` must be
+updated to `3.22.3` / this path.
+
+### 5. Frontend
+
+`AADSyncSheet.tsx` becomes show-once:
+
+- No token configured → "Generate token" button → calls the rotate RPC → renders the plaintext
+ once with copy-to-clipboard and an explicit "you will not see this again" warning.
+- Token configured → masked placeholder + "Regenerate", reusing the existing confirmation
+ warning already wired to the reset flow.
+
+The sheet's entry point is already gated on an admin permission
+(`UsersPage.tsx:928`), so no new gating is needed — but note that gating was cosmetic before,
+since the data arrived regardless. After this change the gate is real.
+
+### 6. Guards against recurrence
+
+- `audit = true` on the rotate RPC.
+- Regression test: a member-role caller's `GetSetting(WORKSPACE_PROFILE)` response contains no
+ token field and no hash.
+- A test that walks `WorkspaceProfileSetting`'s fields for secret-shaped names
+ (`*token`, `*secret`, `*key`, `*password`) and fails if any is populated for a non-admin
+ caller — so the next secret added to this blob is caught at CI rather than in an audit.
+- Separately (out of scope here, tracked in the audit): SCIM mutations bypass the audit log
+ entirely, which is why we cannot tell whether this was ever exploited.
+
+## Remediation, and what this does not fix
+
+Hashing in place stops **future** disclosure. It does not invalidate tokens already scraped —
+anyone who read one still holds a valid credential.
+
+Full remediation requires rotation, which must be admin-initiated. **Do not auto-rotate on
+upgrade**: that would silently break every live Azure AD / Okta sync and convert a disclosure
+into an outage. Ship instead:
+
+- an admin banner recommending rotation, and
+- release-note guidance to rotate.
+
+Possible refinement if a reliable "SCIM never configured" signal exists: delete rather than hash
+those tokens during migration, since rotating a token no IdP holds breaks nothing. Combined with
+lazy generation this would clear the dormant credential from the large majority of workspaces
+that never use SCIM.
+
+## Rollout
+
+Backend and frontend ship together (monorepo), since removing field 15 breaks the current UI
+read. This is a **breaking** v1 API change — `breaking` label plus a `## Breaking Changes`
+section per the pre-PR checklist:
+
+- removed: `WorkspaceProfileSetting.directory_sync_token`
+- added: `WorkspaceProfileSetting.directory_sync_token_configured`,
+ `WorkspaceService.RotateDirectorySyncToken`
+
+No API client outside the web UI consumes this field (`bytebase-action` does not), so external
+impact should be nil.
+
+**Sequencing.** If this lands in the next release, ship it as one change. If it slips a cycle,
+ship the tourniquet first — redact the token in `GetSetting` for callers lacking
+`bb.settings.get`, roughly a dozen lines plus a test, safe to backport to a patch release — and
+follow with this.
+
+## Estimate
+
+| Piece | Size |
+|---|---|
+| Store + v1 proto, regenerate | S |
+| Rotate RPC + permission + role wiring | M |
+| SCIM handler hash comparison | S |
+| Migration + `TestLatestVersion` | S |
+| Lazy generation | S |
+| Frontend show-once UX | M |
+| Tests (regression + secret-shaped-field guard) | M |
+
+One focused PR, or two if the tourniquet ships separately.
diff --git a/docs/design/v1-api-audit-2026-08.md b/docs/design/v1-api-audit-2026-08.md
index 6209691632..8251fd316b 100644
--- a/docs/design/v1-api-audit-2026-08.md
+++ b/docs/design/v1-api-audit-2026-08.md
@@ -1,15 +1,3 @@
-> [!CAUTION]
-> **Tier 1–3 describe unpatched issues in shipped code. Treat the fix order below as the
-> priority order.**
->
-> Tier 1 is a credential-disclosure path and Tier 2 are cross-project data-access paths;
-> neither is fixed as of this commit. Until they ship and customers have had a window to
-> upgrade, do not amplify this outside the project — no blog posts, release-note call-outs,
-> or advisories built from it. When an advisory is eventually written, trim the
-> reproduction detail.
->
-> Rotate every `directory_sync_token` (T1) regardless of fix timing — assume disclosure.
-
# Bytebase v1 API — consolidated audit
Against `main` @ `93671b00b0` (2026-08-04). 36 proto files, 205 RPCs.
@@ -23,39 +11,10 @@ backend actually does**, which is where everything serious lives.
**Verification legend.** ✅ = I read the code myself and confirmed the full chain.
◐ = agent-traced with exact citations, structurally consistent, not runtime-proven.
-Two independent agents converged on T1 without seeing each other's work.
-
---
# TIER 1 — Credential disclosure
-### T1 ✅ CRITICAL — SCIM admin token readable by every workspace member
-
-| link | evidence |
-|---|---|
-| token auto-generated for every workspace | `backend/store/workspace.go:136` — `DirectorySyncToken: uuid.New().String()` |
-| `GetSetting(WORKSPACE_PROFILE)` gates on a member-level permission | `backend/api/v1/setting_service.go:105` → `permission.WorkspaceProfileSettingsGet` |
-| that permission is in the **default member role** | `backend/store/predefined_roles.go:320` (inside `WorkspaceMemberRole`, opens :307) |
-| converter returns it **verbatim** | `backend/api/v1/setting_service_converter.go:348` |
-| it is the sole SCIM credential | `backend/api/directory-sync/webhook.go:852` — `subtle.ConstantTimeCompare` |
-
-Every *other* secret setting is redacted in that same converter — `ApiKey: ""` (:822), SMTP
-`Password: ""` (:867). `directory_sync_token` is the one that was missed, and it sits in the one
-setting readable by everybody.
-
-SCIM exposes POST/PUT/PATCH/DELETE on `/Users` and `/Groups` (`webhook.go:109,255,281,315,441`),
-entirely outside the v1 ACL interceptor and outside the audit log. Since IAM bindings name
-`groups/{email}` members, rewriting the membership of a group bound to `roles/workspaceAdmin`
-is workspace takeover.
-
-Mitigation that limits *exploitation* but not *disclosure*: SCIM use requires
-`FEATURE_DIRECTORY_SYNC` (`webhook.go:53`). A token leaked on a lower plan stays valid after
-upgrade unless rotated. `UpdateSetting` rotates rather than clears on empty
-(`setting_service.go:895`), so the credential cannot be disabled.
-
-**Fix:** blank it in the converter like every sibling secret; expose it only through an explicit
-admin-gated reveal/rotate RPC. Treat existing tokens as compromised and rotate.
-
### T2 ✅ HIGH — Kerberos keytab returned to the lowest project role
- Returned verbatim: `backend/api/v1/instance_service_converter.go:442` (`Keytab: m.KrbConfig.Keytab`)
@@ -304,16 +263,14 @@ despite `VALIDATION_STANDARDS.md`.
# What I'd do, in order
-1. **Rotate every `directory_sync_token`** and blank it in the converter (T1). Assume disclosure.
-2. **Runtime-confirm T9.** Eleven bad logins. If the eleventh is accepted, there is no lockout and that outranks everything else here.
-3. **Redact the audit path** (T3) — `ServiceAccount` and `UpdateSettingRequest`. The `ExchangeToken` redactors are the template.
-4. **Blank the keytab** (T2), and stop returning AWS `role_arn`/`external_id`.
-5. **Close the multi-resource ACL class, not the instances** (T4–T7 + the pending `DiffSchema` patch): teach `getResourceFromRequest` to collect *every* `resource_reference`d field including oneof and repeated members, then annotate `DiffSchemaRequest.changelog`, `CheckReleaseRequest.targets`, `Revision.release/file/task_run`. `UpdateDatabase`'s project-transfer case (`acl.go:604-624`) is the in-repo precedent.
-6. **Give sheets an ownership model** (T5), or at minimum scope the blob fetch by the owning project/workspace. Until then the sheet namespace is workspace-global by design, and should be documented as such.
-7. **Fail closed**: reject `AUTH_METHOD_UNSPECIFIED` at startup; make `permission` on a CUSTOM RPC either enforced or a build error, since 20 of them are currently decorative.
-8. **Wire api-linter into CI** at the 474-finding baseline. None of Tier 5 was visible to `buf lint`'s `BASIC` profile, which is why it accumulated.
-
-**Note on scope.** Tier 1–3 are security issues in a shipped product. I have not filed anything or
-touched any of it — this is a report. The three patches from earlier in the session
-(`SearchProjects` proto comment, `SearchProjects` pagination, `DiffSchema` ACL) are still parked
-and still apply cleanly.
+1. **Runtime-confirm T9.** Eleven bad logins. If the eleventh is accepted, there is no lockout and that outranks everything else here.
+2. **Redact the audit path** (T3) — `ServiceAccount` and `UpdateSettingRequest`. The `ExchangeToken` redactors are the template.
+3. **Blank the keytab** (T2), and stop returning AWS `role_arn`/`external_id`.
+4. **Close the multi-resource ACL class, not the instances** (T4–T7 + the pending `DiffSchema` patch): teach `getResourceFromRequest` to collect *every* `resource_reference`d field including oneof and repeated members, then annotate `DiffSchemaRequest.changelog`, `CheckReleaseRequest.targets`, `Revision.release/file/task_run`. `UpdateDatabase`'s project-transfer case (`acl.go:604-624`) is the in-repo precedent.
+5. **Give sheets an ownership model** (T5), or at minimum scope the blob fetch by the owning project/workspace. Until then the sheet namespace is workspace-global by design, and should be documented as such.
+6. **Fail closed**: reject `AUTH_METHOD_UNSPECIFIED` at startup; make `permission` on a CUSTOM RPC either enforced or a build error, since 20 of them are currently decorative.
+7. **Wire api-linter into CI** at the 474-finding baseline. None of Tier 5 was visible to `buf lint`'s `BASIC` profile, which is why it accumulated.
+
+**Note on scope.** Tier 1–3 are security issues in a shipped product, and everything here is still
+a report — untouched. The three patches from earlier in the session (`SearchProjects` proto
+comment, `SearchProjects` pagination, `DiffSchema` ACL) remain parked and still apply cleanly.
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index a2ae2541a0..9dae6b5479 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -2540,11 +2540,15 @@
"description": "Sync users and groups from Entra ID (formerly Azure AD) or Okta to your Bytebase instance.",
"endpoint": "Endpoint",
"endpoint-tip": "Users and groups will be synced to Bytebase via this endpoint.",
- "reset-token": "Reset token",
- "reset-token-warning": "You need to update the application provisioning config.",
+ "generate-token": "Generate token",
+ "regenerate-token": "Regenerate token",
+ "regenerate-token-warning": "The current token stops working immediately and you will need to update the application provisioning config. Continue?",
"secret-token": "Secret Token",
"secret-token-tip": "The verification token for the endpoint. Please keep it in secret.",
- "self": "Sync from SCIM"
+ "self": "Sync from SCIM",
+ "token-configured": "A token is configured. It cannot be displayed again — regenerate if you no longer have it.",
+ "token-not-configured": "No token has been generated yet.",
+ "token-shown-once": "Copy this token now. It will not be shown again."
},
"grant-access": "Grant Access",
"groups": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index f2fdd01628..2413a130ff 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -2540,11 +2540,15 @@
"description": "Sincronice usuarios y grupos de Entra ID (anteriormente Azure AD) u Okta con su instancia de Bytebase.",
"endpoint": "Punto final",
"endpoint-tip": "Los usuarios y grupos se sincronizarán con Bytebase a través de este endpoint.",
- "reset-token": "Restablecer token",
- "reset-token-warning": "Debe actualizar la configuración de aprovisionamiento de aplicaciones de Entra.",
+ "generate-token": "Generar token",
+ "regenerate-token": "Regenerar token",
+ "regenerate-token-warning": "El token actual dejará de funcionar de inmediato y deberá actualizar la configuración de aprovisionamiento de la aplicación. ¿Continuar?",
"secret-token": "Secret Token",
"secret-token-tip": "El token de verificación para el endpoint. Por favor, manténgalo en secreto.",
- "self": "Sincronización desde SCIM"
+ "self": "Sincronización desde SCIM",
+ "token-configured": "Hay un token configurado. No se puede volver a mostrar: regenérelo si ya no dispone de él.",
+ "token-not-configured": "Todavía no se ha generado ningún token.",
+ "token-shown-once": "Copie este token ahora. No se volverá a mostrar."
},
"grant-access": "Conceder acceso",
"groups": {
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 6a170f65ba..2203c6857a 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -2540,11 +2540,15 @@
"description": "Entra ID (旧 Azure AD) または Okta のユーザーとグループを Bytebase インスタンスに同期します。",
"endpoint": "エンドポイント",
"endpoint-tip": "ユーザーとグループはこのエンドポイントを介して Bytebase に同期されます。",
- "reset-token": "トークンをリセット",
- "reset-token-warning": "Entra アプリケーションのプロビジョニング設定を更新する必要があります。",
+ "generate-token": "トークンを生成",
+ "regenerate-token": "トークンを再生成",
+ "regenerate-token-warning": "現在のトークンは直ちに無効になり、アプリケーションのプロビジョニング設定を更新する必要があります。続行しますか?",
"secret-token": "シークレットトークン",
"secret-token-tip": "エンドポイントの検証トークンです。秘密にしてください。",
- "self": "SCIM から同期"
+ "self": "SCIM から同期",
+ "token-configured": "トークンは設定済みです。再表示はできないため、紛失した場合は再生成してください。",
+ "token-not-configured": "トークンはまだ生成されていません。",
+ "token-shown-once": "このトークンを今すぐコピーしてください。二度と表示されません。"
},
"grant-access": "アクセスを許可する",
"groups": {
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 04569493d0..6bf437df35 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -2540,11 +2540,15 @@
"description": "Đồng bộ người dùng và nhóm từ Entra ID (trước đây là Azure AD) hoặc Okta sang phiên bản Bytebase của bạn.",
"endpoint": "Điểm cuối",
"endpoint-tip": "Người dùng và nhóm sẽ được đồng bộ đến Bytebase qua điểm cuối này.",
- "reset-token": "Đặt lại mã thông báo",
- "reset-token-warning": "Bạn cần cập nhật cấu hình cung cấp ứng dụng Entra.",
+ "generate-token": "Tạo mã thông báo",
+ "regenerate-token": "Tạo lại mã thông báo",
+ "regenerate-token-warning": "Mã thông báo hiện tại sẽ ngừng hoạt động ngay lập tức và bạn cần cập nhật cấu hình cung cấp ứng dụng. Tiếp tục?",
"secret-token": "Mã thông báo bí mật",
"secret-token-tip": "Mã xác thực cho điểm cuối. Vui lòng giữ bí mật.",
- "self": "Đồng bộ từ SCIM"
+ "self": "Đồng bộ từ SCIM",
+ "token-configured": "Đã cấu hình mã thông báo. Mã sẽ không được hiển thị lại — hãy tạo lại nếu bạn không còn giữ.",
+ "token-not-configured": "Chưa có mã thông báo nào được tạo.",
+ "token-shown-once": "Hãy sao chép mã thông báo này ngay. Mã sẽ không được hiển thị lại."
},
"grant-access": "Cấp Quyền truy cập",
"groups": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 3328903bcf..cbb515a732 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -2540,11 +2540,15 @@
"description": "将 Entra ID(前 Azure AD)或 Okta 中的用户和组同步到您的 Bytebase 实例。",
"endpoint": "端点",
"endpoint-tip": "用户和组将通过此端点同步到 Bytebase。",
- "reset-token": "重置密钥",
- "reset-token-warning": "您需要更新 Entra 应用程序配置。",
+ "generate-token": "生成密钥",
+ "regenerate-token": "重新生成密钥",
+ "regenerate-token-warning": "当前密钥将立即失效,您需要更新应用程序配置。是否继续?",
"secret-token": "Secret Token",
"secret-token-tip": "端点的验证令牌,请妥善保管。",
- "self": "从 SCIM 同步"
+ "self": "从 SCIM 同步",
+ "token-configured": "已配置密钥。密钥无法再次显示,如已遗失请重新生成。",
+ "token-not-configured": "尚未生成密钥。",
+ "token-shown-once": "请立即复制此密钥,它不会再次显示。"
},
"grant-access": "授予访问权限",
"groups": {
diff --git a/frontend/src/routes/workspace/shared/AADSyncSheet.test.tsx b/frontend/src/routes/workspace/shared/AADSyncSheet.test.tsx
new file mode 100644
index 0000000000..264ca1ba24
--- /dev/null
+++ b/frontend/src/routes/workspace/shared/AADSyncSheet.test.tsx
@@ -0,0 +1,195 @@
+import type { ReactNode } from "react";
+import { act, createElement } from "react";
+import { createRoot } from "react-dom/client";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+(
+ globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }
+).IS_REACT_ACT_ENVIRONMENT = true;
+
+const mocks = vi.hoisted(() => ({
+ rotate: vi.fn(),
+ loadWorkspaceProfile: vi.fn(),
+ copied: [] as string[],
+ tokenConfigured: false,
+ hasRotatePermission: true,
+}));
+
+vi.mock("@/api", () => ({
+ workspaceServiceClientConnect: {
+ rotateDirectorySyncToken: (...args: unknown[]) => mocks.rotate(...args),
+ },
+}));
+
+vi.mock("@/stores/app", () => ({
+ useAppStore: Object.assign(
+ (selector: (s: unknown) => unknown) =>
+ selector({
+ serverInfo: { externalUrl: "https://bb.example.com" },
+ workspaceResourceName: () => "workspaces/ws1",
+ getWorkspaceProfile: () => ({
+ directorySyncTokenConfigured: mocks.tokenConfigured,
+ }),
+ }),
+ {
+ getState: () => ({
+ loadWorkspaceProfile: mocks.loadWorkspaceProfile,
+ }),
+ }
+ ),
+}));
+
+vi.mock("@/stores", () => ({ pushNotification: vi.fn() }));
+
+vi.mock("@/lib/clipboard", () => ({
+ writeTextToClipboard: (v: string) => {
+ mocks.copied.push(v);
+ return Promise.resolve(true);
+ },
+}));
+
+vi.mock("@/utils", () => ({
+ hasWorkspacePermissionV2: () => mocks.hasRotatePermission,
+}));
+
+vi.mock("@/components/ExternalUrlAlert", () => ({
+ ExternalUrlAlert: () => createElement("div"),
+}));
+vi.mock("@/components/LearnMoreLink", () => ({
+ LearnMoreLink: () => createElement("span"),
+}));
+vi.mock("react-i18next", () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+// Render the real Sheet primitives as plain divs so the test exercises this
+// component's logic rather than the overlay library.
+vi.mock("@/components/ui/sheet", () => ({
+ Sheet: ({ children }: { children: ReactNode }) =>
+ createElement("div", {}, children),
+ SheetBody: ({ children }: { children: ReactNode }) =>
+ createElement("div", {}, children),
+ SheetContent: ({ children }: { children: ReactNode }) =>
+ createElement("div", {}, children),
+ SheetFooter: ({ children }: { children: ReactNode }) =>
+ createElement("div", {}, children),
+ SheetHeader: ({ children }: { children: ReactNode }) =>
+ createElement("div", {}, children),
+ SheetTitle: ({ children }: { children: ReactNode }) =>
+ createElement("div", {}, children),
+}));
+
+import { AADSyncSheet } from "./AADSyncSheet";
+
+let container: HTMLDivElement;
+let root: ReturnType<typeof createRoot>;
+
+const renderSheet = async (open = true, onClose = vi.fn()) => {
+ await act(async () => {
+ root.render(createElement(AADSyncSheet, { open, onClose }));
+ });
+ return onClose;
+};
+
+const buttonByText = (text: string) =>
+ Array.from(container.querySelectorAll("button")).find((b) =>
+ b.textContent?.includes(text)
+ );
+
+const tokenInput = () =>
+ Array.from(container.querySelectorAll("input")).find((i) =>
+ i.value.startsWith("tok-")
+ );
+
+describe("AADSyncSheet SCIM token", () => {
+ beforeEach(() => {
+ container = document.createElement("div");
+ document.body.appendChild(container);
+ root = createRoot(container);
+ mocks.rotate.mockReset();
+ mocks.loadWorkspaceProfile.mockReset();
+ mocks.copied = [];
+ mocks.tokenConfigured = false;
+ mocks.hasRotatePermission = true;
+ });
+
+ afterEach(async () => {
+ await act(async () => root.unmount());
+ container.remove();
+ });
+
+ it("offers generate when no token exists and regenerate once one does", async () => {
+ await renderSheet();
+ expect(buttonByText("generate-token")).toBeTruthy();
+ expect(buttonByText("regenerate-token")).toBeFalsy();
+ expect(container.textContent).toContain("token-not-configured");
+
+ mocks.tokenConfigured = true;
+ await renderSheet();
+ expect(buttonByText("regenerate-token")).toBeTruthy();
+ expect(container.textContent).toContain("token-configured");
+ });
+
+ it("shows the minted token once and never renders it again after closing", async () => {
+ mocks.rotate.mockResolvedValue({ token: "tok-minted-once" });
+
+ const onClose = await renderSheet();
+ await act(async () => {
+ buttonByText("generate-token")?.click();
+ });
+
+ // Shown once, with the warning, and the profile is refreshed so the button
+ // flips to "regenerate".
+ expect(tokenInput()?.value).toBe("tok-minted-once");
+ expect(container.textContent).toContain("token-shown-once");
+ expect(mocks.loadWorkspaceProfile).toHaveBeenCalledWith(true);
+
+ // Closing must clear it: the sheet stays mounted, so without an explicit
+ // reset a reopen would redisplay a token that was supposed to be shown once.
+ await act(async () => {
+ buttonByText("common.cancel")?.click();
+ });
+ expect(onClose).toHaveBeenCalled();
+
+ mocks.tokenConfigured = true;
+ await renderSheet();
+ expect(tokenInput()).toBeUndefined();
+ expect(container.textContent).not.toContain("tok-minted-once");
+ expect(container.textContent).toContain("token-configured");
+ });
+
+ it("copies the minted token verbatim", async () => {
+ mocks.rotate.mockResolvedValue({ token: "tok-copy-me" });
+ await renderSheet();
+ await act(async () => {
+ buttonByText("generate-token")?.click();
+ });
+
+ const copyButtons = Array.from(container.querySelectorAll("button")).filter(
+ (b) => b.textContent === ""
+ );
+ await act(async () => {
+ copyButtons[copyButtons.length - 1]?.click();
+ });
+ expect(mocks.copied).toContain("tok-copy-me");
+ });
+
+ it("keeps the sheet usable when rotation fails and shows no token", async () => {
+ mocks.rotate.mockRejectedValue(new Error("permission denied"));
+ await renderSheet();
+
+ await act(async () => {
+ buttonByText("generate-token")?.click();
+ });
+
+ expect(tokenInput()).toBeUndefined();
+ expect(container.textContent).not.toContain("token-shown-once");
+ });
+
+ it("hides the rotate control without permission", async () => {
+ mocks.hasRotatePermission = false;
+ await renderSheet();
+ expect(buttonByText("generate-token")).toBeFalsy();
+ expect(buttonByText("regenerate-token")).toBeFalsy();
+ });
+});
diff --git a/frontend/src/routes/workspace/shared/AADSyncSheet.tsx b/frontend/src/routes/workspace/shared/AADSyncSheet.tsx
index 193b38dedb..2e2ca8274c 100644
--- a/frontend/src/routes/workspace/shared/AADSyncSheet.tsx
+++ b/frontend/src/routes/workspace/shared/AADSyncSheet.tsx
@@ -1,9 +1,11 @@
import { create } from "@bufbuild/protobuf";
-import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";
import { Copy } from "lucide-react";
+import { useState } from "react";
import { useTranslation } from "react-i18next";
+import { workspaceServiceClientConnect } from "@/api";
import { ExternalUrlAlert } from "@/components/ExternalUrlAlert";
import { LearnMoreLink } from "@/components/LearnMoreLink";
+import { Alert } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import {
@@ -17,6 +19,7 @@ import {
import { writeTextToClipboard } from "@/lib/clipboard";
import { pushNotification } from "@/stores";
import { useAppStore } from "@/stores/app";
+import { RotateDirectorySyncTokenRequestSchema } from "@/types/proto-es/v1/workspace_service_pb";
import { hasWorkspacePermissionV2 } from "@/utils";
// ============================================================
@@ -34,8 +37,8 @@ export function AADSyncSheet({
const externalUrl = useAppStore((s) => s.serverInfo?.externalUrl ?? "");
const workspaceResourceName = useAppStore((s) => s.workspaceResourceName());
- const directorySyncToken = useAppStore(
- (s) => s.getWorkspaceProfile().directorySyncToken
+ const tokenConfigured = useAppStore(
+ (s) => s.getWorkspaceProfile().directorySyncTokenConfigured
);
const scimUrl =
@@ -59,31 +62,45 @@ export function AADSyncSheet({
}
};
- const handleResetToken = async () => {
- const confirmed = window.confirm(
- t("settings.members.entra-sync.reset-token-warning")
- );
- if (!confirmed) return;
+ // The plaintext token is returned exactly once by the rotate RPC, so it lives
+ // in local state only. The sheet stays mounted when closed, so this must be
+ // cleared explicitly — otherwise reopening would redisplay a token that is
+ // supposed to have been shown once.
+ const [mintedToken, setMintedToken] = useState("");
+
+ const handleClose = () => {
+ setMintedToken("");
+ onClose();
+ };
+
+ const handleRotateToken = async () => {
+ if (tokenConfigured) {
+ const confirmed = window.confirm(
+ t("settings.members.entra-sync.regenerate-token-warning")
+ );
+ if (!confirmed) return;
+ }
try {
- await useAppStore.getState().updateWorkspaceProfile({
- payload: { directorySyncToken: "" },
- updateMask: create(FieldMaskSchema, {
- paths: ["value.workspace_profile.directory_sync_token"],
- }),
- });
+ const resp = await workspaceServiceClientConnect.rotateDirectorySyncToken(
+ create(RotateDirectorySyncTokenRequestSchema, {
+ name: workspaceResourceName,
+ })
+ );
+ setMintedToken(resp.token);
+ await useAppStore.getState().loadWorkspaceProfile(true);
pushNotification({
module: "bytebase",
style: "SUCCESS",
title: t("common.updated"),
});
} catch {
- // error already shown by store
+ // error already shown by the client interceptor
}
};
return (
- <Sheet open={open} onOpenChange={(next) => !next && onClose()}>
+ <Sheet open={open} onOpenChange={(next) => !next && handleClose()}>
<SheetContent width="standard">
<SheetHeader>
<SheetTitle>{t("settings.members.entra-sync.self")}</SheetTitle>
@@ -132,30 +149,48 @@ export function AADSyncSheet({
<span className="textinfolabel text-sm">
{t("settings.members.entra-sync.secret-token-tip")}
</span>
- <div className="flex items-center gap-x-2">
- <Input
- readOnly
- type="password"
- value={directorySyncToken}
- className="flex-1 text-sm"
- />
- <Button
- appearance="outline"
- size="sm"
- disabled={!directorySyncToken}
- onClick={() => copyToClipboard(directorySyncToken)}
- >
- <Copy className="h-4 w-4" />
- </Button>
- </div>
- {hasWorkspacePermissionV2("bb.settings.setWorkspaceProfile") && (
+ {mintedToken ? (
+ <>
+ <div className="flex items-center gap-x-2">
+ <Input
+ readOnly
+ value={mintedToken}
+ className="flex-1 text-sm font-mono"
+ />
+ <Button
+ appearance="outline"
+ size="sm"
+ onClick={() => copyToClipboard(mintedToken)}
+ >
+ <Copy className="size-4" />
+ </Button>
+ </div>
+ <Alert
+ variant="warning"
+ description={t(
+ "settings.members.entra-sync.token-shown-once"
+ )}
+ />
+ </>
+ ) : (
+ <span className="textinfolabel text-sm">
+ {tokenConfigured
+ ? t("settings.members.entra-sync.token-configured")
+ : t("settings.members.entra-sync.token-not-configured")}
+ </span>
+ )}
+ {hasWorkspacePermissionV2(
+ "bb.workspaces.rotateDirectorySyncToken"
+ ) && (
<Button
appearance="outline"
size="sm"
- className="self-start text-error border-error hover:bg-error/10"
- onClick={handleResetToken}
+ className="self-start"
+ onClick={handleRotateToken}
>
- {t("settings.members.entra-sync.reset-token")}
+ {tokenConfigured
+ ? t("settings.members.entra-sync.regenerate-token")
+ : t("settings.members.entra-sync.generate-token")}
</Button>
)}
</div>
@@ -163,7 +198,7 @@ export function AADSyncSheet({
</SheetBody>
<SheetFooter>
- <Button appearance="outline" onClick={onClose}>
+ <Button appearance="outline" onClick={handleClose}>
{t("common.cancel")}
</Button>
</SheetFooter>
diff --git a/frontend/src/types/iam/permission-generated.ts b/frontend/src/types/iam/permission-generated.ts
index b3b61185d7..e3acce6a4d 100644
--- a/frontend/src/types/iam/permission-generated.ts
+++ b/frontend/src/types/iam/permission-generated.ts
@@ -146,4 +146,5 @@ export type Permission =
| "bb.workspaces.delete"
| "bb.workspaces.getIamPolicy"
| "bb.workspaces.update"
- | "bb.workspaces.setIamPolicy";
+ | "bb.workspaces.setIamPolicy"
+ | "bb.workspaces.rotateDirectorySyncToken";
diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
index 7c9e0b93ac..a7cee08fd4 100644
--- a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
@@ -590,13 +590,6 @@ export declare type WorkspaceProfileSetting = Message<"bytebase.v1.WorkspaceProf
*/
watermark: boolean;
- /**
- * The token for directory sync authentication.
- *
- * @generated from field: string directory_sync_token = 15;
- */
- directorySyncToken: string;
-
/**
* Password restriction settings.
*
@@ -675,6 +668,15 @@ export declare type WorkspaceProfileSetting = Message<"bytebase.v1.WorkspaceProf
* @generated from field: bytebase.v1.WorkspaceProfileSetting.MCPCapability mcp_capability = 26;
*/
mcpCapability: WorkspaceProfileSetting_MCPCapability;
+
+ /**
+ * Whether a directory sync token has been generated for this workspace.
+ * The token itself is never returned; this only lets the UI decide between
+ * offering "generate" and "regenerate".
+ *
+ * @generated from field: bool directory_sync_token_configured = 27;
+ */
+ directorySyncTokenConfigured: boolean;
};
/**
diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.js b/frontend/src/types/proto-es/v1/setting_service_pb.js
index afd999342b..fdf6e888f0 100644
--- a/frontend/src/types/proto-es/v1/setting_service_pb.js
+++ b/frontend/src/types/proto-es/v1/setting_service_pb.js
@@ -18,7 +18,7 @@ import { file_v1_issue_service } from "./issue_service_pb";
* Describes the file v1/setting_service.proto.
*/
export const file_v1_setting_service = /*@__PURE__*/
- fileDesc("Chh2MS9zZXR0aW5nX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIhUKE0xpc3RTZXR0aW5nc1JlcXVlc3QiPgoUTGlzdFNldHRpbmdzUmVzcG9uc2USJgoIc2V0dGluZ3MYASADKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIj8KEUdldFNldHRpbmdSZXF1ZXN0EioKBG5hbWUYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1NldHRpbmciOwoSR2V0U2V0dGluZ1Jlc3BvbnNlEiUKB3NldHRpbmcYASABKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIqEBChRVcGRhdGVTZXR0aW5nUmVxdWVzdBIqCgdzZXR0aW5nGAEgASgLMhQuYnl0ZWJhc2UudjEuU2V0dGluZ0ID4EECEhUKDXZhbGlkYXRlX29ubHkYAiABKAgSFQoNYWxsb3dfbWlzc2luZxgDIAEoCBIvCgt1cGRhdGVfbWFzaxgEIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2sitAIKB1NldHRpbmcSEQoEbmFtZRgBIAEoCUID4EEIEi0KBXZhbHVlGAIgASgLMhkuYnl0ZWJ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olLmJ5dGViYXNlLnYxLlRlc3RFbWFpbFNldHRpbmdSZXNwb25zZSJPiuowD2JiLnNldHRpbmdzLnNldJDqMAGC0+STAjI6ASoiLS92MS97cGFyZW50PXdvcmtzcGFjZXMvKn0vc2V0dGluZ3MvRU1BSUw6dGVzdEKpAQoPY29tLmJ5dGViYXNlLnYxQhNTZXR0aW5nU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_color, file_google_type_expr, file_v1_annotation, file_v1_common, file_v1_issue_service]);
+ fileDesc("Chh2MS9zZXR0aW5nX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIhUKE0xpc3RTZXR0aW5nc1JlcXVlc3QiPgoUTGlzdFNldHRpbmdzUmVzcG9uc2USJgoIc2V0dGluZ3MYASADKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIj8KEUdldFNldHRpbmdSZXF1ZXN0EioKBG5hbWUYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1NldHRpbmciOwoSR2V0U2V0dGluZ1Jlc3BvbnNlEiUKB3NldHRpbmcYASABKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIqEBChRVcGRhdGVTZXR0aW5nUmVxdWVzdBIqCgdzZXR0aW5nGAEgASgLMhQuYnl0ZWJhc2UudjEuU2V0dGluZ0ID4EECEhUKDXZhbGlkYXRlX29ubHkYAiABKAgSFQoNYWxsb3dfbWlzc2luZxgDIAEoCBIvCgt1cGRhdGVfbWFzaxgEIAEoCzIaLmdvb2dsZS5wcm90b2J1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HS92MS97c2V0dGluZy5uYW1lPXNldHRpbmdzLyp9ErABChBUZXN0RW1haWxTZXR0aW5nEiQuYnl0ZWJhc2UudjEuVGVzdEVtYWlsU2V0dGluZ1JlcXVlc3QaJS5ieXRlYmFzZS52MS5UZXN0RW1haWxTZXR0aW5nUmVzcG9uc2UiT4rqMA9iYi5zZXR0aW5ncy5zZXSQ6jABgtPkkwIyOgEqIi0vdjEve3BhcmVudD13b3Jrc3BhY2VzLyp9L3NldHRpbmdzL0VNQUlMOnRlc3RCqQEKD2NvbS5ieXRlYmFzZS52MUITU2V0dGluZ1NlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_color, file_google_type_expr, file_v1_annotation, file_v1_common, file_v1_issue_service]);
/**
* Describes the message bytebase.v1.ListSettingsRequest.
diff --git a/frontend/src/types/proto-es/v1/workspace_service_pb.d.ts b/frontend/src/types/proto-es/v1/workspace_service_pb.d.ts
index 226db6cc82..a887316eb6 100644
--- a/frontend/src/types/proto-es/v1/workspace_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/workspace_service_pb.d.ts
@@ -13,6 +13,43 @@ import type { LoginResponseSchema } from "./auth_service_pb";
*/
export declare const file_v1_workspace_service: GenFile;
+/**
+ * @generated from message bytebase.v1.RotateDirectorySyncTokenRequest
+ */
+export declare type RotateDirectorySyncTokenRequest = Message<"bytebase.v1.RotateDirectorySyncTokenRequest"> & {
+ /**
+ * The workspace whose directory sync token is rotated.
+ * Format: workspaces/{workspace}
+ *
+ * @generated from field: string name = 1;
+ */
+ name: string;
+};
+
+/**
+ * Describes the message bytebase.v1.RotateDirectorySyncTokenRequest.
+ * Use `create(RotateDirectorySyncTokenRequestSchema)` to create a new message.
+ */
+export declare const RotateDirectorySyncTokenRequestSchema: GenMessage<RotateDirectorySyncTokenRequest>;
+
+/**
+ * @generated from message bytebase.v1.RotateDirectorySyncTokenResponse
+ */
+export declare type RotateDirectorySyncTokenResponse = Message<"bytebase.v1.RotateDirectorySyncTokenResponse"> & {
+ /**
+ * The new token, in plaintext. This is the only time it is ever returned.
+ *
+ * @generated from field: string token = 1;
+ */
+ token: string;
+};
+
+/**
+ * Describes the message bytebase.v1.RotateDirectorySyncTokenResponse.
+ * Use `create(RotateDirectorySyncTokenResponseSchema)` to create a new message.
+ */
+export declare const RotateDirectorySyncTokenResponseSchema: GenMessage<RotateDirectorySyncTokenResponse>;
+
/**
* @generated from message bytebase.v1.ListWorkspacesRequest
*/
@@ -233,5 +270,19 @@ export declare const WorkspaceService: GenService<{
input: typeof SetIamPolicyRequestSchema;
output: typeof IamPolicySchema;
},
+ /**
+ * Mints a new directory sync (SCIM) token, immediately invalidating the
+ * previous one. The plaintext token is returned exactly once and cannot be
+ * retrieved afterwards; only its hash is stored. Callers that lose it must
+ * rotate again and update their identity provider.
+ * Permissions required: bb.workspaces.rotateDirectorySyncToken
+ *
+ * @generated from rpc bytebase.v1.WorkspaceService.RotateDirectorySyncToken
+ */
+ rotateDirectorySyncToken: {
+ methodKind: "unary";
+ input: typeof RotateDirectorySyncTokenRequestSchema;
+ output: typeof RotateDirectorySyncTokenResponseSchema;
+ },
}>;
diff --git a/frontend/src/types/proto-es/v1/workspace_service_pb.js b/frontend/src/types/proto-es/v1/workspace_service_pb.js
index 17afda1757..dd61e7755e 100644
--- a/frontend/src/types/proto-es/v1/workspace_service_pb.js
+++ b/frontend/src/types/proto-es/v1/workspace_service_pb.js
@@ -4,7 +4,9 @@
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
import { file_google_api_annotations } from "../google/api/annotations_pb";
+import { file_google_api_client } from "../google/api/client_pb";
import { file_google_api_field_behavior } from "../google/api/field_behavior_pb";
+import { file_google_api_resource } from "../google/api/resource_pb";
import { file_google_protobuf_field_mask } from "@bufbuild/protobuf/wkt";
import { file_v1_annotation } from "./annotation_pb";
import { file_v1_auth_service } from "./auth_service_pb";
@@ -14,56 +16,70 @@ import { file_v1_iam_policy } from "./iam_policy_pb";
* Describes the file v1/workspace_service.proto.
*/
export const file_v1_workspace_service = /*@__PURE__*/
- fileDesc("Chp2MS93b3Jrc3BhY2Vfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiFwoVTGlzdFdvcmtzcGFjZXNSZXF1ZXN0IkQKFkxpc3RXb3Jrc3BhY2VzUmVzcG9uc2USKgoKd29ya3NwYWNlcxgBIAMoCzIWLmJ5dGViYXNlLnYxLldvcmtzcGFjZSIjChNHZXRXb3Jrc3BhY2VSZXF1ZXN0EgwKBG5hbWUYASABKAkiNgoJV29ya3NwYWNlEgwKBG5hbWUYASABKAkSDQoFdGl0bGUYAiABKAkSDAoEbG9nbxgDIAEoCSIrChZEZWxldGVXb3Jrc3BhY2VSZXF1ZXN0EhEKBG5hbWUYASABKAlCA+BBAiJ5ChZVcGRhdGVXb3Jrc3BhY2VSZXF1ZXN0Ei4KCXdvcmtzcGFjZRgBIAEoCzIWLmJ5dGViYXNlLnYxLldvcmtzcGFjZUID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzayIqChVMZWF2ZVdvcmtzcGFjZVJlcXVlc3QSEQoEbmFtZRgBIAEoCUID4EECMvcHChBXb3Jrc3BhY2VTZXJ2aWNlEm0KDEdldFdvcmtzcGFjZRIgLmJ5dGViYXNlLnYxLkdldFdvcmtzcGFjZVJlcXVlc3QaFi5ieXRlYmFzZS52MS5Xb3Jrc3BhY2UiI4DqMAGC0+STAhkSFy92MS97bmFtZT13b3Jrc3BhY2VzLyp9EnUKDk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G9saWN5IlmK6jAaYmIud29ya3NwYWNlcy5zZXRJYW1Qb2xpY3mQ6jABmOowAYLT5JMCLToBKiIoL3YxL3tyZXNvdXJjZT13b3Jrc3BhY2VzLyp9OnNldElhbVBvbGljeUKrAQoPY29tLmJ5dGViYXNlLnYxQhVXb3Jrc3BhY2VTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_field_behavior, file_google_protobuf_field_mask, file_v1_annotation, file_v1_auth_service, file_v1_iam_policy]);
+ fileDesc("Chp2MS93b3Jrc3BhY2Vfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiTwofUm90YXRlRGlyZWN0b3J5U3luY1Rva2VuUmVxdWVzdBIsCgRuYW1lGAEgASgJQh7gQQL6QRgKFmJ5dGViYXNlLmNvbS9Xb3Jrc3BhY2UiNgogUm90YXRlRGlyZWN0b3J5U3luY1Rva2VuUmVzcG9uc2USEgoFdG9rZW4YASABKAlCA+BBAyIXChVMaXN0V29ya3NwYWNlc1JlcXVlc3QiRAoWTGlzdFdvcmtzcGFjZXNSZXNwb25zZRIqCgp3b3Jrc3BhY2VzGAEgAygLMhYuYnl0ZWJhc2UudjEuV29ya3NwYWNlIiMKE0dldFdvcmtzcGFjZVJlcXVlc3QSDAoEbmFtZRgBIAEoCSI2CglXb3Jrc3BhY2USDAoEbmFtZRgBIAEoCRINCgV0aXRsZRgCIAEoCRIMCgRsb2dvGAMgASgJIisKFkRlbGV0ZVdvcmtzcGFjZVJlcXVlc3QSEQoEbmFtZRgBIAEoCUID4EECInkKFlVwZGF0ZVdvcmtzcGFjZVJlcXVlc3QSLgoJd29ya3NwYWNlGAEgASgLM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ZZDqMAGY6jABgtPkkwIZKhcvdjEve25hbWU9d29ya3NwYWNlcy8qfRKCAQoOTGVhdmVXb3Jrc3BhY2USIi5ieXRlYmFzZS52MS5MZWF2ZVdvcmtzcGFjZVJlcXVlc3QaGi5ieXRlYmFzZS52MS5Mb2dpblJlc3BvbnNlIjCQ6jACmOowAYLT5JMCIjoBKiIdL3YxL3tuYW1lPXdvcmtzcGFjZXMvKn06bGVhdmUSowEKDFNldElhbVBvbGljeRIgLmJ5dGViYXNlLnYxLlNldElhbVBvbGljeVJlcXVlc3QaFi5ieXRlYmFzZS52MS5JYW1Qb2xpY3kiWYrqMBpiYi53b3Jrc3BhY2VzLnNldElhbVBvbGljeZDqMAGY6jABgtPkkwItOgEqIigvdjEve3Jlc291cmNlPXdvcmtzcGFjZXMvKn06c2V0SWFtUG9saWN5Eu0BChhSb3RhdGVEaXJlY3RvcnlTeW5jVG9rZW4SLC5ieXRlYmFzZS52MS5Sb3RhdGVEaXJlY3RvcnlTeW5jVG9rZW5SZXF1ZXN0Gi0uYnl0ZWJhc2UudjEuUm90YXRlRGlyZWN0b3J5U3luY1Rva2VuUmVzcG9uc2UidNpBBG5hbWWK6jAmYmIud29ya3NwYWNlcy5yb3RhdGVEaXJlY3RvcnlTeW5jVG9rZW6Q6jABmOowAYLT5JMCNToBKiIwL3YxL3tuYW1lPXdvcmtzcGFjZXMvKn06cm90YXRlRGlyZWN0b3J5U3luY1Rva2VuQqsBCg9jb20uYnl0ZWJhc2UudjFCFVdvcmtzcGFjZVNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask, file_v1_annotation, file_v1_auth_service, file_v1_iam_policy]);
+
+/**
+ * Describes the message bytebase.v1.RotateDirectorySyncTokenRequest.
+ * Use `create(RotateDirectorySyncTokenRequestSchema)` to create a new message.
+ */
+export const RotateDirectorySyncTokenRequestSchema = /*@__PURE__*/
+ messageDesc(file_v1_workspace_service, 0);
+
+/**
+ * Describes the message bytebase.v1.RotateDirectorySyncTokenResponse.
+ * Use `create(RotateDirectorySyncTokenResponseSchema)` to create a new message.
+ */
+export const RotateDirectorySyncTokenResponseSchema = /*@__PURE__*/
+ messageDesc(file_v1_workspace_service, 1);
/**
* Describes the message bytebase.v1.ListWorkspacesRequest.
* Use `create(ListWorkspacesRequestSchema)` to create a new message.
*/
export const ListWorkspacesRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 0);
+ messageDesc(file_v1_workspace_service, 2);
/**
* Describes the message bytebase.v1.ListWorkspacesResponse.
* Use `create(ListWorkspacesResponseSchema)` to create a new message.
*/
export const ListWorkspacesResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 1);
+ messageDesc(file_v1_workspace_service, 3);
/**
* Describes the message bytebase.v1.GetWorkspaceRequest.
* Use `create(GetWorkspaceRequestSchema)` to create a new message.
*/
export const GetWorkspaceRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 2);
+ messageDesc(file_v1_workspace_service, 4);
/**
* Describes the message bytebase.v1.Workspace.
* Use `create(WorkspaceSchema)` to create a new message.
*/
export const WorkspaceSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 3);
+ messageDesc(file_v1_workspace_service, 5);
/**
* Describes the message bytebase.v1.DeleteWorkspaceRequest.
* Use `create(DeleteWorkspaceRequestSchema)` to create a new message.
*/
export const DeleteWorkspaceRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 4);
+ messageDesc(file_v1_workspace_service, 6);
/**
* Describes the message bytebase.v1.UpdateWorkspaceRequest.
* Use `create(UpdateWorkspaceRequestSchema)` to create a new message.
*/
export const UpdateWorkspaceRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 5);
+ messageDesc(file_v1_workspace_service, 7);
/**
* Describes the message bytebase.v1.LeaveWorkspaceRequest.
* Use `create(LeaveWorkspaceRequestSchema)` to create a new message.
*/
export const LeaveWorkspaceRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_workspace_service, 6);
+ messageDesc(file_v1_workspace_service, 8);
/**
* WorkspaceService manages workspace-level operations and profile.
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 3a2646344c..aeb2a4b8c4 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -18578,6 +18578,32 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.LoginResponse'
+ /v1/workspaces/{workspace}:rotateDirectorySyncToken:
+ post:
+ tags:
+ - WorkspaceService
+ summary: RotateDirectorySyncToken
+ description: |-
+ Mints a new directory sync (SCIM) token, immediately invalidating the
+ previous one. The plaintext token is returned exactly once and cannot be
+ retrieved afterwards; only its hash is stored. Callers that lose it must
+ rotate again and update their identity provider.
+ Permissions required: bb.workspaces.rotateDirectorySyncToken
+ operationId: WorkspaceService_RotateDirectorySyncToken
+ parameters:
+ - name: workspace
+ in: path
+ description: The workspace id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.RotateDirectorySyncTokenResponse'
/v1/workspaces/{workspace}:setIamPolicy:
post:
tags:
@@ -28365,6 +28391,29 @@ components:
title: RolloutPolicy
additionalProperties: false
description: Rollout policy configuration.
+ bytebase.v1.RotateDirectorySyncTokenRequest:
+ type: object
+ properties:
+ name:
+ type: string
+ title: name
+ description: |-
+ The workspace whose directory sync token is rotated.
+ Format: workspaces/{workspace}
+ title: RotateDirectorySyncTokenRequest
+ required:
+ - name
+ additionalProperties: false
+ bytebase.v1.RotateDirectorySyncTokenResponse:
+ type: object
+ properties:
+ token:
+ type: string
+ title: token
+ description: The new token, in plaintext. This is the only time it is ever returned.
+ readOnly: true
+ title: RotateDirectorySyncTokenResponse
+ additionalProperties: false
bytebase.v1.RowValue:
type: object
oneOf:
@@ -32591,10 +32640,6 @@ components:
description: |-
Whether to display watermark on pages.
Requires ENTERPRISE license.
- directorySyncToken:
- type: string
- title: directory_sync_token
- description: The token for directory sync authentication.
passwordRestriction:
title: password_restriction
description: Password restriction settings.
@@ -32653,6 +32698,14 @@ components:
connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —
omit the update mask path to leave the ceiling unset.
$ref: '#/components/schemas/bytebase.v1.WorkspaceProfileSetting.MCPCapability'
+ directorySyncTokenConfigured:
+ type: boolean
+ title: directory_sync_token_configured
+ description: |-
+ Whether a directory sync token has been generated for this workspace.
+ The token itself is never returned; this only lets the UI decide between
+ offering "generate" and "regenerate".
+ readOnly: true
title: WorkspaceProfileSetting
additionalProperties: false
bytebase.v1.WorkspaceProfileSetting.MCPCapability:
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 156462c820..2cf6b2a471 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -4710,7 +4710,6 @@ All other settings live in per-workspace WORKSPACE_PROFILE.
| inactive_session_timeout | [google.protobuf.Duration](#google-protobuf-Duration) | | The session expiration time if not activity detected for the user. Value &lt;= 0 means no limit. |
| enable_audit_log_stdout | [bool](#bool) | | Whether to enable audit logging to stdout in structured JSON format. Requires TEAM or ENTERPRISE license. |
| watermark | [bool](#bool) | | Whether to display watermark on pages. Requires ENTERPRISE license. |
-| directory_sync_token | [string](#string) | | The token for directory sync authentication. |
| password_restriction | [WorkspaceProfileSetting.PasswordRestriction](#bytebase-store-WorkspaceProfileSetting-PasswordRestriction) | | Password restriction settings. |
| access_token_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration for access token. Default is 1 hour. |
| enable_debug | [bool](#bool) | | Whether debug mode is enabled. |
@@ -4721,6 +4720,7 @@ All other settings live in per-workspace WORKSPACE_PROFILE.
| sql_editor_custom_theme | [SQLEditorThemeSetting](#bytebase-store-SQLEditorThemeSetting) | | The enforced CUSTOM theme&#39;s full definition — present ONLY when sql_editor_theme_id is a custom uuid. tokens is always complete. |
| maximum_role_expiration | [google.protobuf.Duration](#google-protobuf-Duration) | | The max expiration duration for request role. Deprecated: use just-in-time access request flows instead. |
| mcp_capability | [WorkspaceProfileSetting.MCPCapability](#bytebase-store-WorkspaceProfileSetting-MCPCapability) | | The maximum capability available to MCP (Model Context Protocol) sessions in this workspace, acting as an admin-set ceiling. Unset is treated as READ_WRITE for backward compatibility; DISABLED rejects all MCP connections. Enforced server-side by the /mcp endpoint. |
+| directory_sync_token_hash | [string](#string) | | Hex-encoded SHA-256 of the SCIM directory sync token. The plaintext is shown once at rotation and never stored. SHA-256 rather than a slow KDF because the token is 122 bits of crypto/rand, not a human-chosen secret. |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 96505fe1d6..7e67073e5e 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -12943,13 +12943,6 @@ Requires TEAM or ENTERPRISE license. </p></td>
Requires ENTERPRISE license. </p></td>
</tr>
- <tr>
- <td>directory_sync_token</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The token for directory sync authentication. </p></td>
- </tr>
-
<tr>
<td>password_restriction</td>
<td><a href="#bytebase.store.WorkspaceProfileSetting.PasswordRestriction">WorkspaceProfileSetting.PasswordRestriction</a></td>
@@ -13028,6 +13021,15 @@ READ_WRITE for backward compatibility; DISABLED rejects all MCP
connections. Enforced server-side by the /mcp endpoint. </p></td>
</tr>
+ <tr>
+ <td>directory_sync_token_hash</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Hex-encoded SHA-256 of the SCIM directory sync token. The plaintext is shown
+once at rotation and never stored. SHA-256 rather than a slow KDF because the
+token is 122 bits of crypto/rand, not a human-chosen secret. </p></td>
+ </tr>
+
</tbody>
</table>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 0c3c11df5e..66a5c2a84d 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -768,6 +768,8 @@
- [LeaveWorkspaceRequest](#bytebase-v1-LeaveWorkspaceRequest)
- [ListWorkspacesRequest](#bytebase-v1-ListWorkspacesRequest)
- [ListWorkspacesResponse](#bytebase-v1-ListWorkspacesResponse)
+ - [RotateDirectorySyncTokenRequest](#bytebase-v1-RotateDirectorySyncTokenRequest)
+ - [RotateDirectorySyncTokenResponse](#bytebase-v1-RotateDirectorySyncTokenResponse)
- [UpdateWorkspaceRequest](#bytebase-v1-UpdateWorkspaceRequest)
- [Workspace](#bytebase-v1-Workspace)
@@ -4481,7 +4483,6 @@ For examples: resource.environment_id == &#34;prod&#34; &amp;&amp; statement.aff
| inactive_session_timeout | [google.protobuf.Duration](#google-protobuf-Duration) | | The session expiration time if not activity detected for the user. Value &lt;= 0 means no limit. |
| enable_audit_log_stdout | [bool](#bool) | | Whether to enable audit logging to stdout in structured JSON format. Requires TEAM or ENTERPRISE license. |
| watermark | [bool](#bool) | | Whether to display watermark on pages. Requires ENTERPRISE license. |
-| directory_sync_token | [string](#string) | | The token for directory sync authentication. |
| password_restriction | [WorkspaceProfileSetting.PasswordRestriction](#bytebase-v1-WorkspaceProfileSetting-PasswordRestriction) | | Password restriction settings. |
| access_token_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration for access token. Default is 1 hour. |
| enable_debug | [bool](#bool) | | Whether debug mode is enabled. |
@@ -4492,6 +4493,7 @@ For examples: resource.environment_id == &#34;prod&#34; &amp;&amp; statement.aff
| sql_editor_custom_theme | [SQLEditorThemeSetting](#bytebase-v1-SQLEditorThemeSetting) | | The enforced CUSTOM theme&#39;s full definition — present ONLY when sql_editor_theme_id is a custom uuid. tokens is always complete. |
| maximum_role_expiration | [google.protobuf.Duration](#google-protobuf-Duration) | | The max expiration duration for request role. Deprecated: use just-in-time access request flows instead. |
| mcp_capability | [WorkspaceProfileSetting.MCPCapability](#bytebase-v1-WorkspaceProfileSetting-MCPCapability) | | The maximum capability available to MCP (Model Context Protocol) sessions in this workspace, acting as an admin-set ceiling. Unset is treated as READ_WRITE for backward compatibility; DISABLED rejects all MCP connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected — omit the update mask path to leave the ceiling unset. |
+| directory_sync_token_configured | [bool](#bool) | | Whether a directory sync token has been generated for this workspace. The token itself is never returned; this only lets the UI decide between offering &#34;generate&#34; and &#34;regenerate&#34;. |
@@ -12360,6 +12362,36 @@ WorksheetService manages SQL worksheets for query development.
+<a name="bytebase-v1-RotateDirectorySyncTokenRequest"></a>
+
+### RotateDirectorySyncTokenRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| name | [string](#string) | | The workspace whose directory sync token is rotated. Format: workspaces/{workspace} |
+
+
+
+
+
+
+<a name="bytebase-v1-RotateDirectorySyncTokenResponse"></a>
+
+### RotateDirectorySyncTokenResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| token | [string](#string) | | The new token, in plaintext. This is the only time it is ever returned. |
+
+
+
+
+
+
<a name="bytebase-v1-UpdateWorkspaceRequest"></a>
### UpdateWorkspaceRequest
@@ -12413,6 +12445,7 @@ WorkspaceService manages workspace-level operations and profile.
| DeleteWorkspace | [DeleteWorkspaceRequest](#bytebase-v1-DeleteWorkspaceRequest) | [LoginResponse](#bytebase-v1-LoginResponse) | Deletes a workspace. SaaS only. Cancels any active subscription and soft-deletes the workspace so all associated data becomes inaccessible. Requires workspace admin permission. |
| LeaveWorkspace | [LeaveWorkspaceRequest](#bytebase-v1-LeaveWorkspaceRequest) | [LoginResponse](#bytebase-v1-LoginResponse) | Removes the calling user from a workspace and switches to the next available workspace. Available to any workspace member. Fails if the caller is the last workspace admin. |
| SetIamPolicy | [SetIamPolicyRequest](#bytebase-v1-SetIamPolicyRequest) | [IamPolicy](#bytebase-v1-IamPolicy) | Sets IAM policy for the workspace. Permissions required: bb.workspaces.setIamPolicy |
+| RotateDirectorySyncToken | [RotateDirectorySyncTokenRequest](#bytebase-v1-RotateDirectorySyncTokenRequest) | [RotateDirectorySyncTokenResponse](#bytebase-v1-RotateDirectorySyncTokenResponse) | Mints a new directory sync (SCIM) token, immediately invalidating the previous one. The plaintext token is returned exactly once and cannot be retrieved afterwards; only its hash is stored. Callers that lose it must rotate again and update their identity provider. Permissions required: bb.workspaces.rotateDirectorySyncToken |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index f47d977f08..24cd5ab0c8 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -3099,6 +3099,14 @@
<a href="#bytebase.v1.ListWorkspacesResponse"><span class="badge">M</span>ListWorkspacesResponse</a>
</li>
+ <li>
+ <a href="#bytebase.v1.RotateDirectorySyncTokenRequest"><span class="badge">M</span>RotateDirectorySyncTokenRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.RotateDirectorySyncTokenResponse"><span class="badge">M</span>RotateDirectorySyncTokenResponse</a>
+ </li>
+
<li>
<a href="#bytebase.v1.UpdateWorkspaceRequest"><span class="badge">M</span>UpdateWorkspaceRequest</a>
</li>
@@ -12974,13 +12982,6 @@ Requires TEAM or ENTERPRISE license. </p></td>
Requires ENTERPRISE license. </p></td>
</tr>
- <tr>
- <td>directory_sync_token</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The token for directory sync authentication. </p></td>
- </tr>
-
<tr>
<td>password_restriction</td>
<td><a href="#bytebase.v1.WorkspaceProfileSetting.PasswordRestriction">WorkspaceProfileSetting.PasswordRestriction</a></td>
@@ -13060,6 +13061,15 @@ connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —
omit the update mask path to leave the ceiling unset. </p></td>
</tr>
+ <tr>
+ <td>directory_sync_token_configured</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>Whether a directory sync token has been generated for this workspace.
+The token itself is never returned; this only lets the UI decide between
+offering &#34;generate&#34; and &#34;regenerate&#34;. </p></td>
+ </tr>
+
</tbody>
</table>
@@ -35164,6 +35174,55 @@ Use &#34;workspaces/-&#34; to get the current/default workspace. </p></td>
+ <h3 id="bytebase.v1.RotateDirectorySyncTokenRequest">RotateDirectorySyncTokenRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>name</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The workspace whose directory sync token is rotated.
+Format: workspaces/{workspace} </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.RotateDirectorySyncTokenResponse">RotateDirectorySyncTokenResponse</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>token</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The new token, in plaintext. This is the only time it is ever returned. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
<h3 id="bytebase.v1.UpdateWorkspaceRequest">UpdateWorkspaceRequest</h3>
<p></p>
@@ -35306,6 +35365,17 @@ caller is the last workspace admin.</p></td>
Permissions required: bb.workspaces.setIamPolicy</p></td>
</tr>
+ <tr>
+ <td>RotateDirectorySyncToken</td>
+ <td><a href="#bytebase.v1.RotateDirectorySyncTokenRequest">RotateDirectorySyncTokenRequest</a></td>
+ <td><a href="#bytebase.v1.RotateDirectorySyncTokenResponse">RotateDirectorySyncTokenResponse</a></td>
+ <td><p>Mints a new directory sync (SCIM) token, immediately invalidating the
+previous one. The plaintext token is returned exactly once and cannot be
+retrieved afterwards; only its hash is stored. Callers that lose it must
+rotate again and update their identity provider.
+Permissions required: bb.workspaces.rotateDirectorySyncToken</p></td>
+ </tr>
+
</tbody>
</table>
@@ -35394,6 +35464,16 @@ Permissions required: bb.workspaces.setIamPolicy</p></td>
</tr>
+
+
+ <tr>
+ <td>RotateDirectorySyncToken</td>
+ <td>POST</td>
+ <td>/v1/{name=workspaces/*}:rotateDirectorySyncToken</td>
+ <td>*</td>
+ </tr>
+
+
</tbody>
</table>
diff --git a/proto/store/store/setting.proto b/proto/store/store/setting.proto
index ca3db5a41a..ef069c7942 100644
--- a/proto/store/store/setting.proto
+++ b/proto/store/store/setting.proto
@@ -125,9 +125,6 @@ message WorkspaceProfileSetting {
// Requires ENTERPRISE license.
bool watermark = 14;
- // The token for directory sync authentication.
- string directory_sync_token = 15;
-
reserved 16;
message PasswordRestriction {
@@ -183,6 +180,11 @@ message WorkspaceProfileSetting {
// READ_WRITE for backward compatibility; DISABLED rejects all MCP
// connections. Enforced server-side by the /mcp endpoint.
MCPCapability mcp_capability = 26;
+
+ // Hex-encoded SHA-256 of the SCIM directory sync token. The plaintext is shown
+ // once at rotation and never stored. SHA-256 rather than a slow KDF because the
+ // token is 122 bits of crypto/rand, not a human-chosen secret.
+ string directory_sync_token_hash = 27;
}
message SQLEditorThemeSetting {
diff --git a/proto/v1/v1/setting_service.proto b/proto/v1/v1/setting_service.proto
index 3f5cd0c426..8214fa706f 100644
--- a/proto/v1/v1/setting_service.proto
+++ b/proto/v1/v1/setting_service.proto
@@ -228,9 +228,6 @@ message WorkspaceProfileSetting {
// Requires ENTERPRISE license.
bool watermark = 14;
- // The token for directory sync authentication.
- string directory_sync_token = 15;
-
reserved 16;
message PasswordRestriction {
@@ -305,6 +302,11 @@ message WorkspaceProfileSetting {
// connections. Writing MCP_CAPABILITY_UNSPECIFIED explicitly is rejected —
// omit the update mask path to leave the ceiling unset.
MCPCapability mcp_capability = 26;
+
+ // Whether a directory sync token has been generated for this workspace.
+ // The token itself is never returned; this only lets the UI decide between
+ // offering "generate" and "regenerate".
+ bool directory_sync_token_configured = 27 [(google.api.field_behavior) = OUTPUT_ONLY];
}
message SQLEditorThemeSetting {
diff --git a/proto/v1/v1/workspace_service.proto b/proto/v1/v1/workspace_service.proto
index 239ef54fb8..1f1ee9a099 100644
--- a/proto/v1/v1/workspace_service.proto
+++ b/proto/v1/v1/workspace_service.proto
@@ -3,7 +3,9 @@ syntax = "proto3";
package bytebase.v1;
import "google/api/annotations.proto";
+import "google/api/client.proto";
import "google/api/field_behavior.proto";
+import "google/api/resource.proto";
import "google/protobuf/field_mask.proto";
import "v1/annotation.proto";
import "v1/auth_service.proto";
@@ -81,6 +83,36 @@ service WorkspaceService {
option (bytebase.v1.auth_method) = IAM;
option (bytebase.v1.audit) = true;
}
+
+ // Mints a new directory sync (SCIM) token, immediately invalidating the
+ // previous one. The plaintext token is returned exactly once and cannot be
+ // retrieved afterwards; only its hash is stored. Callers that lose it must
+ // rotate again and update their identity provider.
+ // Permissions required: bb.workspaces.rotateDirectorySyncToken
+ rpc RotateDirectorySyncToken(RotateDirectorySyncTokenRequest) returns (RotateDirectorySyncTokenResponse) {
+ option (google.api.http) = {
+ post: "/v1/{name=workspaces/*}:rotateDirectorySyncToken"
+ body: "*"
+ };
+ option (google.api.method_signature) = "name";
+ option (bytebase.v1.permission) = "bb.workspaces.rotateDirectorySyncToken";
+ option (bytebase.v1.auth_method) = IAM;
+ option (bytebase.v1.audit) = true;
+ }
+}
+
+message RotateDirectorySyncTokenRequest {
+ // The workspace whose directory sync token is rotated.
+ // Format: workspaces/{workspace}
+ string name = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {type: "bytebase.com/Workspace"}
+ ];
+}
+
+message RotateDirectorySyncTokenResponse {
+ // The new token, in plaintext. This is the only time it is ever returned.
+ string token = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}
message ListWorkspacesRequest {}