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
avoid duplicate tags
Thiago Araujo da Silvad9f6c9908b07
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsxindex f178c5ac38..2d2e0f1525 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx@@ -51,7 +51,7 @@ import { OIDCJWTSignatureAlgorithm } from "@app/hooks/api/oidcConfig/types";import { SsoMfaTrust } from "@app/hooks/api/organization/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { FormSection } from "./SsoFormSection";+import { FormSection, rejectDuplicateTag } from "./SsoFormSection";enum ConfigurationType {CUSTOM = "custom",@@ -144,6 +144,7 @@ export const OIDCModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDeleconst { mutateAsync: updateMutateAsync, isPending: updateIsLoading } = useUpdateOIDCConfig();const [isDeletePopupOpen, setIsDeletePopupOpen] = useToggle(false);const [isClientSecretRevealed, setIsClientSecretRevealed] = useState(false);+ const [amrValueTagError, setAmrValueTagError] = useState<string | null>(null);const { data } = useGetOIDCConfig(currentOrg?.id ?? "");@@ -517,12 +518,14 @@ export const OIDCModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDeleplaceholder="Type a value, press Enter"value={value ?? []}onValueChange={onChange}- isError={Boolean(error)}+ validateTag={rejectDuplicateTag}+ onValidationError={setAmrValueTagError}+ isError={Boolean(amrValueTagError || error)}/><FieldDescription>Counted as MFA in addition to the standard <Code>mfa</Code> value.</FieldDescription>- <FieldError>{error?.message}</FieldError>+ <FieldError>{amrValueTagError ?? error?.message}</FieldError></Field>)}/>diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsxindex 389e8a7bed..3a67162046 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx@@ -1,4 +1,4 @@-import { useEffect } from "react";+import { useEffect, useState } from "react";import { Controller, useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";import { Trash2 } from "lucide-react";@@ -43,7 +43,7 @@ import { useCreateSSOConfig, useGetSSOConfig, useUpdateSSOConfig } from "@app/hoimport { SsoMfaTrust } from "@app/hooks/api/organization/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { FormSection } from "./SsoFormSection";+import { FormSection, rejectDuplicateTag } from "./SsoFormSection";enum AuthProvider {OKTA_SAML = "okta-saml",@@ -197,6 +197,7 @@ export const SSOModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDeletconst { mutateAsync: createMutateAsync, isPending: createIsLoading } = useCreateSSOConfig();const { mutateAsync: updateMutateAsync, isPending: updateIsLoading } = useUpdateSSOConfig();const [isDeletePopupOpen, setIsDeletePopupOpen] = useToggle();+ const [authnContextTagError, setAuthnContextTagError] = useState<string | null>(null);const { data } = useGetSSOConfig(currentOrg?.id ?? "");const { control, handleSubmit, reset, watch, setValue, getValues } = useForm<AddSSOFormData>({@@ -350,7 +351,10 @@ export const SSOModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDeletlabel={withHint(labels.acsUrl, labels.acsHint)}value={`${window.origin}/api/v1/sso/saml2/${data.id}`}/>- <CodeBlock label={withHint(labels.entityId, labels.entityHint)} value={window.origin} />+ <CodeBlock+ label={withHint(labels.entityId, labels.entityHint)}+ value={window.origin}+ /></FormSection>)}@@ -458,13 +462,15 @@ export const SSOModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDeletplaceholder="urn:oasis:names:tc:SAML:2.0:ac:classes:..."value={value}onValueChange={onChange}- isError={Boolean(error)}+ validateTag={rejectDuplicateTag}+ onValidationError={setAuthnContextTagError}+ isError={Boolean(authnContextTagError || error)}/><FieldDescription>AuthnContextClassRef values counted as MFA, in addition to the standardtwo-factor classes. Press Enter to add.</FieldDescription>- <FieldError>{error?.message}</FieldError>+ <FieldError>{authnContextTagError ?? error?.message}</FieldError></Field>)}/>diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SsoFormSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SsoFormSection.tsxindex 8eb13075f2..2ee11ee5d7 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SsoFormSection.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SsoFormSection.tsx@@ -2,6 +2,12 @@ import { ReactNode } from "react";import { FieldDescription, FieldGroup, FieldLegend, FieldSet } from "@app/components/v3";+// The backend matches signal values case-insensitively, so two casings of one value are the same entry.+export const rejectDuplicateTag = (tag: string, existing: string[]) =>+ existing.some((item) => item.toLowerCase() === tag.toLowerCase())+ ? `${tag} is already listed`+ : null;+export const FormSection = ({title,description,