Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Add frontend uniqueness check for ssh hostnames
Tuan Dang1ea8e5a81e38
diff --git a/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx b/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsxindex a779716d41..249fc1b35b 100644--- a/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx+++ b/frontend/src/pages/ssh/SshHostsPage/components/SshHostModal.tsx@@ -23,6 +23,7 @@ import {useCreateSshHost,useGetSshHostById,useGetWorkspaceUsers,+ useListWorkspaceSshHosts,useUpdateSshHost} from "@app/hooks/api";import { UsePopUpState } from "@app/hooks/usePopUp";@@ -58,6 +59,7 @@ export type FormData = z.infer<typeof schema>;export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {const { currentWorkspace } = useWorkspace();const projectId = currentWorkspace?.id || "";+ const { data: sshHosts } = useListWorkspaceSshHosts(currentWorkspace.id);const { data: members = [] } = useGetWorkspaceUsers(projectId);const [expandedMappings, setExpandedMappings] = useState<Record<number, boolean>>({});@@ -116,6 +118,18 @@ export const SshHostModal = ({ popUp, handlePopUpToggle }: Props) => {try {if (!projectId) return;+ // check if there is already a different host with the same hostname+ const existingHostnames =+ sshHosts?.filter((h) => h.id !== sshHost?.id).map((h) => h.hostname) || [];++ if (existingHostnames.includes(hostname)) {+ createNotification({+ text: "A host with this hostname already exists.",+ type: "error"+ });+ return;+ }+if (sshHost) {await updateMutateAsync({sshHostId: sshHost.id,