Skip to content

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

fix: addressed rabbit findings

Sheen Capadnganf0e6bcef9b1a
diff --git a/backend/src/ee/routes/v1/kmip-operation-router.ts b/backend/src/ee/routes/v1/kmip-operation-router.ts
index f0a86b1815..83414dd16a 100644
--- a/backend/src/ee/routes/v1/kmip-operation-router.ts
+++ b/backend/src/ee/routes/v1/kmip-operation-router.ts
@@ -236,7 +236,7 @@ export const registerKmipOperationRouter = async (server: FastifyZodProvider) =>
},
onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
- const object = await server.services.kmipOperation.deleteOp({
+ const object = await server.services.kmipOperation.destroy({
...req.kmipUser,
actor: req.permission.type,
actorId: req.permission.id,
@@ -255,7 +255,7 @@ export const registerKmipOperationRouter = async (server: FastifyZodProvider) =>
}
},
event: {
- type: EventType.KMIP_OPERATION_DELETE,
+ type: EventType.KMIP_OPERATION_DESTROY,
metadata: {
id: object.id
}
diff --git a/backend/src/ee/routes/v1/kmip-router.ts b/backend/src/ee/routes/v1/kmip-router.ts
index bc73e08876..45ab5044ba 100644
--- a/backend/src/ee/routes/v1/kmip-router.ts
+++ b/backend/src/ee/routes/v1/kmip-router.ts
@@ -61,6 +61,8 @@ export const registerKmipRouter = async (server: FastifyZodProvider) => {
}
}
});
+
+ return kmipClient;
}
});
@@ -107,6 +109,8 @@ export const registerKmipRouter = async (server: FastifyZodProvider) => {
}
}
});
+
+ return kmipClient;
}
});
@@ -145,6 +149,8 @@ export const registerKmipRouter = async (server: FastifyZodProvider) => {
}
}
});
+
+ return kmipClient;
}
});
@@ -183,6 +189,8 @@ export const registerKmipRouter = async (server: FastifyZodProvider) => {
}
}
});
+
+ return kmipClient;
}
});
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index 2c61d3c282..440386b188 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -275,7 +275,7 @@ export enum EventType {
KMIP_OPERATION_CREATE = "kmip-operation-create",
KMIP_OPERATION_GET = "kmip-operation-get",
- KMIP_OPERATION_DELETE = "kmip-operation-delete",
+ KMIP_OPERATION_DESTROY = "kmip-operation-destroy",
KMIP_OPERATION_GET_ATTRIBUTES = "kmip-operation-get-attributes",
KMIP_OPERATION_ACTIVATE = "kmip-operation-activate",
KMIP_OPERATION_REVOKE = "kmip-operation-revoke",
@@ -2178,8 +2178,8 @@ interface KmipOperationGetEvent {
};
}
-interface KmipOperationDeleteEvent {
- type: EventType.KMIP_OPERATION_DELETE;
+interface KmipOperationDestroyEvent {
+ type: EventType.KMIP_OPERATION_DESTROY;
metadata: {
id: string;
};
@@ -2457,7 +2457,7 @@ export type Event =
| GetKmipEvent
| RegisterKmipServerEvent
| KmipOperationGetEvent
- | KmipOperationDeleteEvent
+ | KmipOperationDestroyEvent
| KmipOperationCreateEvent
| KmipOperationGetAttributesEvent
| KmipOperationActivateEvent
diff --git a/backend/src/ee/services/kmip/kmip-enum.ts b/backend/src/ee/services/kmip/kmip-enum.ts
index 0e56feeac8..80af88e1c4 100644
--- a/backend/src/ee/services/kmip/kmip-enum.ts
+++ b/backend/src/ee/services/kmip/kmip-enum.ts
@@ -6,6 +6,6 @@ export enum KmipPermission {
GetAttributes = "get-attributes",
Activate = "activate",
Revoke = "revoke",
- Delete = "delete",
+ Destroy = "destroy",
Register = "register"
}
diff --git a/backend/src/ee/services/kmip/kmip-operation-service.ts b/backend/src/ee/services/kmip/kmip-operation-service.ts
index dddfe331e2..66c3a1d46b 100644
--- a/backend/src/ee/services/kmip/kmip-operation-service.ts
+++ b/backend/src/ee/services/kmip/kmip-operation-service.ts
@@ -11,7 +11,7 @@ import { TKmipClientDALFactory } from "./kmip-client-dal";
import { KmipPermission } from "./kmip-enum";
import {
TKmipCreateDTO,
- TKmipDeleteDTO,
+ TKmipDestroyDTO,
TKmipGetAttributesDTO,
TKmipGetDTO,
TKmipLocateDTO,
@@ -76,7 +76,7 @@ export const kmipOperationServiceFactory = ({
return kmsKey;
};
- const deleteOp = async ({ projectId, id, clientId, actor, actorId, actorOrgId, actorAuthMethod }: TKmipDeleteDTO) => {
+ const destroy = async ({ projectId, id, clientId, actor, actorId, actorOrgId, actorAuthMethod }: TKmipDestroyDTO) => {
const { permission } = await permissionService.getOrgPermission(
actor,
actorId,
@@ -92,9 +92,9 @@ export const kmipOperationServiceFactory = ({
projectId
});
- if (!kmipClient.permissions?.includes(KmipPermission.Delete)) {
+ if (!kmipClient.permissions?.includes(KmipPermission.Destroy)) {
throw new ForbiddenRequestError({
- message: "Client does not have sufficient permission to perform KMIP delete"
+ message: "Client does not have sufficient permission to perform KMIP destroy"
});
}
@@ -108,13 +108,19 @@ export const kmipOperationServiceFactory = ({
}
if (key.isReserved) {
- throw new BadRequestError({ message: "Cannot delete reserved keys" });
+ throw new BadRequestError({ message: "Cannot destroy reserved keys" });
}
const completeKeyDetails = await kmsDAL.findByIdWithAssociatedKms(id);
if (!completeKeyDetails.internalKms) {
throw new BadRequestError({
- message: "Cannot delete external keys"
+ message: "Cannot destroy external keys"
+ });
+ }
+
+ if (!completeKeyDetails.isDisabled) {
+ throw new BadRequestError({
+ message: "Cannot destroy active keys"
});
}
@@ -408,7 +414,7 @@ export const kmipOperationServiceFactory = ({
get,
activate,
getAttributes,
- deleteOp,
+ destroy,
revoke,
locate,
register
diff --git a/backend/src/ee/services/kmip/kmip-types.ts b/backend/src/ee/services/kmip/kmip-types.ts
index fd98081871..a259a79b83 100644
--- a/backend/src/ee/services/kmip/kmip-types.ts
+++ b/backend/src/ee/services/kmip/kmip-types.ts
@@ -60,7 +60,7 @@ export type TKmipGetAttributesDTO = {
id: string;
} & KmipOperationBaseDTO;
-export type TKmipDeleteDTO = {
+export type TKmipDestroyDTO = {
id: string;
} & KmipOperationBaseDTO;
diff --git a/cli/go.mod b/cli/go.mod
index 9fa595250f..cd957a5840 100644
--- a/cli/go.mod
+++ b/cli/go.mod
@@ -11,7 +11,7 @@ require (
github.com/gitleaks/go-gitdiff v0.8.0
github.com/h2non/filetype v1.1.3
github.com/infisical/go-sdk v0.4.8
- github.com/infisical/infisical-kmip v0.3.3
+ github.com/infisical/infisical-kmip v0.3.4
github.com/mattn/go-isatty v0.0.20
github.com/muesli/ansi v0.0.0-20221106050444-61f0cd9a192a
github.com/muesli/mango-cobra v1.2.0
diff --git a/cli/go.sum b/cli/go.sum
index ad4b699da0..c6d4d26c0d 100644
--- a/cli/go.sum
+++ b/cli/go.sum
@@ -273,8 +273,8 @@ github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7P
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/infisical/go-sdk v0.4.8 h1:aphRnaauC5//PkP1ZbY9RSK2RiT1LjPS5o4CbX0x5OQ=
github.com/infisical/go-sdk v0.4.8/go.mod h1:bMO9xSaBeXkDBhTIM4FkkREAfw2V8mv5Bm7lvo4+uDk=
-github.com/infisical/infisical-kmip v0.3.3 h1:RNOlUsuYy81kS0yrT2n9O54VMo8NoiqLAgw5ZgYAxEo=
-github.com/infisical/infisical-kmip v0.3.3/go.mod h1:bO1M4YtKyutNg1bREPmlyZspC5duSR7hyQ3lPmLzrIs=
+github.com/infisical/infisical-kmip v0.3.4 h1:X7wsW/vnqrTAtilYyuz+xFtkUu025wD5Yfk2u/LbniQ=
+github.com/infisical/infisical-kmip v0.3.4/go.mod h1:bO1M4YtKyutNg1bREPmlyZspC5duSR7hyQ3lPmLzrIs=
github.com/jedib0t/go-pretty v4.3.0+incompatible h1:CGs8AVhEKg/n9YbUenWmNStRW2PHJzaeDodcfvRAbIo=
github.com/jedib0t/go-pretty v4.3.0+incompatible/go.mod h1:XemHduiw8R651AF9Pt4FwCTKeG3oo7hrHJAoznj9nag=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
diff --git a/cli/packages/cmd/kmip.go b/cli/packages/cmd/kmip.go
index 1d589d756d..dbee60c5ff 100644
--- a/cli/packages/cmd/kmip.go
+++ b/cli/packages/cmd/kmip.go
@@ -78,10 +78,6 @@ func startKmipServer(cmd *cobra.Command, args []string) {
util.HandleError(err, "Unable to parse flag")
}
- if hostnamesOrIps == "" {
- util.PrintErrorMessageAndExit("missing value for field hostnames-or-ips")
- }
-
kmip.StartServer(kmip.ServerConfig{
Addr: addr,
InfisicalBaseAPIURL: config.INFISICAL_URL,
diff --git a/frontend/src/hooks/api/admin/queries.ts b/frontend/src/hooks/api/admin/queries.ts
index 6084645f9a..12ae1cf646 100644
--- a/frontend/src/hooks/api/admin/queries.ts
+++ b/frontend/src/hooks/api/admin/queries.ts
@@ -18,8 +18,7 @@ export const adminQueryKeys = {
serverConfig: () => ["server-config"] as const,
getUsers: (filters: AdminGetUsersFilters) => [adminStandaloneKeys.getUsers, { filters }] as const,
getAdminSlackConfig: () => ["admin-slack-config"] as const,
- getServerEncryptionStrategies: () => ["server-encryption-strategies"] as const,
- getInstanceKmip: () => ["instance-kmip"] as const
+ getServerEncryptionStrategies: () => ["server-encryption-strategies"] as const
};
export const fetchServerConfig = async () => {
diff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsx
index a0624bc9bc..39c351e385 100644
--- a/frontend/src/hooks/api/auditLogs/constants.tsx
+++ b/frontend/src/hooks/api/auditLogs/constants.tsx
@@ -133,7 +133,7 @@ export const eventToNameMap: { [K in EventType]: string } = {
[EventType.REGISTER_KMIP_SERVER]: "Register KMIP server",
[EventType.KMIP_OPERATION_CREATE]: "KMIP operation create",
[EventType.KMIP_OPERATION_GET]: "KMIP operation get",
- [EventType.KMIP_OPERATION_DELETE]: "KMIP operation delete",
+ [EventType.KMIP_OPERATION_DESTROY]: "KMIP operation destroy",
[EventType.KMIP_OPERATION_GET_ATTRIBUTES]: "KMIP operation get attributes",
[EventType.KMIP_OPERATION_ACTIVATE]: "KMIP operation activate",
[EventType.KMIP_OPERATION_REVOKE]: "KMIP operation revoke",
diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx
index 7f8b86549c..ed25c6e4ad 100644
--- a/frontend/src/hooks/api/auditLogs/enums.tsx
+++ b/frontend/src/hooks/api/auditLogs/enums.tsx
@@ -145,7 +145,7 @@ export enum EventType {
REGISTER_KMIP_SERVER = "register-kmip-server",
KMIP_OPERATION_CREATE = "kmip-operation-create",
KMIP_OPERATION_GET = "kmip-operation-get",
- KMIP_OPERATION_DELETE = "kmip-operation-delete",
+ KMIP_OPERATION_DESTROY = "kmip-operation-destroy",
KMIP_OPERATION_GET_ATTRIBUTES = "kmip-operation-get-attributes",
KMIP_OPERATION_ACTIVATE = "kmip-operation-activate",
KMIP_OPERATION_REVOKE = "kmip-operation-revoke",
diff --git a/frontend/src/hooks/api/kmip/types.ts b/frontend/src/hooks/api/kmip/types.ts
index d065fd3fe5..c406a44d13 100644
--- a/frontend/src/hooks/api/kmip/types.ts
+++ b/frontend/src/hooks/api/kmip/types.ts
@@ -9,7 +9,7 @@ export enum KmipPermission {
GetAttributes = "get-attributes",
Activate = "activate",
Revoke = "revoke",
- Delete = "delete",
+ Destroy = "destroy",
Register = "register"
}
diff --git a/frontend/src/pages/kms/KmipPage/components/KmipClientModal.tsx b/frontend/src/pages/kms/KmipPage/components/KmipClientModal.tsx
index 58a845253c..4bab2c10ff 100644
--- a/frontend/src/pages/kms/KmipPage/components/KmipClientModal.tsx
+++ b/frontend/src/pages/kms/KmipPage/components/KmipClientModal.tsx
@@ -22,7 +22,7 @@ const KMIP_PERMISSIONS_OPTIONS = [
{ value: KmipPermission.Create, label: "Create" },
{ value: KmipPermission.Get, label: "Get" },
{ value: KmipPermission.Locate, label: "Locate" },
- { value: KmipPermission.Delete, label: "Delete" },
+ { value: KmipPermission.Destroy, label: "Destroy" },
{ value: KmipPermission.Activate, label: "Activate" },
{ value: KmipPermission.Revoke, label: "Revoke" },
{ value: KmipPermission.GetAttributes, label: "Get Attributes" },
@@ -37,7 +37,7 @@ const formSchema = z.object({
[KmipPermission.Create]: z.boolean().optional(),
[KmipPermission.Get]: z.boolean().optional(),
[KmipPermission.Locate]: z.boolean().optional(),
- [KmipPermission.Delete]: z.boolean().optional(),
+ [KmipPermission.Destroy]: z.boolean().optional(),
[KmipPermission.Activate]: z.boolean().optional(),
[KmipPermission.GetAttributes]: z.boolean().optional(),
[KmipPermission.Revoke]: z.boolean().optional(),