mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 21:27:31 +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,60 +274,65 @@ 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="mt-6">
|
<div className="space-y-8">
|
||||||
<p className="text-3xl font-semibold text-bunker-100">Secrets Overview</p>
|
<div className="mt-6">
|
||||||
<p className="text-md text-bunker-300">
|
<p className="text-3xl font-semibold text-bunker-100">Secrets Overview</p>
|
||||||
Inject your secrets using
|
<p className="text-md text-bunker-300">
|
||||||
<a
|
Inject your secrets using
|
||||||
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
<a
|
||||||
href="https://infisical.com/docs/cli/overview"
|
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
||||||
target="_blank"
|
href="https://infisical.com/docs/cli/overview"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
>
|
rel="noopener noreferrer"
|
||||||
Infisical CLI
|
>
|
||||||
</a>
|
Infisical CLI
|
||||||
,
|
</a>
|
||||||
<a
|
,
|
||||||
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
<a
|
||||||
href="https://infisical.com/docs/documentation/getting-started/api"
|
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
||||||
target="_blank"
|
href="https://infisical.com/docs/documentation/getting-started/api"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
>
|
rel="noopener noreferrer"
|
||||||
Infisical API
|
>
|
||||||
</a>
|
Infisical API
|
||||||
,
|
</a>
|
||||||
<a
|
,
|
||||||
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
<a
|
||||||
href="https://infisical.com/docs/sdks/overview"
|
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
||||||
target="_blank"
|
href="https://infisical.com/docs/sdks/overview"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
>
|
rel="noopener noreferrer"
|
||||||
Infisical SDKs
|
>
|
||||||
</a>
|
Infisical SDKs
|
||||||
, and
|
</a>
|
||||||
<a
|
, and
|
||||||
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
<a
|
||||||
href="https://infisical.com/docs/documentation/getting-started/introduction"
|
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
||||||
target="_blank"
|
href="https://infisical.com/docs/documentation/getting-started/introduction"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
>
|
rel="noopener noreferrer"
|
||||||
more
|
>
|
||||||
</a>
|
more
|
||||||
.
|
</a>
|
||||||
</p>
|
.
|
||||||
</div>
|
</p>
|
||||||
|
</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
|
||||||
className="h-[2.3rem] bg-mineshaft-800 placeholder-mineshaft-50 duration-200 focus:bg-mineshaft-700/80"
|
className="h-[2.3rem] bg-mineshaft-800 placeholder-mineshaft-50 duration-200 focus:bg-mineshaft-700/80"
|
||||||
placeholder="Search by secret/folder name..."
|
placeholder="Search by secret/folder name..."
|
||||||
value={searchFilter}
|
value={searchFilter}
|
||||||
onChange={(e) => setSearchFilter(e.target.value)}
|
onChange={(e) => setSearchFilter(e.target.value)}
|
||||||
leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
|
leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="thin-scrollbar mt-4" ref={parentTableRef}>
|
<div className="thin-scrollbar mt-4" ref={parentTableRef}>
|
||||||
|
|||||||
Reference in New Issue
Block a user