Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

some review fixes

x0322057173e6d0dfeb
diff --git a/backend/src/ee/services/pam-domain/pam-domain-service.ts b/backend/src/ee/services/pam-domain/pam-domain-service.ts
index 9fc93af52c..bdeeda3a19 100644
--- a/backend/src/ee/services/pam-domain/pam-domain-service.ts
+++ b/backend/src/ee/services/pam-domain/pam-domain-service.ts
@@ -107,6 +107,13 @@ export const pamDomainServiceFactory = ({
})
);
+ const existingDomain = await pamDomainDAL.findOne({ name, projectId });
+ if (existingDomain) {
+ throw new BadRequestError({
+ message: `Domain with name '${name}' already exists in this project`
+ });
+ }
+
const factory = PAM_DOMAIN_FACTORY_MAP[domainType](
domainType,
connectionDetails,
@@ -375,19 +382,21 @@ export const pamDomainServiceFactory = ({
return Promise.all(
relatedResources.map(async (r) => {
+ const { encryptedConnectionDetails, encryptedRotationAccountCredentials, encryptedResourceMetadata, ...rest } =
+ r;
const rConnectionDetails = await decryptResourceConnectionDetails({
- encryptedConnectionDetails: r.encryptedConnectionDetails,
+ encryptedConnectionDetails,
projectId: domain.projectId,
kmsService
});
- const rotationAccountCredentials = r.encryptedRotationAccountCredentials
+ const rotationAccountCredentials = encryptedRotationAccountCredentials
? await decryptAccountCredentials({
- encryptedCredentials: r.encryptedRotationAccountCredentials,
+ encryptedCredentials: encryptedRotationAccountCredentials,
projectId: domain.projectId,
kmsService
})
: null;
- return { ...r, connectionDetails: rConnectionDetails, rotationAccountCredentials } as TWindowsResource;
+ return { ...rest, connectionDetails: rConnectionDetails, rotationAccountCredentials } as TWindowsResource;
})
);
};
diff --git a/backend/src/ee/services/pam-resource/pam-resource-fns.ts b/backend/src/ee/services/pam-resource/pam-resource-fns.ts
index c0be4813a3..93c0bdce9b 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-fns.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-fns.ts
@@ -119,16 +119,19 @@ export const decryptResource = async (
projectId: string,
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">
) => {
+ const { encryptedConnectionDetails, encryptedRotationAccountCredentials, encryptedResourceMetadata, ...rest } =
+ resource;
+
return {
- ...resource,
+ ...rest,
connectionDetails: await decryptResourceConnectionDetails({
- encryptedConnectionDetails: resource.encryptedConnectionDetails,
+ encryptedConnectionDetails,
projectId,
kmsService
}),
- rotationAccountCredentials: resource.encryptedRotationAccountCredentials
+ rotationAccountCredentials: encryptedRotationAccountCredentials
? await decryptAccountCredentials({
- encryptedCredentials: resource.encryptedRotationAccountCredentials,
+ encryptedCredentials: encryptedRotationAccountCredentials,
projectId,
kmsService
})
diff --git a/backend/src/ee/services/pam-resource/pam-resource-schemas.ts b/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
index f20e5fda62..83c7dc689e 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
@@ -22,6 +22,7 @@ export const GatewayAccessResponseSchema = z.object({
export const BasePamResourceSchema = PamResourcesSchema.omit({
encryptedConnectionDetails: true,
encryptedRotationAccountCredentials: true,
+ encryptedResourceMetadata: true,
resourceType: true
}).extend({
metadata: ResourceMetadataSchema.pick({ id: true, key: true, value: true }).array().optional()
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsTable.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsTable.tsx
index 7a0ba2ce3e..39a1c7de31 100644
--- a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsTable.tsx
+++ b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsTable.tsx
@@ -236,7 +236,7 @@ export const PamDomainsTable = ({ projectId }: Props) => {
<DeleteActionModal
isOpen={popUp.deleteDomain.isOpen}
title={`Delete domain "${(popUp.deleteDomain.data as TPamDomain)?.name}"?`}
- subTitle="This will permanently remove this domain and all associated accounts."
+ subTitle="This will permanently remove this domain. Associated resources will be unlinked but not deleted."
onChange={(isOpen) => handlePopUpToggle("deleteDomain", isOpen)}
deleteKey="confirm"
onDeleteApproved={handleDelete}