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
Merge branch 'main' into fix/remove-duplicate-error-notifications
Victor Santosc25e36f3f208
diff --cc frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsxindex 064f8f7a24,063cab35d1..319323545a--- a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsx+++ b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/PkiCollectionDetailsByIDPage.tsx@@@ -45,24 -45,31 +45,24 @@@ export const PkiCollectionPage = () =>] as const);const onDeletePkiCollectionSubmit = async (collectionIdToDelete: string) => {- try {- if (!projectId) return;+ if (!projectId) return;- await deletePkiCollection({- projectId,- collectionId: collectionIdToDelete- });+ await deletePkiCollection({+ projectId,+ collectionId: collectionIdToDelete+ });- createNotification({- text: "Successfully deleted PKI collection",- type: "success"- });- handlePopUpClose("deletePkiCollection");- navigate({- to: "/projects/cert-management/$projectId/policies",- params: {- projectId: params.projectId- }- });- } catch {- createNotification({- text: "Failed to delete PKI collection",- type: "error"- });- }+ createNotification({+ text: "Successfully deleted PKI collection",+ type: "success"+ });+ handlePopUpClose("deletePkiCollection");+ navigate({- to: "/projects/cert-management/$projectId/certificates",++ to: "/projects/cert-management/$projectId/policies",+ params: {- projectId++ projectId: params.projectId+ }+ });};return (diff --cc frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsxindex 15c016587e,52104ed1fc..27c91851c2--- a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscriberModal.tsx@@@ -276,109 -276,129 +276,121 @@@ export const PkiSubscriberModal = ({ polocality,emailAddress}: FormData) => {- try {- if (!projectId) return;+ if (!projectId) return;- if (!caId) {- createNotification({- text: "Please select an Issuing CA",- type: "error"- });- return;- }-- // Check if there is already a different subscriber with the same name- const existingNames =- subscribers?.filter((s) => s.id !== pkiSubscriber?.id).map((s) => s.name) || [];-- if (existingNames.includes(name.trim())) {- createNotification({- text: "A subscriber with this name already exists.",- type: "error"- });- return;- }+ if (!caId) {+ createNotification({+ text: "Please select an Issuing CA",+ type: "error"+ });+ return;+ }- // Validate Azure template for Azure ADCS CA- if (selectedCa?.type === CaType.AZURE_AD_CS && !azureTemplateType) {- createNotification({- text: "Please select an Azure certificate template",- type: "error"- });- return;- }+ // Check if there is already a different subscriber with the same name+ const existingNames =+ subscribers?.filter((s) => s.id !== pkiSubscriber?.id).map((s) => s.name) || [];- const keyUsagesList =- selectedCa?.type === CaType.AZURE_AD_CS- ? []- : Object.entries(keyUsages)- .filter(([, value]) => value)- .map(([key]) => key as CertKeyUsage);+ if (existingNames.includes(name.trim())) {+ createNotification({+ text: "A subscriber with this name already exists.",+ type: "error"+ });+ return;+ }- const extendedKeyUsagesList =- selectedCa?.type === CaType.AZURE_AD_CS- ? []- : Object.entries(extendedKeyUsages)- .filter(([, value]) => value)- .map(([key]) => key as CertExtendedKeyUsage);+ // Validate Azure template for Azure ADCS CA+ if (selectedCa?.type === CaType.AZURE_AD_CS && !azureTemplateType) {+ createNotification({+ text: "Please select an Azure certificate template",+ type: "error"+ });+ return;+ }- const subjectAlternativeNamesList = subjectAlternativeNames- .split(",")- .map((san) => san.trim())- .filter(Boolean);+ const keyUsagesList =+ selectedCa?.type === CaType.AZURE_AD_CS+ ? []+ : Object.entries(keyUsages)+ .filter(([, value]) => value)+ .map(([key]) => key as CertKeyUsage);- const autoRenewalPeriodInDays = enableAutoRenewal- ? convertTimeUnitValueToDays(renewalUnit, renewalBefore)- : undefined;+ const extendedKeyUsagesList =+ selectedCa?.type === CaType.AZURE_AD_CS+ ? []+ : Object.entries(extendedKeyUsages)+ .filter(([, value]) => value)+ .map(([key]) => key as CertExtendedKeyUsage);- // Build properties object- const properties = {- ...(selectedCa?.type === CaType.AZURE_AD_CS && azureTemplateType && { azureTemplateType }),- ...(organization && { organization }),- ...(organizationalUnit && { organizationalUnit }),- ...(country && { country }),- ...(state && { state }),- ...(locality && { locality }),- ...(emailAddress && { emailAddress })- };+ const subjectAlternativeNamesList = subjectAlternativeNames+ .split(",")+ .map((san) => san.trim())+ .filter(Boolean);- if (pkiSubscriber) {- await updateMutateAsync({- subscriberName: pkiSubscriber.name,- projectId,- name,- caId,- commonName,- subjectAlternativeNames: subjectAlternativeNamesList,- ttl,- keyUsages: keyUsagesList.map((key) =>- key === CertKeyUsage.CRL_SIGN- ? "cRLSign"- : key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())- ),- extendedKeyUsages: extendedKeyUsagesList.map((key) =>- key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())- ),- enableAutoRenewal,- autoRenewalPeriodInDays,- properties: Object.keys(properties).length > 0 ? properties : undefined- });- } else {- await createMutateAsync({- projectId,- name,- caId,- commonName,- subjectAlternativeNames: subjectAlternativeNamesList,- ttl,- keyUsages: keyUsagesList.map((key) =>- key === CertKeyUsage.CRL_SIGN- ? "cRLSign"- : key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())- ),- extendedKeyUsages: extendedKeyUsagesList.map((key) =>- key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())- ),- enableAutoRenewal,- autoRenewalPeriodInDays,- properties: Object.keys(properties).length > 0 ? properties : undefined- });- }+ const autoRenewalPeriodInDays = enableAutoRenewal+ ? convertTimeUnitValueToDays(renewalUnit, renewalBefore)+ : undefined;- reset();- handlePopUpToggle("pkiSubscriber", false);+ // Build properties object+ const properties = {+ ...(selectedCa?.type === CaType.AZURE_AD_CS && azureTemplateType && { azureTemplateType }),+ ...(organization && { organization }),+ ...(organizationalUnit && { organizationalUnit }),+ ...(country && { country }),+ ...(state && { state }),+ ...(locality && { locality }),+ ...(emailAddress && { emailAddress })+ };- createNotification({- text: `Successfully ${pkiSubscriber ? "updated" : "added"} PKI subscriber`,- type: "success"+ if (pkiSubscriber) {+ await updateMutateAsync({+ subscriberName: pkiSubscriber.name,+ projectId,+ name,+ caId,+ commonName,+ subjectAlternativeNames: subjectAlternativeNamesList,+ ttl,- keyUsages: keyUsagesList,- extendedKeyUsages: extendedKeyUsagesList,++ keyUsages: keyUsagesList.map((key) =>++ key === CertKeyUsage.CRL_SIGN++ ? "cRLSign"++ : key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())++ ),++ extendedKeyUsages: extendedKeyUsagesList.map((key) =>++ key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())++ ),+ enableAutoRenewal,+ autoRenewalPeriodInDays,+ properties: Object.keys(properties).length > 0 ? properties : undefined});- } catch (err) {- console.error(err);- createNotification({- text: `Failed to ${pkiSubscriber ? "update" : "add"} PKI subscriber`,- type: "error"+ } else {+ await createMutateAsync({+ projectId,+ name,+ caId,+ commonName,+ subjectAlternativeNames: subjectAlternativeNamesList,+ ttl,- keyUsages: keyUsagesList,- extendedKeyUsages: extendedKeyUsagesList,++ keyUsages: keyUsagesList.map((key) =>++ key === CertKeyUsage.CRL_SIGN++ ? "cRLSign"++ : key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())++ ),++ extendedKeyUsages: extendedKeyUsagesList.map((key) =>++ key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())++ ),+ enableAutoRenewal,+ autoRenewalPeriodInDays,+ properties: Object.keys(properties).length > 0 ? properties : undefined});}++ reset();+ handlePopUpToggle("pkiSubscriber", false);++ createNotification({+ text: `Successfully ${pkiSubscriber ? "updated" : "added"} PKI subscriber`,+ type: "success"+ });};return (diff --cc frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsxindex 00aa192a6d,94cf66ff87..d0decf3f64--- a/frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsx+++ b/frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsx@@@ -128,51 -128,67 +128,59 @@@ export const PkiTemplateForm = ({ certTreturn;}- try {- if (certTemplate) {- await updateCertTemplate({- templateName: certTemplate.name,- projectId: currentProject.id,- caName: ca.name,- name,- commonName,- subjectAlternativeName,- ttl,- keyUsages: Object.entries(keyUsages)- .filter(([, value]) => value)- .map(([key]) =>- key === CertKeyUsage.CRL_SIGN- ? "cRLSign"- : key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())- ),- extendedKeyUsages: Object.entries(extendedKeyUsages)- .filter(([, value]) => value)- .map(([key]) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()))- });-- createNotification({- text: "Successfully updated certificate template",- type: "success"- });- } else {- await createCertTemplate({- projectId: currentProject.id,- caName: ca.name,- name,- commonName,- subjectAlternativeName,- ttl,- keyUsages: Object.entries(keyUsages)- .filter(([, value]) => value)- .map(([key]) =>- key === CertKeyUsage.CRL_SIGN- ? "cRLSign"- : key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())- ),- extendedKeyUsages: Object.entries(extendedKeyUsages)- .filter(([, value]) => value)- .map(([key]) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()))- });+ if (certTemplate) {+ await updateCertTemplate({+ templateName: certTemplate.name,+ projectId: currentProject.id,+ caName: ca.name,+ name,+ commonName,+ subjectAlternativeName,+ ttl,+ keyUsages: Object.entries(keyUsages)+ .filter(([, value]) => value)- .map(([key]) => key as CertKeyUsage),++ .map(([key]) =>++ key === CertKeyUsage.CRL_SIGN++ ? "cRLSign"++ : key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())++ ),+ extendedKeyUsages: Object.entries(extendedKeyUsages)+ .filter(([, value]) => value)- .map(([key]) => key as CertExtendedKeyUsage)++ .map(([key]) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()))+ });- createNotification({- text: "Successfully created certificate template",- type: "success"- });- }+ createNotification({+ text: "Successfully updated certificate template",+ type: "success"+ });+ } else {+ await createCertTemplate({+ projectId: currentProject.id,+ caName: ca.name,+ name,+ commonName,+ subjectAlternativeName,+ ttl,+ keyUsages: Object.entries(keyUsages)+ .filter(([, value]) => value)- .map(([key]) => key as CertKeyUsage),++ .map(([key]) =>++ key === CertKeyUsage.CRL_SIGN++ ? "cRLSign"++ : key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())++ ),+ extendedKeyUsages: Object.entries(extendedKeyUsages)+ .filter(([, value]) => value)- .map(([key]) => key as CertExtendedKeyUsage)++ .map(([key]) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()))+ });- reset();- handlePopUpToggle(false);- } catch (err) {- console.error(err);createNotification({- text: "Failed to save changes",- type: "error"+ text: "Successfully created certificate template",+ type: "success"});}++ reset();+ handlePopUpToggle(false);};return (diff --cc frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersTable.tsxindex fe71c207dd,25a6947054..66e1a3fa74--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersTable.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersTable.tsx@@@ -127,26 -127,34 +127,26 @@@ export const OrgMembersTable = (const onRoleChange = async (membershipId: string, role: string) => {if (!currentOrg?.id) return;- try {- // TODO: replace hardcoding default role- const isCustomRole = !["admin", "member", "no-access"].includes(role);-- if (isCustomRole && subscription && !subscription?.rbac) {- handlePopUpOpen("upgradePlan", {- text: "Your current plan does not include access to assigning custom roles to members. To unlock this feature, please upgrade to Infisical Pro plan."- });- return;- }+ // TODO: replace hardcoding default role+ const isCustomRole = !["admin", "member", "no-access"].includes(role);- await updateOrgMembership({- organizationId: currentOrg?.id,- membershipId,- role- });-- createNotification({- text: "Successfully updated user role",- type: "success"- });- } catch (error) {- console.error(error);- createNotification({- text: "Failed to update user role",- type: "error"+ if (isCustomRole && subscription && !subscription?.rbac) {+ handlePopUpOpen("upgradePlan", {- description: "You can assign custom roles to members if you switch to Infisical's Pro plan."++ text: "Your current plan does not include access to assigning custom roles to members. To unlock this feature, please upgrade to Infisical Pro plan."});+ return;}++ await updateOrgMembership({+ organizationId: currentOrg?.id,+ membershipId,+ role+ });++ createNotification({+ text: "Successfully updated user role",+ type: "success"+ });};const onResendInvite = async (membershipId: string) => {diff --cc frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsxindex 80ed795516,343b549da4..ba2d23abdc--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsx@@@ -34,46 -33,62 +33,46 @@@ export const OrgSSOSection = (): JSX.Elconst { mutateAsync: createMutateAsync } = useCreateSSOConfig();const handleSamlSSOToggle = async (value: boolean) => {- try {- if (!currentOrg?.id) return;+ if (!currentOrg?.id) return;- if (!subscription?.samlSSO) {- handlePopUpOpen("upgradePlan", {- text: "Your current plan does not include access to SAML SSO. To unlock this feature, please upgrade to Infisical Pro plan."- });- return;- }-- await mutateAsync({- organizationId: currentOrg?.id,- isActive: value- });-- createNotification({- text: `Successfully ${value ? "enabled" : "disabled"} SAML SSO`,- type: "success"- });- } catch (err) {- console.error(err);- createNotification({- text: `Failed to ${value ? "enable" : "disable"} SAML SSO`,- type: "error"+ if (!subscription?.samlSSO) {+ handlePopUpOpen("upgradePlan", {- description: "You can use SAML SSO if you switch to Infisical's Pro plan."++ text: "Your current plan does not include access to SAML SSO. To unlock this feature, please upgrade to Infisical Pro plan."});+ return;}- };- const handleSamlGroupManagement = async (value: boolean) => {- try {- if (!currentOrg?.id) return;+ await mutateAsync({+ organizationId: currentOrg?.id,+ isActive: value+ });- if (!subscription?.samlSSO || !subscription?.groups) {- handlePopUpOpen("upgradePlan", {- isEnterpriseFeature: true,- text: "Your current plan does not include access to SAML group mapping. To unlock this feature, please upgrade to Infisical Enterprise plan."- });- return;- }+ createNotification({+ text: `Successfully ${value ? "enabled" : "disabled"} SAML SSO`,+ type: "success"+ });+ };- await mutateAsync({- organizationId: currentOrg?.id,- enableGroupSync: value- });+ const handleSamlGroupManagement = async (value: boolean) => {+ if (!currentOrg?.id) return;- createNotification({- text: `Successfully ${value ? "enabled" : "disabled"} SAML group membership mapping`,- type: "success"- });- } catch (err) {- console.error(err);- createNotification({- text: `Failed to ${value ? "enable" : "disable"} SAML group membership mapping`,- type: "error"+ if (!subscription?.samlSSO || !subscription?.groups) {+ handlePopUpOpen("upgradePlan", {+ isEnterpriseFeature: true,- description: "You can use SAML group mapping if you switch to Infisical's Enterprise plan."++ text: "Your current plan does not include access to SAML group mapping. To unlock this feature, please upgrade to Infisical Enterprise plan."});+ return;}++ await mutateAsync({+ organizationId: currentOrg?.id,+ enableGroupSync: value+ });++ createNotification({+ text: `Successfully ${value ? "enabled" : "disabled"} SAML group membership mapping`,+ type: "success"+ });};const addSSOBtnClick = async () => {diff --cc frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsxindex 1618c73aa4,2490648a24..cf093c21a0--- a/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx+++ b/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx@@@ -39,33 -39,38 +39,31 @@@ export const AuditLogsRetentionSectionif (!currentProject) return null;const handleAuditLogsRetentionSubmit = async ({ auditLogsRetentionDays }: TForm) => {- try {- if (!subscription?.auditLogs) {- handlePopUpOpen("upgradePlan", {- text: "Configuring audit logs retention can be unlocked if you upgrade to Infisical Pro plan."- });-- return;- }-- if (subscription && auditLogsRetentionDays > subscription?.auditLogsRetentionDays) {- handlePopUpOpen("upgradePlan", {- text: "Updating audit logs retention period to a higher value can be unlocked if you upgrade to Infisical Pro plan."- });+ if (!subscription?.auditLogs) {+ handlePopUpOpen("upgradePlan", {- description:- "You can only configure audit logs retention if you switch to Infisical's Pro plan."++ text: "Configuring audit logs retention can be unlocked if you upgrade to Infisical Pro plan."+ });- return;- }+ return;+ }- await updateAuditLogsRetention({- auditLogsRetentionDays,- projectSlug: currentProject.slug+ if (subscription && auditLogsRetentionDays > subscription?.auditLogsRetentionDays) {+ handlePopUpOpen("upgradePlan", {- description:- "To update your audit logs retention period to a higher value, switch to Infisical's Pro plan."++ text: "Updating audit logs retention period to a higher value can be unlocked if you upgrade to Infisical Pro plan."});- createNotification({- text: "Successfully updated audit logs retention period",- type: "success"- });- } catch {- createNotification({- text: "Failed updating audit logs retention period",- type: "error"- });+ return;}++ await updateAuditLogsRetention({+ auditLogsRetentionDays,+ projectSlug: currentProject.slug+ });++ createNotification({+ text: "Successfully updated audit logs retention period",+ type: "success"+ });};// render only for dedicated/self-hosted instances of Infisical