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
Fix IP whitelist PATCH endpoint, update localStorage project id to reflect navigated to project
Tuan Dang7ae6d1610fdd
diff --git a/backend/src/ee/controllers/v1/workspaceController.ts b/backend/src/ee/controllers/v1/workspaceController.tsindex 64b6980f86..d4f097ea20 100644--- a/backend/src/ee/controllers/v1/workspaceController.ts+++ b/backend/src/ee/controllers/v1/workspaceController.ts@@ -3,6 +3,7 @@ import { PipelineStage, Types } from "mongoose";import { Secret } from "../../../models";import {FolderVersion,+ IPType,ISecretVersion,Log,SecretSnapshot,@@ -675,23 +676,38 @@ export const updateWorkspaceTrustedIp = async (req: Request, res: Response) => {});const { ipAddress, type, prefix } = extractIPDetails(ip);++ const updateObject: {+ ipAddress: string;+ type: IPType;+ comment: string;+ prefix?: number;+ $unset?: {+ prefix: number;+ }+ } = {+ ipAddress,+ type,+ comment+ };++ if (prefix !== undefined) {+ updateObject.prefix = prefix;+ } else {+ updateObject.$unset = { prefix: 1 };+ }const trustedIp = await TrustedIP.findOneAndUpdate({_id: new Types.ObjectId(trustedIpId),workspace: new Types.ObjectId(workspaceId),},- {- ipAddress,- type,- prefix,- comment- },+ updateObject,{new: true});-+return res.status(200).send({trustedIp});diff --git a/frontend/src/layouts/AppLayout/AppLayout.tsx b/frontend/src/layouts/AppLayout/AppLayout.tsxindex f25c2d05ae..6c9e04f552 100644--- a/frontend/src/layouts/AppLayout/AppLayout.tsx+++ b/frontend/src/layouts/AppLayout/AppLayout.tsx@@ -330,6 +330,7 @@ export const AppLayout = ({ children }: LayoutProps) => {className="w-full truncate bg-mineshaft-600 py-2.5 font-medium"onValueChange={(value) => {router.push(`/project/${value}/secrets`);+ localStorage.setItem("projectData.id", value);}}position="popper"dropdownContainerClassName="text-bunker-200 bg-mineshaft-800 border border-mineshaft-600 z-50 max-h-96 border-gray-700"diff --git a/frontend/src/pages/org/[id]/overview/index.tsx b/frontend/src/pages/org/[id]/overview/index.tsxindex 45b9a17437..693af4d6fc 100644--- a/frontend/src/pages/org/[id]/overview/index.tsx+++ b/frontend/src/pages/org/[id]/overview/index.tsx@@ -5,7 +5,6 @@ import { useEffect, useState } from "react";import { Controller, useForm } from "react-hook-form";import { useTranslation } from "react-i18next";import Head from "next/head";-import Link from "next/link";import { useRouter } from "next/router";import { IconProp } from "@fortawesome/fontawesome-svg-core";import { faSlack } from "@fortawesome/free-brands-svg-icons";@@ -325,9 +324,12 @@ export default function Organization() {{orgWorkspaces.filter(ws => ws?.name?.toLowerCase().includes(searchFilter.toLowerCase())).map(workspace => <div key={workspace._id} className="h-40 min-w-72 rounded-md bg-mineshaft-800 border border-mineshaft-600 p-4 flex flex-col justify-between"><div className="text-lg text-mineshaft-100 mt-0">{workspace.name}</div><div className="text-sm text-mineshaft-300 mt-0 pb-6">{(workspace.environments?.length || 0)} environments</div>- <Link href={`/project/${workspace._id}/secrets`}>- <div className="group cursor-default ml-auto hover:bg-primary-800/20 text-sm text-mineshaft-300 hover:text-mineshaft-200 bg-mineshaft-900 py-2 px-4 rounded-full w-max border border-mineshaft-600 hover:border-primary-500/80">Explore <FontAwesomeIcon icon={faArrowRight} className="pl-1.5 pr-0.5 group-hover:pl-2 group-hover:pr-0 duration-200" /></div>- </Link>+ <button type="button" onClick={() => {+ router.push(`/project/${workspace._id}/secrets`);+ localStorage.setItem("projectData.id", workspace._id);+ }}>+ <div className="group cursor-default ml-auto hover:bg-primary-800/20 text-sm text-mineshaft-300 hover:text-mineshaft-200 bg-mineshaft-900 py-2 px-4 rounded-full w-max border border-mineshaft-600 hover:border-primary-500/80">Explore <FontAwesomeIcon icon={faArrowRight} className="pl-1.5 pr-0.5 group-hover:pl-2 group-hover:pr-0 duration-200" /></div>+ </button></div>)}</div>{orgWorkspaces.length === 0 && (diff --git a/frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsx b/frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsxindex 7ec4a15a8d..1beb4038ef 100644--- a/frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsx+++ b/frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsx@@ -35,7 +35,7 @@ export const redirectForProviderAuth = (integrationOption: TCloudIntegration) =>// generate CSRF token for OAuth2 code-token exchange integrationsconst state = crypto.randomBytes(16).toString("hex");localStorage.setItem("latestCSRFToken", state);-+let link = "";switch (integrationOption.slug) {case "azure-key-vault":diff --git a/frontend/src/views/IntegrationsPage/components/CloudIntegrationSection/CloudIntegrationSection.tsx b/frontend/src/views/IntegrationsPage/components/CloudIntegrationSection/CloudIntegrationSection.tsxindex e8e761a0f2..7f458d5e59 100644--- a/frontend/src/views/IntegrationsPage/components/CloudIntegrationSection/CloudIntegrationSection.tsx+++ b/frontend/src/views/IntegrationsPage/components/CloudIntegrationSection/CloudIntegrationSection.tsx@@ -32,7 +32,7 @@ export const CloudIntegrationSection = ({const isEmpty = !isLoading && !cloudIntegrations?.length;const sortedCloudIntegrations = cloudIntegrations.sort((a, b) => a.name.localeCompare(b.name));-+return (<div><div className="m-4 mt-7 flex max-w-5xl flex-col items-start justify-between px-2 text-xl">diff --git a/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistModal.tsx b/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistModal.tsxindex 07de4425e6..d6e746d1a1 100644--- a/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistModal.tsx+++ b/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistModal.tsx@@ -55,10 +55,16 @@ export const IPAllowlistModal = ({});useEffect(() => {+ const trustedIpData = popUp?.trustedIp?.data as {+ ipAddress: string;+ comment: string;+ prefix: number;+ };+if (popUp?.trustedIp?.data) {- reset(popUp?.trustedIp?.data as {- ipAddress: string;- comment: string;+ reset({+ ipAddress: `${trustedIpData.ipAddress}${trustedIpData.prefix !== undefined ? `/${trustedIpData.prefix}` : ""}`,+ comment: trustedIpData.comment});} else {reset({diff --git a/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistTable.tsx b/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistTable.tsxindex cd93d7c1b6..d160f15dbd 100644--- a/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistTable.tsx+++ b/frontend/src/views/Project/IPAllowListPage/components/IPAllowlistTable.tsx@@ -29,6 +29,7 @@ type Props = {ipAddress?: string;comment?: string;isActive?: boolean;+ prefix?: number;},) => void;handlePopUpToggle: (popUpName: keyof UsePopUpState<["upgradePlan"]>, state?: boolean) => void;@@ -103,6 +104,7 @@ export const IPAllowlistTable = ({trustedIpId: _id,ipAddress,comment,+ prefix,isActive});} else {