mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 17:27:40 +00:00
Merge pull request #786 from Infisical/debug-integrations
Fix PATCH IP whitelist behavior and breaking integrations due to incorrect project id in local storage
This commit is contained in:
@@ -3,6 +3,7 @@ import { PipelineStage, Types } from "mongoose";
|
|||||||
import { Secret } from "../../../models";
|
import { Secret } from "../../../models";
|
||||||
import {
|
import {
|
||||||
FolderVersion,
|
FolderVersion,
|
||||||
|
IPType,
|
||||||
ISecretVersion,
|
ISecretVersion,
|
||||||
Log,
|
Log,
|
||||||
SecretSnapshot,
|
SecretSnapshot,
|
||||||
@@ -675,23 +676,38 @@ export const updateWorkspaceTrustedIp = async (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { ipAddress, type, prefix } = extractIPDetails(ip);
|
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(
|
const trustedIp = await TrustedIP.findOneAndUpdate(
|
||||||
{
|
{
|
||||||
_id: new Types.ObjectId(trustedIpId),
|
_id: new Types.ObjectId(trustedIpId),
|
||||||
workspace: new Types.ObjectId(workspaceId),
|
workspace: new Types.ObjectId(workspaceId),
|
||||||
},
|
},
|
||||||
{
|
updateObject,
|
||||||
ipAddress,
|
|
||||||
type,
|
|
||||||
prefix,
|
|
||||||
comment
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
new: true
|
new: true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
trustedIp
|
trustedIp
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -330,6 +330,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
|
|||||||
className="w-full truncate bg-mineshaft-600 py-2.5 font-medium"
|
className="w-full truncate bg-mineshaft-600 py-2.5 font-medium"
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
router.push(`/project/${value}/secrets`);
|
router.push(`/project/${value}/secrets`);
|
||||||
|
localStorage.setItem("projectData.id", value);
|
||||||
}}
|
}}
|
||||||
position="popper"
|
position="popper"
|
||||||
dropdownContainerClassName="text-bunker-200 bg-mineshaft-800 border border-mineshaft-600 z-50 max-h-96 border-gray-700"
|
dropdownContainerClassName="text-bunker-200 bg-mineshaft-800 border border-mineshaft-600 z-50 max-h-96 border-gray-700"
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { useEffect, useState } from "react";
|
|||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import Link from "next/link";
|
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { IconProp } from "@fortawesome/fontawesome-svg-core";
|
import { IconProp } from "@fortawesome/fontawesome-svg-core";
|
||||||
import { faSlack } from "@fortawesome/free-brands-svg-icons";
|
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">
|
{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-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>
|
<div className="text-sm text-mineshaft-300 mt-0 pb-6">{(workspace.environments?.length || 0)} environments</div>
|
||||||
<Link href={`/project/${workspace._id}/secrets`}>
|
<button type="button" onClick={() => {
|
||||||
<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>
|
router.push(`/project/${workspace._id}/secrets`);
|
||||||
</Link>
|
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>)}
|
||||||
</div>
|
</div>
|
||||||
{orgWorkspaces.length === 0 && (
|
{orgWorkspaces.length === 0 && (
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const redirectForProviderAuth = (integrationOption: TCloudIntegration) =>
|
|||||||
// generate CSRF token for OAuth2 code-token exchange integrations
|
// generate CSRF token for OAuth2 code-token exchange integrations
|
||||||
const state = crypto.randomBytes(16).toString("hex");
|
const state = crypto.randomBytes(16).toString("hex");
|
||||||
localStorage.setItem("latestCSRFToken", state);
|
localStorage.setItem("latestCSRFToken", state);
|
||||||
|
|
||||||
let link = "";
|
let link = "";
|
||||||
switch (integrationOption.slug) {
|
switch (integrationOption.slug) {
|
||||||
case "azure-key-vault":
|
case "azure-key-vault":
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ export const CloudIntegrationSection = ({
|
|||||||
const isEmpty = !isLoading && !cloudIntegrations?.length;
|
const isEmpty = !isLoading && !cloudIntegrations?.length;
|
||||||
|
|
||||||
const sortedCloudIntegrations = cloudIntegrations.sort((a, b) => a.name.localeCompare(b.name));
|
const sortedCloudIntegrations = cloudIntegrations.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="m-4 mt-7 flex max-w-5xl flex-col items-start justify-between px-2 text-xl">
|
<div className="m-4 mt-7 flex max-w-5xl flex-col items-start justify-between px-2 text-xl">
|
||||||
|
|||||||
@@ -55,10 +55,16 @@ export const IPAllowlistModal = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const trustedIpData = popUp?.trustedIp?.data as {
|
||||||
|
ipAddress: string;
|
||||||
|
comment: string;
|
||||||
|
prefix: number;
|
||||||
|
};
|
||||||
|
|
||||||
if (popUp?.trustedIp?.data) {
|
if (popUp?.trustedIp?.data) {
|
||||||
reset(popUp?.trustedIp?.data as {
|
reset({
|
||||||
ipAddress: string;
|
ipAddress: `${trustedIpData.ipAddress}${trustedIpData.prefix !== undefined ? `/${trustedIpData.prefix}` : ""}`,
|
||||||
comment: string;
|
comment: trustedIpData.comment
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
reset({
|
reset({
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ type Props = {
|
|||||||
ipAddress?: string;
|
ipAddress?: string;
|
||||||
comment?: string;
|
comment?: string;
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
|
prefix?: number;
|
||||||
},
|
},
|
||||||
) => void;
|
) => void;
|
||||||
handlePopUpToggle: (popUpName: keyof UsePopUpState<["upgradePlan"]>, state?: boolean) => void;
|
handlePopUpToggle: (popUpName: keyof UsePopUpState<["upgradePlan"]>, state?: boolean) => void;
|
||||||
@@ -103,6 +104,7 @@ export const IPAllowlistTable = ({
|
|||||||
trustedIpId: _id,
|
trustedIpId: _id,
|
||||||
ipAddress,
|
ipAddress,
|
||||||
comment,
|
comment,
|
||||||
|
prefix,
|
||||||
isActive
|
isActive
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user