Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(instance): unify authentication method and password source selection (#21454)
p0nyd8424d0304ff
diff --git a/docs/agents/frontend-ux.md b/docs/agents/frontend-ux.mdindex 980dbca946..2581d8000f 100644--- a/docs/agents/frontend-ux.md+++ b/docs/agents/frontend-ux.md@@ -207,12 +207,12 @@ third column for section titles.before the field itself stacks.- Keep descriptions and validation beside the control they explain. Associatelabels and radio groups with accessible names in both layouts.-- Put choices that determine subsequent fields first. Keep authentication,- password-source, and synchronization choices visible in a- `SegmentedControl`. Longer provider labels MAY wrap within the control when- every segment remains distinct and usable.-- A password source selector MAY share a row with direct password entry.- External sources reveal their configuration below. Preserve separate drafts+- Put choices that determine subsequent fields first. Use one `Select` dropdown+ combining authentication methods and password sources. Do not add a separate+ password-source selector. Keep synchronization choices visible in a+ `SegmentedControl`.+- Reveal the selected authentication method's fields below the selector.+ External sources reveal their configuration there. Preserve separate draftswhile switching sources, and submit only the active source. Reveal dependentTLS, SSH, IAM, and external-source configuration below its controllingchoice, using nested flow rather than a framed surface inside another frame.diff --git a/frontend/src/components/instance/DataSourceForm.tsx b/frontend/src/components/instance/DataSourceForm.tsxindex 3e68bc4a04..e18ab43617 100644--- a/frontend/src/components/instance/DataSourceForm.tsx+++ b/frontend/src/components/instance/DataSourceForm.tsx@@ -11,7 +11,6 @@ import {ResponsiveFormLayout,} from "@/components/ui/form";import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";-import { SegmentedControl } from "@/components/ui/segmented-control";import {Select,SelectContent,@@ -42,7 +41,10 @@ import {type TlsUpdateState,updateDataSourceSecret,} from "./common";-import { invalidateSourceDrafts } from "./data-source-drafts";+import {+ deactivateExternalSecret,+ invalidateSourceDrafts,+} from "./data-source-drafts";import { useInstanceFormContext } from "./InstanceFormContext";import { hasInfoContent, type InfoSection } from "./info-content";import { SshConnectionForm } from "./SshConnectionForm";@@ -300,23 +302,6 @@ export function DataSourceForm({? "KERBEROS": "PASSWORD";- const onHiveAuthenticationChange = (val: "KERBEROS" | "PASSWORD") => {- if (val === "KERBEROS") {- update({- saslConfig: create(SASLConfigSchema, {- mechanism: {- case: "krbConfig",- value: create(KerberosConfigSchema, {- kdcTransportProtocol: "tcp",- }),- },- }),- });- } else {- update({ saslConfig: undefined });- }- };-const supportedAuthenticationTypes = useMemo(() => {switch (basicInfo.engine) {case Engine.COSMOSDB:@@ -356,7 +341,8 @@ export function DataSourceForm({label: t("instance.password-type.google-iam"),},];- default:+ case Engine.MYSQL:+ case Engine.POSTGRES:return [{value: DataSource_AuthenticationType.PASSWORD,@@ -371,6 +357,13 @@ export function DataSourceForm({label: t("instance.password-type.aws-iam"),},];+ default:+ return [+ {+ value: DataSource_AuthenticationType.PASSWORD,+ label: t("instance.password-type.password"),+ },+ ];}}, [basicInfo.engine, t]);@@ -409,6 +402,7 @@ export function DataSourceForm({const ds = {...dataSource,authenticationType: DataSource_AuthenticationType.PASSWORD,+ ...(basicInfo.engine === Engine.HIVE ? { saslConfig: undefined } : {}),};const drafts =sourceDraftsRef.current.get(dataSource.id) ??@@ -593,13 +587,6 @@ export function DataSourceForm({basicInfo.engine !== Engine.DYNAMODB &&basicInfo.engine !== Engine.DATABRICKS;- const showAuthTypeRadio =- basicInfo.engine === Engine.MYSQL ||- basicInfo.engine === Engine.POSTGRES ||- basicInfo.engine === Engine.COSMOSDB ||- basicInfo.engine === Engine.MSSQL ||- basicInfo.engine === Engine.ELASTICSEARCH;-const isPasswordAuth =dataSource.authenticationType === DataSource_AuthenticationType.PASSWORD;const isAzureIAM =@@ -721,21 +708,6 @@ export function DataSourceForm({),}));- const passwordSourceControl = !showAuthTypeRadio && !hideAdvancedFeatures && (- <SegmentedControl- ariaLabel={t("instance.password-source.self")}- value={`secret:${passwordType}`}- onValueChange={(value) =>- changeSecretType(- Number(value.split(":")[1]) as DataSourceExternalSecret_SecretType- )- }- options={secretOptions}- disabled={!allowEdit}- size="sm"- />- );-const authenticationOptions = supportedAuthenticationTypes.flatMap((item) =>item.value === DataSource_AuthenticationType.PASSWORD? hideAdvancedFeatures@@ -743,11 +715,20 @@ export function DataSourceForm({: secretOptions: [{ value: `auth:${item.value}`, label: <>{item.label}</> }]);- const authenticationValue = isPasswordAuth- ? `secret:${passwordType}`- : `auth:${dataSource.authenticationType}`;-- const authenticationTypeControl = showAuthTypeRadio && (+ if (basicInfo.engine === Engine.HIVE) {+ authenticationOptions.push({+ value: "sasl:kerberos",+ label: <>{t("instance.kerberos")}</>,+ });+ }+ const authenticationValue =+ basicInfo.engine === Engine.HIVE && hiveAuthentication === "KERBEROS"+ ? "sasl:kerberos"+ : isPasswordAuth+ ? `secret:${passwordType}`+ : `auth:${dataSource.authenticationType}`;++ const authenticationTypeControl = showMainFields && (<FormFieldtitle={t("instance.authentication")}className="sm:col-span-3 sm:col-start-1"@@ -761,6 +742,18 @@ export function DataSourceForm({changeSecretType(Number(type) as DataSourceExternalSecret_SecretType);+ } else if (kind === "sasl") {+ onDataSourceChange({+ ...deactivateExternalSecret(dataSource, sourceDraftsRef.current),+ saslConfig: create(SASLConfigSchema, {+ mechanism: {+ case: "krbConfig",+ value: create(KerberosConfigSchema, {+ kdcTransportProtocol: "tcp",+ }),+ },+ }),+ });} else {update({authenticationType: Number(type) as DataSource_AuthenticationType,@@ -806,28 +799,6 @@ export function DataSourceForm({<>{!hideAuthentication && authenticationTypeControl}- {/* Hive authentication */}- {basicInfo.engine === Engine.HIVE && (- <div className="sm:col-span-3 sm:col-start-1">- <RadioGroup- className="textlabel gap-x-4"- value={hiveAuthentication}- onValueChange={(value) =>- onHiveAuthenticationChange(- value as typeof hiveAuthentication- )- }- >- <RadioGroupItem value="PASSWORD" disabled={!allowEdit}>- Plain Password- </RadioGroupItem>- <RadioGroupItem value="KERBEROS" disabled={!allowEdit}>- Kerberos- </RadioGroupItem>- </RadioGroup>- </div>- )}-{/* Kerberos config */}{dataSource.saslConfig?.mechanism?.case === "krbConfig" && (<FormField@@ -1175,7 +1146,6 @@ export function DataSourceForm({}><div className="flex flex-col gap-2">- {passwordSourceControl}<SecretInputresetKey={dataSource.id}aria-label={t("common.password")}@@ -1220,7 +1190,6 @@ export function DataSourceForm({/>}>- {passwordSourceControl}<ResponsiveFormLayout className="mt-2"><fieldsetclassName="flex flex-col gap-4 rounded-xs border border-control-border px-3 py-2"diff --git a/frontend/src/components/instance/data-source-drafts.test.ts b/frontend/src/components/instance/data-source-drafts.test.tsindex 5d7333b96f..43a320468c 100644--- a/frontend/src/components/instance/data-source-drafts.test.ts+++ b/frontend/src/components/instance/data-source-drafts.test.ts@@ -1,5 +1,13 @@+import { create } from "@bufbuild/protobuf";import { describe, expect, test } from "vitest";import {+ DataSourceExternalSecretSchema,+ DataSourceSchema,+ DataSourceExternalSecret_SecretType as SecretType,+} from "@/types/proto-es/v1/instance_service_pb";+import type { EditDataSource } from "./common";+import {+ deactivateExternalSecret,invalidateSourceDrafts,type SourceDraftState,} from "./data-source-drafts";@@ -31,3 +39,32 @@ describe("invalidateSourceDrafts", () => {expect(drafts).toHaveLength(0);});});++describe("deactivateExternalSecret", () => {+ test.each(["", "database/password"])(+ "keeps the provider draft out of the active data source (%s)",+ (secretName) => {+ const secret = create(DataSourceExternalSecretSchema, {+ secretType: SecretType.VAULT_KV_V2,+ secretName,+ });+ const source: EditDataSource = {+ ...create(DataSourceSchema, { id: "admin", externalSecret: secret }),+ pendingCreate: true,+ updatedPassword: "",+ updatedMasterPassword: "",+ updatedToken: "",+ };+ const drafts = new Map<string, Map<number, typeof secret>>();+ const inactive = deactivateExternalSecret(source, drafts);++ expect(inactive.externalSecret).toBeUndefined();+ expect(source.externalSecret).toBe(secret);+ expect(drafts.get("admin")?.get(SecretType.VAULT_KV_V2)).toBe(secret);+ expect(+ deactivateExternalSecret(inactive, drafts).externalSecret+ ).toBeUndefined();+ expect(drafts.get("admin")?.get(SecretType.VAULT_KV_V2)).toBe(secret);+ }+ );+});diff --git a/frontend/src/components/instance/data-source-drafts.ts b/frontend/src/components/instance/data-source-drafts.tsindex df6790bb23..f06370029c 100644--- a/frontend/src/components/instance/data-source-drafts.ts+++ b/frontend/src/components/instance/data-source-drafts.ts@@ -1,3 +1,5 @@+import type { EditDataSource } from "./common";+export type SourceDraftState = {instanceName: string | undefined;resetEvent: number;@@ -16,3 +18,21 @@ export function invalidateSourceDrafts<T>(}return next;}++export function deactivateExternalSecret(+ dataSource: EditDataSource,+ drafts: Map<+ string,+ Map<number, NonNullable<EditDataSource["externalSecret"]>>+ >+): EditDataSource {+ if (dataSource.externalSecret) {+ const sourceDrafts = drafts.get(dataSource.id) ?? new Map();+ sourceDrafts.set(+ dataSource.externalSecret.secretType,+ dataSource.externalSecret+ );+ drafts.set(dataSource.id, sourceDrafts);+ }+ return { ...dataSource, externalSecret: undefined };+}diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex d1ba6811ce..904d0c835c 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1208,6 +1208,7 @@},"instance-id": "Instance ID","instance-name": "Instance Name",+ "kerberos": "Kerberos","kerberos-instance-placeholder": "instance, optional","kerberos-kdc": "KDC","kerberos-kdc-host-placeholder": "KDC host",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 15d596ea6f..6970dc5339 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1208,6 +1208,7 @@},"instance-id": "ID de la instancia","instance-name": "Nombre de la instancia",+ "kerberos": "Kerberos","kerberos-instance-placeholder": "instance, opcional","kerberos-kdc": "KDC","kerberos-kdc-host-placeholder": "Host del KDC",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 4bd9b63f3d..31e8d1cb55 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -1208,6 +1208,7 @@},"instance-id": "インスタンスID","instance-name": "@:common.instance@:instance.name",+ "kerberos": "Kerberos","kerberos-instance-placeholder": "instance(任意)","kerberos-kdc": "KDC","kerberos-kdc-host-placeholder": "KDC ホスト",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 7a57d2f8f4..85ff254b39 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -1208,6 +1208,7 @@},"instance-id": "ID phiên bản","instance-name": "Tên phiên bản",+ "kerberos": "Kerberos","kerberos-instance-placeholder": "instance, tùy chọn","kerberos-kdc": "KDC","kerberos-kdc-host-placeholder": "Máy chủ KDC",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex d444776672..2e29cc2b46 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1208,6 +1208,7 @@},"instance-id": "实例 ID","instance-name": "实例名称",+ "kerberos": "Kerberos","kerberos-instance-placeholder": "instance,可选","kerberos-kdc": "KDC","kerberos-kdc-host-placeholder": "KDC 主机",