Skip to content

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

fix order of checks

Matheus Nogueiraa097aa2a478e
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 eceab039e8..e89d92d34f 100644
--- a/backend/src/ee/services/honey-token/honey-token-service.ts
+++ b/backend/src/ee/services/honey-token/honey-token-service.ts
@@ -861,9 +861,6 @@ 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,
@@ -878,6 +875,10 @@ export const honeyTokenServiceFactory = ({
ProjectPermissionSub.HoneyTokens
);
+ if (honeyToken.status === HoneyTokenStatus.Revoked) {
+ throw new BadRequestError({ message: "Cannot retrieve credentials for a revoked honey token" });
+ }
+
const type = assertSupportedHoneyTokenType(honeyToken.type);
const providerHooks = honeyTokenProviderHooksByType[type];
if (!providerHooks) throw new BadRequestError({ message: "Unsupported honey token type" });