Skip to content

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

dont expose credentials of revoked tokens

Matheus Nogueira502dc1b98fd3
diff --git a/backend/src/ee/services/honey-token/honey-token-service.ts b/backend/src/ee/services/honey-token/honey-token-service.ts
index 10e21eb37d..fcf78afc86 100644
--- a/backend/src/ee/services/honey-token/honey-token-service.ts
+++ b/backend/src/ee/services/honey-token/honey-token-service.ts
@@ -860,6 +860,9 @@ export const honeyTokenServiceFactory = ({
if (!honeyToken) {
throw new NotFoundError({ message: `Honey token with ID "${honeyTokenId}" not found` });
}
+ if (honeyToken.status === HoneyTokenStatus.Revoked) {
+ throw new BadRequestError({ message: "Cannot retrieve credentials for a revoked honey token" });
+ }
const { permission: credentialPermission } = await permissionService.getProjectPermission({
actor: actor.type,
diff --git a/frontend/src/components/honey-tokens/ViewHoneyTokenCredentialsModal.tsx b/frontend/src/components/honey-tokens/ViewHoneyTokenCredentialsModal.tsx
index 50551b9058..3f0e9fe72a 100644
--- a/frontend/src/components/honey-tokens/ViewHoneyTokenCredentialsModal.tsx
+++ b/frontend/src/components/honey-tokens/ViewHoneyTokenCredentialsModal.tsx
@@ -11,7 +11,7 @@ import {
import { ProjectPermissionSub, useProjectPermission } from "@app/context";
import { ProjectPermissionHoneyTokenActions } from "@app/context/ProjectPermissionContext/types";
import { useGetHoneyTokenCredentials } from "@app/hooks/api/honeyTokens";
-import { HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";
+import { HoneyTokenStatus, HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";
import { TDashboardHoneyToken } from "@app/hooks/api/honeyTokens/types";
import { AwsHoneyTokenCredentials } from "./ViewHoneyTokenCredentials/AwsHoneyTokenCredentials";
@@ -57,7 +57,7 @@ const ModalBody = ({
const { data: credentials, isPending } = useGetHoneyTokenCredentials({
honeyTokenId: honeyToken?.id ?? "",
projectId,
- enabled: isOpen && Boolean(honeyToken) && canReadCredentials
+ enabled: isOpen && honeyToken?.status !== HoneyTokenStatus.Revoked && canReadCredentials
});
if (isPending) {