Skip to content

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

fix: not require workspace in non-saas mode (#19831)

ecmadaof6c9a505b774
diff --git a/backend/api/v1/user_service.go b/backend/api/v1/user_service.go
index 493dd3032f..36d5267938 100644
--- a/backend/api/v1/user_service.go
+++ b/backend/api/v1/user_service.go
@@ -59,8 +59,13 @@ func (s *UserService) GetUser(ctx context.Context, request *connect.Request[v1pb
return nil, err
}
- workspaceID := common.GetWorkspaceIDFromContext(ctx)
- users, err := s.store.BatchGetUsersByEmails(ctx, workspaceID, []string{email})
+ // Only scope to workspace IAM in SaaS mode to prevent cross-workspace access.
+ // In non-SaaS mode, users may exist in the principal table before being added to IAM.
+ var workspace string
+ if s.profile.SaaS {
+ workspace = common.GetWorkspaceIDFromContext(ctx)
+ }
+ users, err := s.store.BatchGetUsersByEmails(ctx, workspace, []string{email})
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get user"))
}
@@ -89,8 +94,12 @@ func (s *UserService) BatchGetUsers(ctx context.Context, request *connect.Reques
emails = append(emails, email)
}
- // Batch get from store — scoped to the caller's workspace.
- users, err := s.store.BatchGetUsersByEmails(ctx, common.GetWorkspaceIDFromContext(ctx), emails)
+ // Only scope to workspace IAM in SaaS mode.
+ var workspace string
+ if s.profile.SaaS {
+ workspace = common.GetWorkspaceIDFromContext(ctx)
+ }
+ users, err := s.store.BatchGetUsersByEmails(ctx, workspace, emails)
if err != nil {
return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to batch get users"))
}
diff --git a/backend/store/principal.go b/backend/store/principal.go
index f42131a705..b75f6b8684 100644
--- a/backend/store/principal.go
+++ b/backend/store/principal.go
@@ -96,7 +96,10 @@ func (s *Store) BatchGetUsersByEmails(ctx context.Context, workspace string, ema
var users []*UserMessage
- q := qb.Q().Space(`
+ var q *qb.Query
+ if workspace != "" {
+ // SaaS mode: scope to workspace IAM members only.
+ q = qb.Q().Space(`
SELECT p.id, p.deleted, p.email, p.name, p.password_hash, p.mfa_config, p.phone, p.profile, p.created_at
FROM principal p
JOIN policy pol ON pol.workspace = ? AND pol.resource_type = 'WORKSPACE' AND pol.type = 'IAM'
@@ -109,6 +112,15 @@ func (s *Store) BatchGetUsersByEmails(ctx context.Context, workspace string, ema
)
ORDER BY p.created_at ASC
`, workspace, normalizedEmails, common.AllUsers)
+ } else {
+ // Non-SaaS mode: no workspace scoping.
+ q = qb.Q().Space(`
+ SELECT p.id, p.deleted, p.email, p.name, p.password_hash, p.mfa_config, p.phone, p.profile, p.created_at
+ FROM principal p
+ WHERE p.email = ANY(?)
+ ORDER BY p.created_at ASC
+ `, normalizedEmails)
+ }
sqlStr, args, err := q.ToSQL()
if err != nil {
return nil, errors.Wrapf(err, "failed to build sql")
diff --git a/frontend/src/react/pages/settings/IDPDetailPage.tsx b/frontend/src/react/pages/settings/IDPDetailPage.tsx
index 2484231b66..02293ef62b 100644
--- a/frontend/src/react/pages/settings/IDPDetailPage.tsx
+++ b/frontend/src/react/pages/settings/IDPDetailPage.tsx
@@ -1493,9 +1493,7 @@ export function IDPDetailPage() {
{/* General Section */}
<div className="pb-6 lg:flex">
<div className="text-left lg:w-1/4">
- <h1 className="text-3xl font-bold text-gray-900">
- {t("common.general")}
- </h1>
+ <h1 className="text-2xl font-bold">{t("common.general")}</h1>
</div>
<div className="flex-1 mt-4 lg:px-4 lg:mt-0 flex flex-col gap-y-6">
<div>
@@ -1514,7 +1512,7 @@ export function IDPDetailPage() {
</div>
<div>
- <p className="text-base font-semibold text-gray-800 mb-2">
+ <p className="text-base font-semibold mb-2">
{t("settings.sso.form.name")}{" "}
<span className="text-error">*</span>
</p>
@@ -1559,7 +1557,7 @@ export function IDPDetailPage() {
{/* Configuration Section */}
<div className="py-6 lg:flex">
<div className="text-left lg:w-1/4">
- <h1 className="text-3xl font-bold text-gray-900">
+ <h1 className="text-2xl font-bold">
{t("settings.sso.form.configuration")}
</h1>
<p className="text-base text-gray-600 mt-3">
@@ -1585,7 +1583,7 @@ export function IDPDetailPage() {
{/* User Information Mapping Section */}
<div className="py-6 lg:flex">
<div className="text-left lg:w-1/4">
- <h1 className="text-3xl font-bold text-gray-900">
+ <h1 className="text-2xl font-bold">
{t("settings.sso.form.user-information-mapping")}
</h1>
<p className="text-base text-gray-600 mt-3">
diff --git a/frontend/src/react/pages/settings/general/AIAugmentationSection.tsx b/frontend/src/react/pages/settings/general/AIAugmentationSection.tsx
index c4ba972801..a56aace7c4 100644
--- a/frontend/src/react/pages/settings/general/AIAugmentationSection.tsx
+++ b/frontend/src/react/pages/settings/general/AIAugmentationSection.tsx
@@ -238,7 +238,7 @@ export const AIAugmentationSection = forwardRef<
disabled={!canEdit}
onChange={(e) => toggleEnabled(e.target.checked)}
/>
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t(
"settings.general.workspace.ai-assistant.enable-ai-assistant"
)}
@@ -263,7 +263,7 @@ export const AIAugmentationSection = forwardRef<
{/* Provider */}
<div>
<label className="flex items-center gap-x-2 mb-2">
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t(
"settings.general.workspace.ai-assistant.provider.self"
)}
@@ -305,7 +305,7 @@ export const AIAugmentationSection = forwardRef<
{/* API Key */}
<div>
<label className="flex items-center gap-x-2">
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t(
"settings.general.workspace.ai-assistant.api-key.self"
)}
@@ -353,7 +353,7 @@ export const AIAugmentationSection = forwardRef<
{/* Endpoint */}
<div>
<label className="flex items-center gap-x-2">
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t(
"settings.general.workspace.ai-assistant.endpoint.self"
)}
@@ -378,7 +378,7 @@ export const AIAugmentationSection = forwardRef<
{/* Model */}
<div>
<label className="flex items-center gap-x-2">
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t(
"settings.general.workspace.ai-assistant.model.self"
)}
diff --git a/frontend/src/react/pages/settings/general/AccountSection.tsx b/frontend/src/react/pages/settings/general/AccountSection.tsx
index 3dd81ef1b8..3559b7ed14 100644
--- a/frontend/src/react/pages/settings/general/AccountSection.tsx
+++ b/frontend/src/react/pages/settings/general/AccountSection.tsx
@@ -388,7 +388,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(
}))
}
/>
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t("settings.general.workspace.disallow-signup.enable")}
</span>
<FeatureBadge
@@ -407,7 +407,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(
{/* Sub-section 2: Password Restriction */}
<div className="mt-4 lg:mt-0">
- <p className="font-medium flex flex-row justify-start items-center mb-2 gap-x-2">
+ <p className="text-base font-semibold flex flex-row justify-start items-center mb-2 gap-x-2">
{t("settings.general.workspace.password-restriction.self")}
<FeatureBadge
feature={PlanFeature.FEATURE_PASSWORD_RESTRICTIONS}
@@ -595,7 +595,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(
}))
}
/>
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t("settings.general.workspace.require-2fa.enable")}
</span>
<FeatureBadge feature={PlanFeature.FEATURE_TWO_FA} />
@@ -625,7 +625,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(
}))
}
/>
- <span className="font-medium flex items-center gap-x-2">
+ <span className="text-base font-semibold flex items-center gap-x-2">
{t(
"settings.general.workspace.disallow-password-signin.enable"
)}
@@ -659,7 +659,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(
{/* Sub-section 5: Token Duration */}
{/* Access Token Duration */}
<div className="mb-7 mt-4 lg:mt-0">
- <p className="font-medium flex flex-row justify-start items-center gap-x-2">
+ <p className="text-base font-semibold flex flex-row justify-start items-center gap-x-2">
<span>
{t("settings.general.workspace.access-token-duration.self")}
</span>
@@ -733,7 +733,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(
{/* Refresh Token Duration */}
<div className="mb-7 mt-4 lg:mt-0">
- <p className="font-medium flex flex-row justify-start items-center gap-x-2">
+ <p className="text-base font-semibold flex flex-row justify-start items-center gap-x-2">
<span>
{t("settings.general.workspace.refresh-token-duration.self")}
</span>
@@ -812,7 +812,7 @@ export const AccountSection = forwardRef<SectionHandle, AccountSectionProps>(
{/* Inactive Session Timeout */}
<div className="mt-4 lg:mt-0">
- <p className="font-medium flex flex-row justify-start items-center gap-x-2">
+ <p className="text-base font-semibold flex flex-row justify-start items-center gap-x-2">
<span>
{t(
"settings.general.workspace.inactive-session-timeout.self"
diff --git a/frontend/src/react/pages/settings/general/AnnouncementSection.tsx b/frontend/src/react/pages/settings/general/AnnouncementSection.tsx
index 7f9fd8a179..408462d6d9 100644
--- a/frontend/src/react/pages/settings/general/AnnouncementSection.tsx
+++ b/frontend/src/react/pages/settings/general/AnnouncementSection.tsx
@@ -123,7 +123,7 @@ export const AnnouncementSection = forwardRef<
<div className="mt-5 lg:mt-0">
{/* Alert level radio */}
<label className="flex items-center gap-x-2">
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t(
"settings.general.workspace.announcement-alert-level.description"
)}
@@ -162,7 +162,7 @@ export const AnnouncementSection = forwardRef<
{/* Announcement text */}
<label className="flex items-center mt-2 gap-x-2">
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t("settings.general.workspace.announcement-text.self")}
</span>
</label>
@@ -183,13 +183,13 @@ export const AnnouncementSection = forwardRef<
{/* Extra link */}
<label className="flex items-center py-2 gap-x-2">
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t("settings.general.workspace.extra-link.self")}
</span>
</label>
<Input
value={state.link}
- className="mb-5 w-full"
+ className="w-full"
placeholder={t(
"settings.general.workspace.extra-link.placeholder"
)}
diff --git a/frontend/src/react/pages/settings/general/AuditLogSection.tsx b/frontend/src/react/pages/settings/general/AuditLogSection.tsx
index 6fb9e8c106..826193d3c7 100644
--- a/frontend/src/react/pages/settings/general/AuditLogSection.tsx
+++ b/frontend/src/react/pages/settings/general/AuditLogSection.tsx
@@ -102,7 +102,7 @@ export const AuditLogSection = forwardRef<SectionHandle, AuditLogSectionProps>(
}
/>
<div className="flex flex-col gap-1">
- <div className="textinfo">
+ <div className="text-base font-semibold">
{t("settings.general.workspace.audit-log-stdout.enable")}
</div>
<div className="textinfolabel">
@@ -126,7 +126,7 @@ export const AuditLogSection = forwardRef<SectionHandle, AuditLogSectionProps>(
}
/>
<div className="flex flex-col gap-1">
- <div className="textinfo">
+ <div className="text-base font-semibold">
{t("settings.general.workspace.enable-debug.enable")}
</div>
</div>
diff --git a/frontend/src/react/pages/settings/general/BrandingSection.tsx b/frontend/src/react/pages/settings/general/BrandingSection.tsx
index a0ef9f594d..054bc46b14 100644
--- a/frontend/src/react/pages/settings/general/BrandingSection.tsx
+++ b/frontend/src/react/pages/settings/general/BrandingSection.tsx
@@ -185,7 +185,7 @@ export const BrandingSection = forwardRef<SectionHandle, BrandingSectionProps>(
<div className="flex-1 mt-4 lg:px-4 lg:mt-0 flex flex-col gap-y-6">
{/* Workspace ID */}
<div>
- <label className="font-medium">
+ <label className="text-base font-semibold">
{t("settings.general.workspace.id")}
</label>
<Input value={workspaceID} disabled className="mt-1" />
@@ -193,7 +193,7 @@ export const BrandingSection = forwardRef<SectionHandle, BrandingSectionProps>(
{/* Workspace Title */}
<div>
- <label className="font-medium">
+ <label className="text-base font-semibold">
{t("settings.general.workspace.title")}
</label>
<Input
@@ -207,7 +207,7 @@ export const BrandingSection = forwardRef<SectionHandle, BrandingSectionProps>(
{/* Logo */}
<div>
<div className="mb-4 mt-4 lg:mt-0">
- <div className="flex items-center gap-x-2 font-medium">
+ <div className="flex items-center gap-x-2 text-base font-semibold">
{t("settings.general.workspace.logo")}
<FeatureBadge
feature={PlanFeature.FEATURE_CUSTOM_LOGO}
diff --git a/frontend/src/react/pages/settings/general/GeneralSection.tsx b/frontend/src/react/pages/settings/general/GeneralSection.tsx
index d6ad2095c8..6806fdb56a 100644
--- a/frontend/src/react/pages/settings/general/GeneralSection.tsx
+++ b/frontend/src/react/pages/settings/general/GeneralSection.tsx
@@ -129,7 +129,7 @@ export const GeneralSection = forwardRef<SectionHandle, GeneralSectionProps>(
<div className="flex-1 mt-4 lg:px-4 lg:mt-0 flex flex-col gap-y-6">
{/* Database change mode */}
<div>
- <div className="mb-4 font-medium">
+ <div className="mb-4 text-base font-semibold">
{t("settings.general.workspace.default-landing-page.self")}
</div>
<div className="w-full flex flex-col gap-4">
@@ -150,7 +150,7 @@ export const GeneralSection = forwardRef<SectionHandle, GeneralSectionProps>(
}
/>
<div className="flex flex-col gap-1">
- <div className="textinfo">
+ <div className="textinfo font-semibold">
{t(
"settings.general.workspace.default-landing-page.workspace.self"
)}
@@ -179,7 +179,7 @@ export const GeneralSection = forwardRef<SectionHandle, GeneralSectionProps>(
}
/>
<div className="flex flex-col gap-1">
- <div className="textinfo">
+ <div className="textinfo font-semibold">
{t(
"settings.general.workspace.default-landing-page.sql-editor.self"
)}
@@ -197,7 +197,7 @@ export const GeneralSection = forwardRef<SectionHandle, GeneralSectionProps>(
{/* External URL */}
<div>
<label className="flex items-center gap-x-2">
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t("settings.general.workspace.external-url.self")}
</span>
</label>
@@ -221,7 +221,7 @@ export const GeneralSection = forwardRef<SectionHandle, GeneralSectionProps>(
)}
<Input
value={state.externalUrl}
- className="mb-4 w-full"
+ className="w-full"
disabled={!canEdit || isSaaSMode || externalUrlFromFlag}
onChange={(e) =>
setState((s) => ({ ...s, externalUrl: e.target.value }))
diff --git a/frontend/src/react/pages/settings/general/ProductImprovementSection.tsx b/frontend/src/react/pages/settings/general/ProductImprovementSection.tsx
index 0a6a4c6d84..0ad0e07d31 100644
--- a/frontend/src/react/pages/settings/general/ProductImprovementSection.tsx
+++ b/frontend/src/react/pages/settings/general/ProductImprovementSection.tsx
@@ -86,7 +86,7 @@ export const ProductImprovementSection = forwardRef<
}
/>
<div className="flex flex-col gap-1">
- <div className="textinfo">
+ <div className="text-base font-semibold">
{t("settings.general.workspace.product-improvement.participate")}
</div>
<div className="textinfolabel">
diff --git a/frontend/src/react/pages/settings/general/SQLEditorSection.tsx b/frontend/src/react/pages/settings/general/SQLEditorSection.tsx
index dc15d3ee17..c0cebbfcf1 100644
--- a/frontend/src/react/pages/settings/general/SQLEditorSection.tsx
+++ b/frontend/src/react/pages/settings/general/SQLEditorSection.tsx
@@ -225,7 +225,7 @@ export const SQLEditorSection = forwardRef<
onChange={(e) => handleToggle("disableExport", !e.target.checked)}
className="h-4 w-4"
/>
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t("settings.general.workspace.data-export")}
</span>
<FeatureBadge feature={PlanFeature.FEATURE_QUERY_POLICY} />
@@ -244,7 +244,7 @@ export const SQLEditorSection = forwardRef<
}
className="h-4 w-4"
/>
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t("settings.general.workspace.data-copy")}
</span>
<FeatureBadge feature={PlanFeature.FEATURE_RESTRICT_COPYING_DATA} />
@@ -264,7 +264,7 @@ export const SQLEditorSection = forwardRef<
}
className="h-4 w-4"
/>
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t("settings.general.workspace.allow-admin-data-source.self")}
</span>
<FeatureBadge feature={PlanFeature.FEATURE_QUERY_POLICY} />
@@ -284,7 +284,7 @@ export const SQLEditorSection = forwardRef<
display="block"
>
<div>
- <p className="font-medium flex flex-row justify-start items-center">
+ <p className="text-base font-semibold flex flex-row justify-start items-center">
<span className="mr-2">
{t("settings.general.workspace.maximum-sql-result.size.self")}
</span>
@@ -323,7 +323,7 @@ export const SQLEditorSection = forwardRef<
{/* Maximum SQL Result Rows */}
<PermissionGuard permissions={["bb.policies.update"]} display="block">
<div>
- <p className="font-medium flex flex-row justify-start items-center">
+ <p className="text-base font-semibold flex flex-row justify-start items-center">
<span className="mr-2">
{t("settings.general.workspace.maximum-sql-result.rows.self")}
</span>
@@ -361,7 +361,7 @@ export const SQLEditorSection = forwardRef<
display="block"
>
<div>
- <p className="font-medium flex flex-row justify-start items-center">
+ <p className="text-base font-semibold flex flex-row justify-start items-center">
<span className="mr-2">
{t("settings.general.workspace.query-data-policy.timeout.self")}
</span>
diff --git a/frontend/src/react/pages/settings/general/SecuritySection.tsx b/frontend/src/react/pages/settings/general/SecuritySection.tsx
index b9fa9e949a..6b4d7eb389 100644
--- a/frontend/src/react/pages/settings/general/SecuritySection.tsx
+++ b/frontend/src/react/pages/settings/general/SecuritySection.tsx
@@ -230,7 +230,7 @@ export const SecuritySection = forwardRef<SectionHandle, SecuritySectionProps>(
}))
}
/>
- <span className="font-medium">
+ <span className="text-base font-semibold">
{t("settings.general.workspace.watermark.enable")}
</span>
<FeatureBadge feature={PlanFeature.FEATURE_WATERMARK} />
@@ -242,7 +242,7 @@ export const SecuritySection = forwardRef<SectionHandle, SecuritySectionProps>(
{/* Maximum Role Expiration */}
<div>
- <p className="font-medium flex flex-row justify-start items-center">
+ <p className="text-base font-semibold flex flex-row justify-start items-center">
<span className="mr-2">
{t("settings.general.workspace.maximum-role-expiration.self")}
</span>
@@ -304,7 +304,7 @@ export const SecuritySection = forwardRef<SectionHandle, SecuritySectionProps>(
<div>
<h3
id="domain-restriction"
- className="font-medium flex flex-row justify-start items-center"
+ className="text-base font-semibold flex flex-row justify-start items-center"
>
<span className="mr-2">
{t("settings.general.workspace.domain-restriction.self")}
@@ -366,7 +366,7 @@ export const SecuritySection = forwardRef<SectionHandle, SecuritySectionProps>(
}
/>
<div>
- <div className="font-medium flex items-center gap-x-2">
+ <div className="text-base font-semibold flex items-center gap-x-2">
{t(
"settings.general.workspace.domain-restriction.members-restriction.self"
)}