mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 02:27:37 +00:00
Merge pull request #1446 from Infisical/daniel/ghost-users-fixes
(Fix): Project upgrade
This commit is contained in:
@@ -419,10 +419,6 @@ export const projectMembershipServiceFactory = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.version === ProjectVersion.V1) {
|
|
||||||
throw new BadRequestError({ message: "Please upgrade your project on your dashboard" });
|
|
||||||
}
|
|
||||||
|
|
||||||
const projectMembers = await projectMembershipDAL.findMembershipsByEmail(projectId, emails);
|
const projectMembers = await projectMembershipDAL.findMembershipsByEmail(projectId, emails);
|
||||||
|
|
||||||
if (projectMembers.length !== emails.length) {
|
if (projectMembers.length !== emails.length) {
|
||||||
|
|||||||
@@ -33,11 +33,12 @@ export const assignWorkspaceKeysToMembers = ({ members, decryptKey, userPrivateK
|
|||||||
type TCreateProjectKeyDTO = {
|
type TCreateProjectKeyDTO = {
|
||||||
publicKey: string;
|
publicKey: string;
|
||||||
privateKey: string;
|
privateKey: string;
|
||||||
|
plainProjectKey?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createProjectKey = ({ publicKey, privateKey }: TCreateProjectKeyDTO) => {
|
export const createProjectKey = ({ publicKey, privateKey, plainProjectKey }: TCreateProjectKeyDTO) => {
|
||||||
// 3. Create a random key that we'll use as the project key.
|
// 3. Create a random key that we'll use as the project key.
|
||||||
const randomBytes = crypto.randomBytes(16).toString("hex");
|
const randomBytes = plainProjectKey || crypto.randomBytes(16).toString("hex");
|
||||||
|
|
||||||
// 4. Encrypt the project key with the users key pair.
|
// 4. Encrypt the project key with the users key pair.
|
||||||
const { ciphertext: encryptedProjectKey, nonce: encryptedProjectKeyIv } = encryptAsymmetric(
|
const { ciphertext: encryptedProjectKey, nonce: encryptedProjectKeyIv } = encryptAsymmetric(
|
||||||
|
|||||||
@@ -122,6 +122,13 @@ export const projectQueueFactory = ({
|
|||||||
tag: data.encryptedPrivateKey.encryptedKeyTag
|
tag: data.encryptedPrivateKey.encryptedKeyTag
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const decryptedPlainProjectKey = decryptAsymmetric({
|
||||||
|
ciphertext: oldProjectKey.encryptedKey,
|
||||||
|
nonce: oldProjectKey.nonce,
|
||||||
|
publicKey: oldProjectKey.sender.publicKey,
|
||||||
|
privateKey: userPrivateKey
|
||||||
|
});
|
||||||
|
|
||||||
const projectEnvs = await projectEnvDAL.find({
|
const projectEnvs = await projectEnvDAL.find({
|
||||||
projectId: project.id
|
projectId: project.id
|
||||||
});
|
});
|
||||||
@@ -199,6 +206,7 @@ export const projectQueueFactory = ({
|
|||||||
|
|
||||||
// Create a project key
|
// Create a project key
|
||||||
const { key: newEncryptedProjectKey, iv: newEncryptedProjectKeyIv } = createProjectKey({
|
const { key: newEncryptedProjectKey, iv: newEncryptedProjectKeyIv } = createProjectKey({
|
||||||
|
plainProjectKey: decryptedPlainProjectKey,
|
||||||
publicKey: ghostUser.keys.publicKey,
|
publicKey: ghostUser.keys.publicKey,
|
||||||
privateKey: ghostUser.keys.plainPrivateKey
|
privateKey: ghostUser.keys.plainPrivateKey
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
---
|
---
|
||||||
title: "Create Workspace"
|
title: "Create Project"
|
||||||
openapi: "POST /api/v2/workspace"
|
openapi: "POST /api/v2/workspace"
|
||||||
---
|
---
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: "Delete Workspace"
|
title: "Delete Project"
|
||||||
openapi: "DELETE /api/v1/workspace/{workspaceId}"
|
openapi: "DELETE /api/v1/workspace/{workspaceId}"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
---
|
---
|
||||||
title: "Get Workspace"
|
title: "Get Project"
|
||||||
openapi: "GET /api/v1/workspace/{workspaceId}"
|
openapi: "GET /api/v1/workspace/{workspaceId}"
|
||||||
---
|
---
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
---
|
---
|
||||||
title: "Update Workspace"
|
title: "Update Project"
|
||||||
openapi: "PATCH /api/v1/workspace/{workspaceId}"
|
openapi: "PATCH /api/v1/workspace/{workspaceId}"
|
||||||
---
|
---
|
||||||
@@ -29,7 +29,7 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
Tr
|
Tr
|
||||||
} from "@app/components/v2";
|
} from "@app/components/v2";
|
||||||
// import { UpgradeProjectAlert } from "@app/components/v2/UpgradeProjectAlert";
|
import { UpgradeProjectAlert } from "@app/components/v2/UpgradeProjectAlert";
|
||||||
import { useOrganization, useWorkspace } from "@app/context";
|
import { useOrganization, useWorkspace } from "@app/context";
|
||||||
import {
|
import {
|
||||||
useCreateFolder,
|
useCreateFolder,
|
||||||
@@ -40,8 +40,8 @@ import {
|
|||||||
useGetUserWsKey,
|
useGetUserWsKey,
|
||||||
useUpdateSecretV3
|
useUpdateSecretV3
|
||||||
} from "@app/hooks/api";
|
} from "@app/hooks/api";
|
||||||
|
import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
||||||
|
|
||||||
// import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
|
||||||
import { FolderBreadCrumbs } from "./components/FolderBreadCrumbs";
|
import { FolderBreadCrumbs } from "./components/FolderBreadCrumbs";
|
||||||
import { ProjectIndexSecretsSection } from "./components/ProjectIndexSecretsSection";
|
import { ProjectIndexSecretsSection } from "./components/ProjectIndexSecretsSection";
|
||||||
import { SecretOverviewFolderRow } from "./components/SecretOverviewFolderRow";
|
import { SecretOverviewFolderRow } from "./components/SecretOverviewFolderRow";
|
||||||
@@ -274,6 +274,7 @@ export const SecretOverviewPage = () => {
|
|||||||
<div className="relative right-5 ml-4">
|
<div className="relative right-5 ml-4">
|
||||||
<NavHeader pageName={t("dashboard.title")} isProjectRelated />
|
<NavHeader pageName={t("dashboard.title")} isProjectRelated />
|
||||||
</div>
|
</div>
|
||||||
|
<div className="space-y-8">
|
||||||
<div className="mt-6">
|
<div className="mt-6">
|
||||||
<p className="text-3xl font-semibold text-bunker-100">Secrets Overview</p>
|
<p className="text-3xl font-semibold text-bunker-100">Secrets Overview</p>
|
||||||
<p className="text-md text-bunker-300">
|
<p className="text-md text-bunker-300">
|
||||||
@@ -317,8 +318,11 @@ export const SecretOverviewPage = () => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{currentWorkspace?.version === ProjectVersion.V1 && (
|
||||||
|
<UpgradeProjectAlert project={currentWorkspace} />
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="mt-8 flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<FolderBreadCrumbs secretPath={secretPath} onResetSearch={handleResetSearch} />
|
<FolderBreadCrumbs secretPath={secretPath} onResetSearch={handleResetSearch} />
|
||||||
<div className="w-80">
|
<div className="w-80">
|
||||||
<Input
|
<Input
|
||||||
@@ -330,6 +334,7 @@ export const SecretOverviewPage = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div className="thin-scrollbar mt-4" ref={parentTableRef}>
|
<div className="thin-scrollbar mt-4" ref={parentTableRef}>
|
||||||
<TableContainer className="max-h-[calc(100vh-250px)] overflow-y-auto">
|
<TableContainer className="max-h-[calc(100vh-250px)] overflow-y-auto">
|
||||||
<Table>
|
<Table>
|
||||||
|
|||||||
Reference in New Issue
Block a user