Skip to content

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

feat(frontend): standardize instance secret inputs (#21449)

p0nyfd380658b672
diff --git a/frontend/scripts/ui-guideline-legacy-debt.json b/frontend/scripts/ui-guideline-legacy-debt.json
index 20691114c2..8f21dd89a4 100644
--- a/frontend/scripts/ui-guideline-legacy-debt.json
+++ b/frontend/scripts/ui-guideline-legacy-debt.json
@@ -414,12 +414,6 @@
"token": "input",
"count": 1
},
- {
- "path": "src/components/instance/DataSourceForm.tsx",
- "rule": "no-native-control",
- "token": "textarea",
- "count": 1
- },
{
"path": "src/components/instance/DataSourceSection.tsx",
"rule": "no-native-control",
diff --git a/frontend/src/components/SecretInput.test.tsx b/frontend/src/components/SecretInput.test.tsx
new file mode 100644
index 0000000000..fcf4d08d07
--- /dev/null
+++ b/frontend/src/components/SecretInput.test.tsx
@@ -0,0 +1,94 @@
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { useState } from "react";
+import { afterEach, describe, expect, test, vi } from "vitest";
+import { SecretInput, SecretInputProvider, useHasInvalidSecretInputs } from "./SecretInput";
+vi.mock("react-i18next", () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+afterEach(cleanup);
+function Actions() {
+ const invalid = useHasInvalidSecretInputs();
+ return <button disabled={invalid}>Update</button>;
+}
+function Harness({ allowEmpty = true, multiline = false }: { allowEmpty?: boolean; multiline?: boolean }) {
+ const [value, setValue] = useState<string>();
+ return <SecretInputProvider><SecretInput aria-label="Credential" value={value} onValueChange={setValue} allowEmpty={allowEmpty} multiline={multiline} /><Actions /><output data-testid="value">{value === undefined ? "unchanged" : JSON.stringify(value)}</output></SecretInputProvider>;
+}
+const input = () => screen.getByLabelText("Credential") as HTMLInputElement;
+const type = (value: string) => fireEvent.change(input(), { target: { value } });
+describe("SecretInput", () => {
+ test("focus preserves the secret; typing replaces it without copying the mask", () => {
+ render(<Harness />);
+ expect(input().value).toBe("");
+ expect(input().placeholder).toBe("common.secret-input.unchanged");
+ fireEvent.focus(input());
+ expect(screen.getByTestId("value").textContent).toBe("unchanged");
+ type(" replacement ");
+ expect(input().value).toBe(" replacement ");
+ expect(input().type).toBe("password");
+ expect(screen.getByTestId("value").textContent).toBe('" replacement "');
+ expect(screen.queryByRole("button", { name: "common.done" })).toBeNull();
+ });
+ test("Clear explicitly empties an untouched secret without typing", () => {
+ render(<Harness />);
+ fireEvent.click(screen.getByRole("button", { name: "common.clear" }));
+ expect(screen.getByTestId("value").textContent).toBe('""');
+ expect(input().placeholder).toBe("");
+ expect(document.activeElement).toBe(input());
+ expect(screen.queryByRole("button", { name: "common.clear" })).toBeNull();
+ });
+ test("deleting in the empty stored-value input leaves it unchanged", () => {
+ render(<Harness />);
+ fireEvent.keyDown(input(), { key: "Backspace" });
+ expect(screen.getByTestId("value").textContent).toBe("unchanged");
+ });
+ test("clearing a required secret blocks Update until a replacement is entered", () => {
+ render(<Harness allowEmpty={false} />);
+ const update = screen.getByRole("button", { name: "Update" }) as HTMLButtonElement;
+ expect(update.disabled).toBe(false);
+ expect(screen.queryByRole("button", { name: "common.clear" })).toBeNull();
+ type("replacement");
+ type("");
+ expect(update.disabled).toBe(true);
+ expect(input().required).toBe(true);
+ type("replacement");
+ expect(update.disabled).toBe(false);
+ });
+ test("the eye reveals only a replacement and never submits", () => {
+ const submit = vi.fn();
+ render(<form onSubmit={submit}><Harness /></form>);
+ expect(screen.queryByRole("button", { name: "common.toggle-password-visibility" })).toBeNull();
+ type("replacement");
+ fireEvent.click(screen.getByRole("button", { name: "common.toggle-password-visibility" }));
+ expect(input().type).toBe("text");
+ expect(input().value).toBe("replacement");
+ expect(submit).not.toHaveBeenCalled();
+ });
+ test("form reset restores the stored mask and resets reveal state", () => {
+ const field = (value: string | undefined, key: number) => <SecretInputProvider resetKey={key}><SecretInput aria-label="Credential" value={value} onValueChange={vi.fn()} /><Actions /></SecretInputProvider>;
+ const view = render(field("replacement", 0));
+ fireEvent.click(screen.getByRole("button", { name: "common.toggle-password-visibility" }));
+ view.rerender(field(undefined, 1));
+ expect(input().value).toBe("");
+ expect(input().placeholder).toBe("common.secret-input.unchanged");
+ expect(input().type).toBe("password");
+ });
+ test("multiline replacements retain line breaks", () => {
+ render(<Harness multiline />);
+ expect(input().tagName).toBe("TEXTAREA");
+ type("first\nsecond\n");
+ expect(screen.getByTestId("value").textContent).toBe(JSON.stringify("first\nsecond\n"));
+ });
+ test("creation starts empty with a reveal control", () => {
+ const change = vi.fn();
+ render(<SecretInput aria-label="Credential" isCreating value="" onValueChange={change} />);
+ expect(input().placeholder).toBe("");
+ type("new password");
+ expect(change).toHaveBeenCalledWith("new password");
+ expect(screen.getByRole("button", { name: "common.toggle-password-visibility" })).toBeTruthy();
+ });
+ test("disabled secrets cannot be cleared", () => {
+ const change = vi.fn();
+ render(<SecretInput aria-label="Credential" disabled value={undefined} onValueChange={change} />);
+ fireEvent.click(screen.getByRole("button", { name: "common.clear" }));
+ expect(change).not.toHaveBeenCalled();
+ });
+});
diff --git a/frontend/src/components/SecretInput.tsx b/frontend/src/components/SecretInput.tsx
new file mode 100644
index 0000000000..7ab83e2404
--- /dev/null
+++ b/frontend/src/components/SecretInput.tsx
@@ -0,0 +1,209 @@
+import { Eye, EyeOff, X } from "lucide-react";
+import {
+ type AriaAttributes,
+ type ChangeEvent,
+ createContext,
+ type DragEvent,
+ type ReactNode,
+ useCallback,
+ useContext,
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+} from "react";
+import { useTranslation } from "react-i18next";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Textarea } from "@/components/ui/textarea";
+import { cn } from "@/lib/utils";
+
+const SecretEditingContext = createContext<{
+ register?: () => () => void;
+ invalid: boolean;
+ resetKey?: string | number;
+}>({ invalid: false });
+
+/** Coordinates invalid secret replacements with the enclosing form. */
+export function SecretInputProvider({
+ children,
+ resetKey,
+}: {
+ children: ReactNode;
+ resetKey?: string | number;
+}) {
+ const [editors, setEditors] = useState<Set<symbol>>(() => new Set());
+ const register = useCallback(() => {
+ const id = Symbol();
+ setEditors((current) => new Set(current).add(id));
+ return () =>
+ setEditors((current) => {
+ const next = new Set(current);
+ next.delete(id);
+ return next;
+ });
+ }, []);
+ const value = useMemo(
+ () => ({ register, invalid: editors.size > 0, resetKey }),
+ [register, editors.size, resetKey]
+ );
+ return (
+ <SecretEditingContext.Provider value={value}>
+ {children}
+ </SecretEditingContext.Provider>
+ );
+}
+
+export const useHasInvalidSecretInputs = () =>
+ useContext(SecretEditingContext).invalid;
+
+export interface SecretInputProps extends AriaAttributes {
+ id?: string;
+ className?: string;
+ /** Undefined preserves the stored value; an empty string explicitly clears it. */
+ value: string | undefined;
+ onValueChange: (value: string) => void;
+ isCreating?: boolean;
+ disabled?: boolean;
+ multiline?: boolean;
+ allowEmpty?: boolean;
+ placeholder?: string;
+ /** Change when the edited resource changes or its draft is discarded. */
+ resetKey?: string | number;
+}
+
+export function SecretInput(props: SecretInputProps) {
+ const context = useContext(SecretEditingContext);
+ return (
+ <SecretInputControl
+ key={`${context.resetKey ?? ""}:${props.resetKey ?? ""}`}
+ {...props}
+ />
+ );
+}
+
+function SecretInputControl({
+ value,
+ onValueChange,
+ isCreating = false,
+ disabled = false,
+ multiline = false,
+ allowEmpty = true,
+ placeholder,
+ className,
+ resetKey: _resetKey,
+ id,
+ ...aria
+}: SecretInputProps) {
+ const { t } = useTranslation();
+ const { register } = useContext(SecretEditingContext);
+ const [showPassword, setShowPassword] = useState(false);
+ const fileReadRef = useRef(0);
+ const inputRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null);
+ const unchanged = !isCreating && value === undefined;
+ const showReveal = !unchanged && !multiline;
+ const showClear = allowEmpty && (unchanged || !!value);
+ const inputPadding =
+ showReveal && showClear
+ ? "pr-20"
+ : showReveal || showClear
+ ? "pr-10"
+ : undefined;
+
+ useEffect(() => {
+ if (!disabled && !allowEmpty && value === "") return register?.();
+ }, [disabled, allowEmpty, value, register]);
+ useEffect(() => {
+ setShowPassword(false);
+ return () => {
+ fileReadRef.current++;
+ };
+ }, [disabled, unchanged]);
+
+ const change = (next: string) => {
+ if (disabled) return;
+ fileReadRef.current++;
+ onValueChange(next);
+ };
+ const onDrop = (event: DragEvent<HTMLTextAreaElement>) => {
+ event.preventDefault();
+ if (disabled) return;
+ const file = event.dataTransfer.files[0];
+ if (!file) return;
+ const request = ++fileReadRef.current;
+ const reader = new FileReader();
+ reader.onload = () => {
+ if (request === fileReadRef.current && typeof reader.result === "string")
+ change(reader.result);
+ };
+ reader.readAsText(file);
+ };
+ const inputProps = {
+ ...aria,
+ id,
+ disabled,
+ value: value ?? "",
+ placeholder: unchanged ? t("common.secret-input.unchanged") : placeholder,
+ ref: (element: HTMLInputElement | HTMLTextAreaElement | null) => {
+ inputRef.current = element;
+ },
+ required: !allowEmpty && !unchanged,
+ autoComplete: "new-password",
+ spellCheck: false,
+ onChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) =>
+ change(event.target.value),
+ };
+
+ return (
+ <div className={cn("relative min-w-0", className)}>
+ {multiline ? (
+ <Textarea
+ {...inputProps}
+ className={inputPadding}
+ onDragOver={(event) => event.preventDefault()}
+ onDrop={onDrop}
+ />
+ ) : (
+ <Input
+ {...inputProps}
+ className={inputPadding}
+ type={!unchanged && showPassword ? "text" : "password"}
+ />
+ )}
+ {(showReveal || showClear) && (
+ <div className="absolute right-1 top-1 flex">
+ {showReveal && (
+ <Button
+ type="button"
+ appearance="secondary"
+ size="sm"
+ disabled={disabled}
+ aria-label={t("common.toggle-password-visibility")}
+ aria-pressed={showPassword}
+ onClick={() => setShowPassword((visible) => !visible)}
+ >
+ {showPassword ? <Eye size={16} /> : <EyeOff size={16} />}
+ </Button>
+ )}
+ {showClear && (
+ <Button
+ type="button"
+ appearance="secondary"
+ size="sm"
+ disabled={disabled}
+ aria-label={t("common.clear")}
+ title={t("common.clear")}
+ onClick={() => {
+ change("");
+ setShowPassword(false);
+ inputRef.current?.focus();
+ }}
+ >
+ <X size={16} />
+ </Button>
+ )}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/frontend/src/components/instance/DataSourceForm.tsx b/frontend/src/components/instance/DataSourceForm.tsx
index 12b0a95e80..c033c71d90 100644
--- a/frontend/src/components/instance/DataSourceForm.tsx
+++ b/frontend/src/components/instance/DataSourceForm.tsx
@@ -4,7 +4,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { LearnMoreLink } from "@/components/LearnMoreLink";
import { Button } from "@/components/ui/button";
-import { Checkbox } from "@/components/ui/checkbox";
import {
FormControlGroup,
FormControlRow,
@@ -42,7 +41,12 @@ import {
import { onlyAllowNumber } from "@/utils";
import { CreateDataSourceExample } from "./CreateDataSourceExample";
import { CredentialSourceForm } from "./CredentialSourceForm";
-import type { EditDataSource, TlsUpdateState } from "./common";
+import {
+ type EditDataSource,
+ getDataSourceSecretValue,
+ type TlsUpdateState,
+ updateDataSourceSecret,
+} from "./common";
import { invalidateSourceDrafts } from "./data-source-drafts";
import { useInstanceFormContext } from "./InstanceFormContext";
import { hasInfoContent, type InfoSection } from "./info-content";
@@ -66,6 +70,7 @@ import {
import {
ValidationField as FormField,
ValidationInput as Input,
+ ValidationSecretInput as SecretInput,
ValidationProvider,
} from "./ValidationField";
@@ -146,44 +151,19 @@ export function RedisSentinelFields({
/>
</FormField>
<FormField title={t("instance.master-password")}>
- <div>
- {!isCreating && allowUsingEmptyPassword && (
- <label className="flex items-center gap-x-1.5 mb-2 text-sm cursor-pointer">
- <Checkbox
- checked={dataSource.useEmptyMasterPassword ?? false}
- disabled={!allowEdit}
- onCheckedChange={(checked) => {
- update({
- useEmptyMasterPassword: checked,
- updatedMasterPassword: checked
- ? ""
- : dataSource.updatedMasterPassword,
- });
- }}
- />
- {t("instance.no-password")}
- </label>
- )}
- <Input
- type="password"
- className="w-full"
- autoComplete="off"
- placeholder={
- dataSource.useEmptyMasterPassword
- ? t("instance.no-password")
- : t("instance.password-write-only")
- }
- disabled={!allowEdit || !!dataSource.useEmptyMasterPassword}
- value={
- dataSource.useEmptyMasterPassword
- ? ""
- : dataSource.updatedMasterPassword
- }
- onChange={(e) =>
- update({ updatedMasterPassword: e.target.value.trim() })
- }
- />
- </div>
+ <SecretInput
+ resetKey={dataSource.id}
+ aria-label={t("instance.master-password")}
+ value={getDataSourceSecretValue(dataSource, "masterPassword")}
+ isCreating={isCreating || dataSource.pendingCreate}
+ disabled={!allowEdit}
+ allowEmpty={allowUsingEmptyPassword}
+ onValueChange={(value) =>
+ onDataSourceChange(
+ updateDataSourceSecret(dataSource, "masterPassword", value)
+ )
+ }
+ />
</FormField>
</>
);
@@ -532,13 +512,6 @@ export function DataSourceForm({
onDataSourceChange(ds);
};
- const toggleUseEmptyPassword = (on: boolean) => {
- update({
- useEmptyPassword: on,
- updatedPassword: on ? "" : dataSource.updatedPassword,
- });
- };
-
const handleHostInput = (value: string) => {
if (dataSource.type === DataSourceType.READ_ONLY) {
if (!hasReadonlyReplicaFeature) {
@@ -580,7 +553,12 @@ export function DataSourceForm({
sshPrivateKey: string;
}>
) => {
- update(value);
+ let next = { ...dataSource, ...value };
+ for (const field of ["sshPassword", "sshPrivateKey"] as const) {
+ if (value[field] !== undefined)
+ next = updateDataSourceSecret(next, field, value[field]);
+ }
+ onDataSourceChange(next);
};
const addNewParameter = () => {
@@ -1241,51 +1219,38 @@ export function DataSourceForm({
DataSourceExternalSecret_SecretType.SECRET_TYPE_UNSPECIFIED && (
<FormField
title={<>{t("common.password")}</>}
- description={t(
- "instance.password-source.stored-in-bytebase"
- )}
+ description={
+ !hideAdvancedFeatures
+ ? t(
+ "instance.password-source.stored-in-bytebase"
+ )
+ : undefined
+ }
>
- <div>
- {!isCreating && allowUsingEmptyPassword && (
- <label className="flex items-center gap-x-1.5 mb-2 text-sm cursor-pointer">
- <Checkbox
- checked={
- dataSource.useEmptyPassword ?? false
- }
- disabled={!allowEdit}
- onCheckedChange={(checked) =>
- toggleUseEmptyPassword(checked)
- }
- />
- {t("instance.no-password")}
- </label>
- )}
- <div className="flex flex-col gap-2">
- {passwordSourceControl}
- <Input
- type="password"
- className="min-w-40 flex-1"
- autoComplete="off"
- placeholder={
- dataSource.useEmptyPassword
- ? t("instance.no-password")
- : t("instance.password-write-only")
- }
- disabled={
- !allowEdit || !!dataSource.useEmptyPassword
- }
- value={
- dataSource.useEmptyPassword
- ? ""
- : dataSource.updatedPassword
- }
- onChange={(e) =>
- update({
- updatedPassword: e.target.value.trim(),
- })
- }
- />
- </div>
+ <div className="flex flex-col gap-2">
+ {passwordSourceControl}
+ <SecretInput
+ resetKey={dataSource.id}
+ aria-label={t("common.password")}
+ value={getDataSourceSecretValue(
+ dataSource,
+ "password"
+ )}
+ isCreating={
+ isCreating || dataSource.pendingCreate
+ }
+ disabled={!allowEdit}
+ allowEmpty={allowUsingEmptyPassword}
+ onValueChange={(value) =>
+ onDataSourceChange(
+ updateDataSourceSecret(
+ dataSource,
+ "password",
+ value
+ )
+ )
+ }
+ />
</div>
</FormField>
)}
@@ -1988,6 +1953,7 @@ export function DataSourceForm({
{basicInfo.engine === Engine.SNOWFLAKE && (
<>
<FormField
+ validationField="authenticationPrivateKey"
className="sm:col-span-3 sm:col-start-1"
title={<>{t("data-source.ssh.private-key")}</>}
>
@@ -2000,13 +1966,25 @@ export function DataSourceForm({
className="text-sm text-accent"
/>
</div>
- <textarea
- value={dataSource.authenticationPrivateKey ?? ""}
+ <SecretInput
+ resetKey={dataSource.id}
+ aria-label={t("data-source.ssh.private-key")}
+ value={getDataSourceSecretValue(
+ dataSource,
+ "authenticationPrivateKey"
+ )}
+ isCreating={isCreating || dataSource.pendingCreate}
disabled={!allowEdit}
- className="w-full h-32 whitespace-pre-wrap rounded-sm border border-control-border p-2 text-sm font-mono"
- placeholder={`-----BEGIN PRIVATE KEY-----\nMIIEvQ...\n-----END PRIVATE KEY-----`}
- onChange={(e) =>
- update({ authenticationPrivateKey: e.target.value })
+ multiline
+ allowEmpty={false}
+ onValueChange={(value) =>
+ onDataSourceChange(
+ updateDataSourceSecret(
+ dataSource,
+ "authenticationPrivateKey",
+ value
+ )
+ )
}
/>
</FormField>
@@ -2017,20 +1995,23 @@ export function DataSourceForm({
<>{t("data-source.private-key-passphrase-tip")}</>
}
>
- <Input
- value={
- dataSource.authenticationPrivateKeyPassphrase ?? ""
- }
- type="password"
- className="w-full"
- disabled={!allowEdit}
- placeholder={t(
- "data-source.private-key-passphrase-placeholder"
+ <SecretInput
+ resetKey={dataSource.id}
+ aria-label={t("data-source.private-key-passphrase")}
+ value={getDataSourceSecretValue(
+ dataSource,
+ "authenticationPrivateKeyPassphrase"
)}
- onChange={(e) =>
- update({
- authenticationPrivateKeyPassphrase: e.target.value,
- })
+ isCreating={isCreating || dataSource.pendingCreate}
+ disabled={!allowEdit}
+ onValueChange={(value) =>
+ onDataSourceChange(
+ updateDataSourceSecret(
+ dataSource,
+ "authenticationPrivateKeyPassphrase",
+ value
+ )
+ )
}
/>
</FormField>
@@ -2058,23 +2039,29 @@ export function DataSourceForm({
validationField="updatedToken"
title={
<>
- Token <span className="text-error">*</span>
+ {t("common.token")}{" "}
+ <span className="text-error">*</span>
</>
}
>
- <Input
- type="password"
- value={dataSource.updatedToken}
- className="w-full"
- autoComplete="off"
+ <SecretInput
+ resetKey={dataSource.id}
+ aria-label={t("common.token")}
+ value={getDataSourceSecretValue(
+ dataSource,
+ "authenticationPrivateKey"
+ )}
+ isCreating={isCreating || dataSource.pendingCreate}
disabled={!allowEdit}
- placeholder={
- isCreating
- ? "personal access token"
- : t("instance.token-write-only")
- }
- onChange={(e) =>
- update({ updatedToken: e.target.value.trim() })
+ allowEmpty={false}
+ onValueChange={(value) =>
+ onDataSourceChange(
+ updateDataSourceSecret(
+ dataSource,
+ "authenticationPrivateKey",
+ value
+ )
+ )
}
/>
</FormField>
@@ -2299,6 +2286,7 @@ export function DataSourceForm({
{!hideAdvancedFeatures && showSSH && isPasswordAuth && (
<div className="sm:col-span-3 sm:col-start-1">
<SshConnectionForm
+ key={dataSource.id}
title={
<span className="flex flex-row items-center gap-x-1">
{t("data-source.ssh-connection")}
@@ -2317,6 +2305,17 @@ export function DataSourceForm({
</span>
}
value={dataSource}
+ isCreating={isCreating || dataSource.pendingCreate}
+ secretValues={{
+ sshPassword: getDataSourceSecretValue(
+ dataSource,
+ "sshPassword"
+ ),
+ sshPrivateKey: getDataSourceSecretValue(
+ dataSource,
+ "sshPrivateKey"
+ ),
+ }}
instance={instance}
disabled={!allowEdit}
onChange={handleSSHChange}
diff --git a/frontend/src/components/instance/InstanceFormButtons.tsx b/frontend/src/components/instance/InstanceFormButtons.tsx
index d8c89c3d24..c50f510a8d 100644
--- a/frontend/src/components/instance/InstanceFormButtons.tsx
+++ b/frontend/src/components/instance/InstanceFormButtons.tsx
@@ -6,6 +6,7 @@ import { createBehaviorMetric } from "@/app/analytics/behavior";
import { behaviorAnalytics } from "@/app/analytics/provider";
import { router } from "@/app/router";
import { INSTANCE_ROUTE_DETAIL } from "@/app/router/handles";
+import { useHasInvalidSecretInputs } from "@/components/SecretInput";
import {
PREPARE_DATABASE_PRODUCT_INTRO,
PREPARE_DATABASE_TRANSFER_TIP,
@@ -68,6 +69,7 @@ export function InstanceFormButtons({
}: InstanceFormButtonsProps) {
const { t } = useTranslation();
+ const hasInvalidSecretInputs = useHasInvalidSecretInputs();
const context = useInstanceFormContext();
const {
state,
@@ -139,13 +141,17 @@ export function InstanceFormButtons({
};
const allowUpdate =
+ !hasInvalidSecretInputs &&
valueChanged &&
!!basicInfo.title.trim() &&
context.labelErrors.length === 0 &&
checkDataSource([adminDataSource, ...readonlyDataSourceList]);
const allowTestConnection =
- allowEdit && !!editingDataSource && checkDataSource([editingDataSource]);
+ !hasInvalidSecretInputs &&
+ allowEdit &&
+ !!editingDataSource &&
+ checkDataSource([editingDataSource]);
const hasConfiguredConnectionOptions = (ds: EditDataSource): boolean => {
const hasExtraParameters =
@@ -218,7 +224,7 @@ export function InstanceFormButtons({
};
const doCreate = async () => {
- if (!isCreating || !allowCreate) return;
+ if (!isCreating || !allowCreate || hasInvalidSecretInputs) return;
const payload = buildCreateInstance();
if (!checkExternalSecretFeature(payload.dataSources)) {
@@ -268,7 +274,7 @@ export function InstanceFormButtons({
};
const tryCreate = async () => {
- if (!allowCreate) return;
+ if (!allowCreate || hasInvalidSecretInputs) return;
behaviorAnalytics.captureMetric(
createBehaviorMetric("instance create clicked", {
routeId: router.currentRoute.value.name?.toString(),
@@ -599,6 +605,7 @@ export function InstanceFormButtons({
<Button
disabled={
!allowCreate ||
+ hasInvalidSecretInputs ||
state.isRequesting ||
state.isTestingConnection
}
@@ -620,7 +627,7 @@ export function InstanceFormButtons({
}
if (!instance) return null;
- if (!valueChanged || !allowEdit) return null;
+ if ((!valueChanged && !hasInvalidSecretInputs) || !allowEdit) return null;
return (
<>
diff --git a/frontend/src/components/instance/InstanceFormContext.tsx b/frontend/src/components/instance/InstanceFormContext.tsx
index da377545a3..2ba2f0fb22 100644
--- a/frontend/src/components/instance/InstanceFormContext.tsx
+++ b/frontend/src/components/instance/InstanceFormContext.tsx
@@ -12,6 +12,7 @@ import {
useState,
} from "react";
import { useTranslation } from "react-i18next";
+import { SecretInputProvider } from "@/components/SecretInput";
import { pushNotification } from "@/stores";
import { useAppStore } from "@/stores/app";
import type { Permission } from "@/types";
@@ -303,6 +304,7 @@ export function InstanceFormProvider({
omit(
edit,
"pendingCreate",
+ "updatedSecretFields",
"updatedPassword",
"useEmptyPassword",
"updatedMasterPassword",
@@ -689,7 +691,9 @@ export function InstanceFormProvider({
return (
<InstanceFormCtx.Provider value={value}>
- {children}
+ <SecretInputProvider resetKey={dataSourceResetEvent}>
+ {children}
+ </SecretInputProvider>
<FeatureModal
open={!!missingFeature}
feature={missingFeature}
diff --git a/frontend/src/components/instance/SshConnectionForm.tsx b/frontend/src/components/instance/SshConnectionForm.tsx
index 17bad0f7a4..f1d1fa289a 100644
--- a/frontend/src/components/instance/SshConnectionForm.tsx
+++ b/frontend/src/components/instance/SshConnectionForm.tsx
@@ -1,11 +1,6 @@
-import {
- type DragEvent,
- type ReactNode,
- useCallback,
- useEffect,
- useState,
-} from "react";
+import { type ReactNode, useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
+import { SecretInput } from "@/components/SecretInput";
import {
FormField,
FormLabel,
@@ -13,7 +8,6 @@ import {
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { SegmentedControl } from "@/components/ui/segmented-control";
-import { Textarea } from "@/components/ui/textarea";
import type { Instance } from "@/types/proto-es/v1/instance_service_pb";
const SSH_TYPES = ["NONE", "TUNNEL+PK"] as const;
@@ -32,6 +26,8 @@ interface SshConnectionFormProps {
value: SshValue;
instance?: Instance;
disabled?: boolean;
+ isCreating?: boolean;
+ secretValues?: { sshPassword?: string; sshPrivateKey?: string };
onChange: (value: Partial<SshValue>) => void;
}
@@ -51,7 +47,9 @@ function guessSshType(value: Partial<SshValue>): SshType {
export function SshConnectionForm({
value,
title,
- instance: _instance,
+ instance,
+ isCreating = instance === undefined,
+ secretValues,
disabled = false,
onChange,
}: SshConnectionFormProps) {
@@ -86,26 +84,6 @@ export function SshConnectionForm({
return t("data-source.ssh-type.none");
};
- const handleDrop = useCallback(
- (e: DragEvent<HTMLTextAreaElement>) => {
- e.preventDefault();
- const file = e.dataTransfer.files[0];
- if (!file) return;
- const reader = new FileReader();
- reader.onload = () => {
- if (typeof reader.result === "string") {
- onChange({ sshPrivateKey: reader.result });
- }
- };
- reader.readAsText(file);
- },
- [onChange]
- );
-
- const handleDragOver = useCallback((e: DragEvent<HTMLTextAreaElement>) => {
- e.preventDefault();
- }, []);
-
return (
<div className="flex flex-col gap-4">
<FormField title={title ?? t("data-source.ssh-connection")}>
@@ -170,29 +148,37 @@ export function SshConnectionForm({
<FormLabel htmlFor="sshPassword">
{t("data-source.ssh.password")}
</FormLabel>
- <Input
+ <SecretInput
id="sshPassword"
- placeholder={t("instance.password-write-only")}
- value={value.sshPassword}
+ resetKey={instance?.name}
+ aria-label={t("data-source.ssh.password")}
+ value={
+ isCreating ? value.sshPassword : secretValues?.sshPassword
+ }
+ isCreating={isCreating}
disabled={disabled}
- onChange={(e) => onChange({ sshPassword: e.target.value })}
+ onValueChange={(password) =>
+ onChange({ sshPassword: password })
+ }
/>
</FormField>
<FormField>
<FormLabel htmlFor="sshPrivateKey">
{t("data-source.ssh.ssh-key")} ({t("common.optional")})
</FormLabel>
- <Textarea
+ <SecretInput
id="sshPrivateKey"
- className="w-full h-24 whitespace-pre-wrap resize-none"
- value={value.sshPrivateKey}
- disabled={disabled}
- placeholder={t("common.sensitive-placeholder")}
- onDrop={handleDrop}
- onDragOver={handleDragOver}
- onChange={(e) =>
- onChange({ sshPrivateKey: e.target.value })
+ resetKey={instance?.name}
+ aria-label={t("data-source.ssh.ssh-key")}
+ multiline
+ value={
+ isCreating
+ ? value.sshPrivateKey
+ : secretValues?.sshPrivateKey
}
+ isCreating={isCreating}
+ disabled={disabled}
+ onValueChange={(key) => onChange({ sshPrivateKey: key })}
/>
</FormField>
</fieldset>
diff --git a/frontend/src/components/instance/ValidationField.tsx b/frontend/src/components/instance/ValidationField.tsx
index 471aa96585..a83e4ccbfd 100644
--- a/frontend/src/components/instance/ValidationField.tsx
+++ b/frontend/src/components/instance/ValidationField.tsx
@@ -8,6 +8,7 @@ import {
useState,
} from "react";
import { useTranslation } from "react-i18next";
+import { SecretInput, type SecretInputProps } from "@/components/SecretInput";
import { FormError, FormField } from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
@@ -136,3 +137,19 @@ export function ValidationTextarea(props: ComponentProps<typeof Textarea>) {
/>
);
}
+
+export function ValidationSecretInput(props: SecretInputProps) {
+ const field = useContext(FieldContext);
+ return (
+ <SecretInput
+ {...props}
+ aria-label={props["aria-label"] ?? field.label}
+ aria-invalid={field.invalid || props["aria-invalid"]}
+ aria-describedby={
+ [props["aria-describedby"], field.description]
+ .filter(Boolean)
+ .join(" ") || undefined
+ }
+ />
+ );
+}
diff --git a/frontend/src/components/instance/common.test.ts b/frontend/src/components/instance/common.test.ts
index 60225326cb..7e2ad8f155 100644
--- a/frontend/src/components/instance/common.test.ts
+++ b/frontend/src/components/instance/common.test.ts
@@ -8,7 +8,14 @@ import {
KerberosConfigSchema,
SASLConfigSchema,
} from "@/types/proto-es/v1/instance_service_pb";
-import { movesKeytabToNewDestination } from "./common";
+import {
+ calcDataSourceUpdateMask,
+ type DataSourceSecretField,
+ getDataSourceSecretValue,
+ movesKeytabToNewDestination,
+ updateDataSourceSecret,
+ wrapEditDataSource,
+} from "./common";
import {
applyLocalTlsCaSource,
applyLocalTlsClientCertSource,
@@ -421,3 +428,57 @@ describe("Kerberos keytab resupply field classification", () => {
).toEqual(["krb_config"]);
});
});
+
+describe("secret edit intent", () => {
+ test.each([
+ ["password", "password"],
+ ["masterPassword", "master_password"],
+ ["sshPassword", "ssh_password"],
+ ["sshPrivateKey", "ssh_private_key"],
+ ["authenticationPrivateKey", "authentication_private_key"],
+ [
+ "authenticationPrivateKeyPassphrase",
+ "authentication_private_key_passphrase",
+ ],
+ ] as [DataSourceSecretField, string][])(
+ "explicitly clears %s even when the read value is redacted",
+ (field, path) => {
+ const original = create(DataSourceSchema, { id: "admin" });
+ const untouched = wrapEditDataSource(original);
+ expect(getDataSourceSecretValue(untouched, field)).toBeUndefined();
+ expect(
+ calcDataSourceUpdateMask(original, original, untouched)
+ ).not.toContain(path);
+ const changed = updateDataSourceSecret(untouched, field, "");
+ expect(getDataSourceSecretValue(changed, field)).toBe("");
+ expect(
+ calcDataSourceUpdateMask(
+ create(DataSourceSchema, { ...original, [field]: "" }),
+ original,
+ changed
+ )
+ ).toContain(path);
+ }
+ );
+
+ test("preserves whitespace and keeps an unrelated hidden secret out of the mask", () => {
+ const original = create(DataSourceSchema, { id: "admin" });
+ const changed = updateDataSourceSecret(
+ wrapEditDataSource(original),
+ "sshPassword",
+ " secret "
+ );
+ expect(changed.sshPassword).toBe(" secret ");
+ expect(getDataSourceSecretValue(changed, "sshPrivateKey")).toBeUndefined();
+ expect(
+ calcDataSourceUpdateMask(
+ create(DataSourceSchema, {
+ ...original,
+ sshPassword: changed.sshPassword,
+ }),
+ original,
+ changed
+ )
+ ).toEqual(["ssh_password"]);
+ });
+});
diff --git a/frontend/src/components/instance/common.ts b/frontend/src/components/instance/common.ts
index 8850c1e48b..abca0f5235 100644
--- a/frontend/src/components/instance/common.ts
+++ b/frontend/src/components/instance/common.ts
@@ -38,8 +38,26 @@ export type BasicInfo = Omit<
"$typeName" | "dataSources" | "engineVersion" | "lastSyncTime"
>;
+export type DataSourceSecretField =
+ | "password"
+ | "masterPassword"
+ | "sshPassword"
+ | "sshPrivateKey"
+ | "authenticationPrivateKey"
+ | "authenticationPrivateKeyPassphrase";
+
+const SECRET_MASK_PATHS: Record<DataSourceSecretField, string> = {
+ password: "password",
+ masterPassword: "master_password",
+ sshPassword: "ssh_password",
+ sshPrivateKey: "ssh_private_key",
+ authenticationPrivateKey: "authentication_private_key",
+ authenticationPrivateKeyPassphrase: "authentication_private_key_passphrase",
+};
+
export type EditDataSource = DataSource & {
pendingCreate: boolean;
+ updatedSecretFields?: DataSourceSecretField[];
updatedPassword: string;
updatedMasterPassword: string;
updatedToken: string;
@@ -49,6 +67,47 @@ export type EditDataSource = DataSource & {
extraConnectionParameters?: Record<string, string>;
};
+export function getDataSourceSecretValue(
+ ds: EditDataSource,
+ field: DataSourceSecretField
+): string | undefined {
+ const value =
+ field === "password"
+ ? ds.updatedPassword
+ : field === "masterPassword"
+ ? ds.updatedMasterPassword
+ : field === "authenticationPrivateKey"
+ ? ds.updatedToken || ds.authenticationPrivateKey
+ : ds[field];
+ return ds.pendingCreate || ds.updatedSecretFields?.includes(field) || value
+ ? value
+ : undefined;
+}
+
+export function updateDataSourceSecret(
+ ds: EditDataSource,
+ field: DataSourceSecretField,
+ value: string
+): EditDataSource {
+ const next = {
+ ...ds,
+ [field]: value,
+ updatedSecretFields: [
+ ...new Set([...(ds.updatedSecretFields ?? []), field]),
+ ],
+ };
+ if (field === "password") {
+ next.updatedPassword = value;
+ next.useEmptyPassword = value === "";
+ } else if (field === "masterPassword") {
+ next.updatedMasterPassword = value;
+ next.useEmptyMasterPassword = value === "";
+ } else if (field === "authenticationPrivateKey") {
+ next.updatedToken = value;
+ }
+ return next;
+}
+
export type DataSourceEditState = {
dataSources: EditDataSource[];
editingDataSourceId: string | undefined;
@@ -182,6 +241,13 @@ export const calcDataSourceUpdateMask = (
calcUpdateMask(editing, original, true /* toSnakeCase */)
);
const { useEmptyPassword, updateSsl } = editState;
+ for (const field of editState.updatedSecretFields ?? []) {
+ updateMask.add(SECRET_MASK_PATHS[field]);
+ }
+ if (editState.useEmptyMasterPassword) {
+ editing.masterPassword = "";
+ updateMask.add("master_password");
+ }
if (useEmptyPassword) {
editing.password = "";
updateMask.add("password");
diff --git a/frontend/src/components/instance/validation.test.ts b/frontend/src/components/instance/validation.test.ts
index 1f5ff3627c..ffa0f0e2a9 100644
--- a/frontend/src/components/instance/validation.test.ts
+++ b/frontend/src/components/instance/validation.test.ts
@@ -8,7 +8,7 @@ import {
DataSourceSchema,
DataSourceExternalSecret_SecretType as SecretType,
} from "@/types/proto-es/v1/instance_service_pb";
-import type { EditDataSource } from "./common";
+import { type EditDataSource, updateDataSourceSecret } from "./common";
import { validateDataSource } from "./validation";
const draft = (patch: Partial<EditDataSource> = {}): EditDataSource => ({
@@ -23,6 +23,51 @@ const validate = (ds: EditDataSource, engine = Engine.MYSQL) =>
validateDataSource(ds, { engine, isSaaSMode: true });
describe("instance validation", () => {
+ test.each([
+ [Engine.SNOWFLAKE, "authenticationPrivateKey"],
+ [Engine.DATABRICKS, "updatedToken"],
+ ] as const)(
+ "validates required secret drafts independently of mounted inputs for %s",
+ (engine, field) => {
+ const stored = draft({ pendingCreate: false, warehouseId: "warehouse" });
+ expect(validate(stored, engine)).toEqual({});
+ const replacement = updateDataSourceSecret(
+ stored,
+ "authenticationPrivateKey",
+ "replacement"
+ );
+ expect(validate(replacement, engine)).toEqual({});
+ const cleared = updateDataSourceSecret(
+ replacement,
+ "authenticationPrivateKey",
+ ""
+ );
+ expect(validate(cleared, engine)[field]).toBe("required");
+ expect(
+ validate(
+ updateDataSourceSecret(
+ cleared,
+ "authenticationPrivateKey",
+ "new value"
+ ),
+ engine
+ )
+ ).toEqual({});
+ expect(validate({ ...stored, pendingCreate: true }, engine)[field]).toBe(
+ "required"
+ );
+ }
+ );
+ test("allows optional secrets to be explicitly cleared", () => {
+ const ds = draft({ pendingCreate: false });
+ expect(validate(updateDataSourceSecret(ds, "password", ""))).toEqual({});
+ expect(
+ validate(
+ updateDataSourceSecret(ds, "authenticationPrivateKeyPassphrase", ""),
+ Engine.SNOWFLAKE
+ )
+ ).toEqual({});
+ });
test.each(["sslCaPath", "sslCertPath", "sslKeyPath"] as const)(
"rejects relative %s",
(field) => {
diff --git a/frontend/src/components/instance/validation.ts b/frontend/src/components/instance/validation.ts
index 93f55e9f22..3955cbfe38 100644
--- a/frontend/src/components/instance/validation.ts
+++ b/frontend/src/components/instance/validation.ts
@@ -8,7 +8,7 @@ import {
DataSourceExternalSecret_SecretType as SecretType,
} from "@/types/proto-es/v1/instance_service_pb";
import { isIAMAuthentication } from "./authentication";
-import type { EditDataSource } from "./common";
+import { type EditDataSource, getDataSourceSecretValue } from "./common";
export type ValidationErrors = Record<string, string>;
@@ -77,7 +77,14 @@ export function validateDataSource(
errors.serviceName = "oracle-service";
if (engine === Engine.DATABRICKS) {
require("warehouseId", ds.warehouseId);
- if (ds.pendingCreate) require("updatedToken", ds.updatedToken);
+ }
+ if (engine === Engine.DATABRICKS || engine === Engine.SNOWFLAKE) {
+ const key = getDataSourceSecretValue(ds, "authenticationPrivateKey");
+ if (key !== undefined) {
+ require(engine === Engine.DATABRICKS
+ ? "updatedToken"
+ : "authenticationPrivateKey", key);
+ }
}
if (engine === Engine.REDIS && ds.redisType === DataSource_RedisType.SENTINEL)
require("masterName", ds.masterName);
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index e75ddf13cf..806a4749ad 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -444,6 +444,9 @@
"search-for-more": "Search for more",
"search-no-result": "No matching result found",
"search-results": "Search results",
+ "secret-input": {
+ "unchanged": "Unchanged"
+ },
"select": "Please Select",
"select-all": "Select all",
"selected": "selected",
@@ -474,6 +477,8 @@
"tips": "Tips",
"title": "Title",
"to": "To",
+ "toggle-password-visibility": "Toggle password visibility",
+ "token": "Token",
"total": "Total",
"total-n-items": "Total {{n}} items",
"transfer": "Transfer",
@@ -626,7 +631,6 @@
},
"no-read-only-data-source": "No read-only data source",
"private-key-passphrase": "Private Key Passphrase",
- "private-key-passphrase-placeholder": "Leave empty if your private key is not encrypted",
"private-key-passphrase-tip": "Optional passphrase for encrypted private keys",
"read-only": "RO",
"read-replica-host": "Read-replica Host",
@@ -1224,7 +1228,6 @@
"no-environment": "This instance has not been bound to the environment",
"no-extra-params-configured": "No extra connection parameters configured",
"no-params-yet-add-above": "No parameters configured yet. Add parameters using the form above.",
- "no-password": "No password",
"open-data-source": "Open this data source to see what it needs.",
"parameter-name-placeholder": "Parameter name",
"parameter-value-placeholder": "Parameter value",
@@ -1243,7 +1246,6 @@
"google-iam": "Google Cloud SQL IAM",
"password": "Plain Password"
},
- "password-write-only": "YOUR_DB_PWD - write only",
"port": "Port",
"prepare-sample-instance-failed": "Failed to prepare Sample Project Instance.",
"preparing-sample-instance": "Preparing Sample Project Instance…",
@@ -1352,7 +1354,6 @@
"syncing": "Syncing ...",
"test-connection": "Test Connection",
"testing-connection": "Testing Connection...",
- "token-write-only": "YOUR_TOKEN - write only",
"type-or-paste-credentials-write-only": "Type or paste CREDENTIALS - write only",
"unable-to-connect": "Bytebase couldn't connect with these settings. Review the guidance above, or continue and update the connection later.\n\nTechnical details: {{0}}",
"use-sample-instance": "Use sample instance (Available for 7 days)",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 7a9d6892a9..2ab483705b 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -444,6 +444,9 @@
"search-for-more": "Buscar más",
"search-no-result": "No se encontraron resultados coincidentes",
"search-results": "Buscar resultados",
+ "secret-input": {
+ "unchanged": "Sin cambios"
+ },
"select": "Seleccionar",
"select-all": "Seleccionar todo",
"selected": "seleccionado",
@@ -474,6 +477,8 @@
"tips": "Consejos",
"title": "Título",
"to": "Hasta",
+ "toggle-password-visibility": "Alternar visibilidad de la contraseña",
+ "token": "Token",
"total": "Total",
"total-n-items": "Total {{n}} elementos",
"transfer": "Transferir",
@@ -626,7 +631,6 @@
},
"no-read-only-data-source": "Sin fuente de datos de solo lectura",
"private-key-passphrase": "Frase de contraseña de clave privada",
- "private-key-passphrase-placeholder": "Deje vacío si su clave privada no está cifrada",
"private-key-passphrase-tip": "Frase de contraseña opcional para claves privadas cifradas",
"read-only": "Solo lectura",
"read-replica-host": "Anfitrión de réplica de lectura",
@@ -1224,7 +1228,6 @@
"no-environment": "Esta instancia no ha sido ligada al entorno.",
"no-extra-params-configured": "No hay parámetros de conexión adicionales configurados",
"no-params-yet-add-above": "No hay parámetros configurados todavía. \nAgregue parámetros usando el formulario anterior.",
- "no-password": "Sin contraseña",
"open-data-source": "Abra esta fuente de datos para ver qué necesita.",
"parameter-name-placeholder": "Nombre de parámetro",
"parameter-value-placeholder": "Valor de parámetro",
@@ -1243,7 +1246,6 @@
"google-iam": "Google Cloud SQL IAM",
"password": "Contraseña"
},
- "password-write-only": "SU_DB_PWD - solo escritura",
"port": "Puerto",
"prepare-sample-instance-failed": "No se pudo preparar la instancia de proyecto de muestra.",
"preparing-sample-instance": "Preparando la instancia de proyecto de muestra…",
@@ -1352,7 +1354,6 @@
"syncing": "Sincronizando...",
"test-connection": "Probar conexión",
"testing-connection": "Probando conexión...",
- "token-write-only": "TU_TOKEN - solo escritura",
"type-or-paste-credentials-write-only": "Escriba o pegue las CREDENCIALES - solo escritura",
"unable-to-connect": "Bytebase no pudo conectarse con esta configuración. Revisa las indicaciones anteriores o continúa y actualiza la conexión más tarde.\n\nDetalles técnicos: {{0}}",
"use-sample-instance": "Usar instancia de ejemplo (Disponible durante 7 días)",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 68b7dc6ebf..c35644ef5e 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -444,6 +444,9 @@
"search-for-more": "さらに検索",
"search-no-result": "一致する結果が見つかりません",
"search-results": "結果を検索",
+ "secret-input": {
+ "unchanged": "変更なし"
+ },
"select": "選択してください",
"select-all": "すべて選択",
"selected": "選択済み",
@@ -474,6 +477,8 @@
"tips": "プロンプトメッセージ",
"title": "タイトル",
"to": "終了",
+ "toggle-password-visibility": "パスワードの表示を切り替え",
+ "token": "トークン",
"total": "合計",
"total-n-items": "合計 {{n}} 件",
"transfer": "移行",
@@ -626,7 +631,6 @@
},
"no-read-only-data-source": "読み取り専用データソースがありません",
"private-key-passphrase": "秘密鍵のパスフレーズ",
- "private-key-passphrase-placeholder": "秘密鍵が暗号化されていない場合は空のままにしてください",
"private-key-passphrase-tip": "暗号化された秘密鍵のオプションパスフレーズ",
"read-only": "読み取り専用",
"read-replica-host": "リードレプリカホスト",
@@ -1224,7 +1228,6 @@
"no-environment": "このインスタンスは環境にバインドされていません",
"no-extra-params-configured": "追加の接続パラメーターは構成されていません",
"no-params-yet-add-above": "まだ構成されていません。\n上記のフォームを使用してパラメーターを追加します。",
- "no-password": "パスワードがありません",
"open-data-source": "このデータソースを開いて、何が必要か確認してください。",
"parameter-name-placeholder": "パラメーター名",
"parameter-value-placeholder": "パラメーター値",
@@ -1243,7 +1246,6 @@
"google-iam": "Google Cloud SQL IAM",
"password": "パスワード"
},
- "password-write-only": "YOUR_DB_PWD - 書き込み専用",
"port": "ポート",
"prepare-sample-instance-failed": "サンプルプロジェクトインスタンスの準備に失敗しました。",
"preparing-sample-instance": "サンプルプロジェクトインスタンスを準備しています…",
@@ -1352,7 +1354,6 @@
"syncing": "同期中 ...",
"test-connection": "テスト接続",
"testing-connection": "接続テスト中...",
- "token-write-only": "YOUR_TOKEN - 書き込み専用",
"type-or-paste-credentials-write-only": "資格情報を入力または貼り付けます - 書き込みのみ",
"unable-to-connect": "この設定では Bytebase から接続できませんでした。上のガイダンスを確認するか、そのまま続行して後で接続を更新してください。\n\n技術的な詳細: {{0}}",
"use-sample-instance": "サンプルインスタンスを使用する(7日間利用可能)",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 33404aa9d0..ea7572a35e 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -444,6 +444,9 @@
"search-for-more": "Tìm kiếm thêm",
"search-no-result": "Không tìm thấy kết quả phù hợp",
"search-results": "Tìm kiếm kết quả",
+ "secret-input": {
+ "unchanged": "Không thay đổi"
+ },
"select": "Vui lòng chọn",
"select-all": "Chọn tất cả",
"selected": "đã chọn",
@@ -474,6 +477,8 @@
"tips": "Mẹo",
"title": "Tiêu đề",
"to": "Đến",
+ "toggle-password-visibility": "Bật/tắt hiển thị mật khẩu",
+ "token": "Mã token",
"total": "Tổng",
"total-n-items": "Tổng {{n}} mục",
"transfer": "Chuyển",
@@ -626,7 +631,6 @@
},
"no-read-only-data-source": "Không có nguồn dữ liệu chỉ đọc",
"private-key-passphrase": "Mật khẩu khóa riêng",
- "private-key-passphrase-placeholder": "Để trống nếu khóa riêng của bạn không được mã hóa",
"private-key-passphrase-tip": "Mật khẩu tùy chọn cho khóa riêng được mã hóa",
"read-only": "Chỉ đọc",
"read-replica-host": "Máy chủ bản sao đọc",
@@ -1224,7 +1228,6 @@
"no-environment": "Trường hợp này không bị ràng buộc với môi trường",
"no-extra-params-configured": "Không có thông số kết nối bổ sung được cấu hình",
"no-params-yet-add-above": "Chưa có thông số nào được cấu hình. \nThêm tham số bằng cách sử dụng biểu mẫu trên.",
- "no-password": "Không có mật khẩu",
"open-data-source": "Mở nguồn dữ liệu này để xem nó cần gì.",
"parameter-name-placeholder": "Tên tham số",
"parameter-value-placeholder": "Giá trị tham số",
@@ -1243,7 +1246,6 @@
"google-iam": "Google Cloud SQL IAM",
"password": "Mật khẩu"
},
- "password-write-only": "YOUR_DB_PWD - chỉ ghi",
"port": "Cổng",
"prepare-sample-instance-failed": "Không thể chuẩn bị Phiên bản dự án mẫu.",
"preparing-sample-instance": "Đang chuẩn bị Phiên bản dự án mẫu…",
@@ -1352,7 +1354,6 @@
"syncing": "Đang đồng bộ hóa ...",
"test-connection": "Kiểm tra kết nối",
"testing-connection": "Đang kiểm tra kết nối...",
- "token-write-only": "YOUR_TOKEN - chỉ ghi",
"type-or-paste-credentials-write-only": "Nhập hoặc dán THÔNG TIN XÁC THỰC - chỉ ghi",
"unable-to-connect": "Bytebase không thể kết nối với các cài đặt này. Hãy xem hướng dẫn ở trên hoặc tiếp tục và cập nhật kết nối sau.\n\nChi tiết kỹ thuật: {{0}}",
"use-sample-instance": "Sử dụng phiên bản mẫu (Có sẵn trong 7 ngày)",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index be122b5fde..b850d903c0 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -444,6 +444,9 @@
"search-for-more": "搜索更多",
"search-no-result": "未找到匹配的结果",
"search-results": "搜索结果",
+ "secret-input": {
+ "unchanged": "未更改"
+ },
"select": "请选择",
"select-all": "全选",
"selected": "已选择",
@@ -474,6 +477,8 @@
"tips": "提示信息",
"title": "标题",
"to": "到",
+ "toggle-password-visibility": "切换密码可见性",
+ "token": "令牌",
"total": "总计",
"total-n-items": "共 {{n}} 项",
"transfer": "转移",
@@ -626,7 +631,6 @@
},
"no-read-only-data-source": "没有只读数据源",
"private-key-passphrase": "私钥密码",
- "private-key-passphrase-placeholder": "如果私钥未加密,请留空",
"private-key-passphrase-tip": "加密私钥的可选密码",
"read-only": "只读",
"read-replica-host": "只读副本 Host",
@@ -1224,7 +1228,6 @@
"no-environment": "此实例尚未绑定到环境",
"no-extra-params-configured": "没有配置的额外连接参数",
"no-params-yet-add-above": "尚未配置参数。\n使用上面的形式添加参数。",
- "no-password": "无密码",
"open-data-source": "打开该数据源,查看还需要什么。",
"parameter-name-placeholder": "参数名称",
"parameter-value-placeholder": "参数值",
@@ -1243,7 +1246,6 @@
"google-iam": "Google Cloud SQL IAM",
"password": "密码"
},
- "password-write-only": "YOUR_DB_PWD - 仅写入",
"port": "端口",
"prepare-sample-instance-failed": "准备示例项目实例失败。",
"preparing-sample-instance": "正在准备示例项目实例…",
@@ -1352,7 +1354,6 @@
"syncing": "同步中 ...",
"test-connection": "测试连接",
"testing-connection": "测试连接中...",
- "token-write-only": "YOUR_TOKEN - 仅写入",
"type-or-paste-credentials-write-only": "输入或粘贴 CREDENTIALS - 仅写入",
"unable-to-connect": "Bytebase 无法使用这些设置连接数据库。请检查上方指引,或继续操作并稍后更新连接。\n\n技术详情:{{0}}",
"use-sample-instance": "使用示例实例(可用 7 天)",