Skip to content

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

feat(code-signing): prevent signers from approving their own signing requests

bernie-gf5a08f2553a8
diff --git a/backend/src/services/approval-policy/approval-policy-service.ts b/backend/src/services/approval-policy/approval-policy-service.ts
index 7275ffbbae..fd1dc090ce 100644
--- a/backend/src/services/approval-policy/approval-policy-service.ts
+++ b/backend/src/services/approval-policy/approval-policy-service.ts
@@ -1165,6 +1165,10 @@ export const approvalPolicyServiceFactory = ({
throw new ForbiddenRequestError({ message: "You are not an eligible approver for this step" });
}
+ if (policyType === ApprovalPolicyType.CertCodeSigning && request.requesterId === actor.id) {
+ throw new ForbiddenRequestError({ message: "You cannot approve your own signing request" });
+ }
+
const hasApproved = currentStep.approvals.some((a) => a.approverUserId === actor.id);
if (hasApproved) {
throw new BadRequestError({ message: "You have already approved this request" });
diff --git a/backend/src/services/signer/signer-policy-service.ts b/backend/src/services/signer/signer-policy-service.ts
index 42423d33ff..185f1d8909 100644
--- a/backend/src/services/signer/signer-policy-service.ts
+++ b/backend/src/services/signer/signer-policy-service.ts
@@ -8,7 +8,7 @@ import {
ResourcePermissionSignerActions,
ResourcePermissionSub
} from "@app/ee/services/permission/resource-permission";
-import { BadRequestError, NotFoundError } from "@app/lib/errors";
+import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
import { ms } from "@app/lib/ms";
import {
@@ -620,6 +620,12 @@ export const signerPolicyServiceFactory = ({
if (!dto.granteeUserId && !dto.granteeIdentityId) {
throw new BadRequestError({ message: "granteeUserId or granteeIdentityId is required." });
}
+ if (
+ (dto.actor === ActorType.USER && dto.granteeUserId === dto.actorId) ||
+ (dto.actor === ActorType.IDENTITY && dto.granteeIdentityId === dto.actorId)
+ ) {
+ throw new ForbiddenRequestError({ message: "You cannot pre-approve signing access for yourself." });
+ }
if (!dto.requestedSignings && !dto.requestedWindowEnd) {
throw new BadRequestError({ message: "Provide at least one of requestedSignings or requestedWindowEnd." });
}
diff --git a/docs/documentation/platform/pki/code-signing/approvals.mdx b/docs/documentation/platform/pki/code-signing/approvals.mdx
index 7e8b641225..c050d943aa 100644
--- a/docs/documentation/platform/pki/code-signing/approvals.mdx
+++ b/docs/documentation/platform/pki/code-signing/approvals.mdx
@@ -183,6 +183,10 @@ If you're an eligible approver for the **current** step of a pending request, an
</Step>
</Steps>
+<Note>
+ You can never approve your own signing request, even if you are listed as an approver for the current step. Administrators also cannot pre-approve signing for themselves. These rules are always enforced and cannot be disabled.
+</Note>
+
## Revoking access
Administrators can revoke an active access record (or cancel a pending request) at any time. Hover the row on the Approvals tab; an **X** icon appears. Confirm in the dialog and:
diff --git a/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/components/RequestActionsSection.tsx b/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/components/RequestActionsSection.tsx
index 7ce1929c3a..c8aeee28e4 100644
--- a/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/components/RequestActionsSection.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalRequestDetailPage/components/RequestActionsSection.tsx
@@ -7,7 +7,7 @@ import { createNotification } from "@app/components/notifications";
import { Button, FormLabel, Modal, ModalContent, TextArea } from "@app/components/v2";
import { useProjectPermission, useUser } from "@app/context";
import { usePopUp } from "@app/hooks";
-import { ApproverType } from "@app/hooks/api/approvalPolicies";
+import { ApprovalPolicyType, ApproverType } from "@app/hooks/api/approvalPolicies";
import {
ApprovalRequestStatus,
ApprovalRequestStepStatus,
@@ -52,6 +52,10 @@ export const RequestActionsSection = ({ request }: Props) => {
return null;
}
+ if (request.type === ApprovalPolicyType.CertCodeSigning && request.requesterId === userId) {
+ return null;
+ }
+
const hasAlreadyActed = currentStep.approvals.some(
(approval) => approval.approverUserId === userId
);
diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningRequestsTab/CodeSigningRequestsTab.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningRequestsTab/CodeSigningRequestsTab.tsx
index db09448b0d..3373c1f021 100644
--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningRequestsTab/CodeSigningRequestsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningRequestsTab/CodeSigningRequestsTab.tsx
@@ -80,6 +80,8 @@ const checkIfUserNeedsToApprove = (
userId: string,
userGroups: string[]
): boolean => {
+ if (request.requesterId === userId) return false;
+
const currentStep = request.steps.find(
(step) => step.status === ApprovalRequestStepStatus.InProgress
);