Skip to content

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

enhancement: check if the revoke grant is not removing a secret grant (endpoint called by PKI)

adilson05b427697abd
diff --git a/backend/src/db/migrations/20260930100809_additional-privileges-grant-id.ts b/backend/src/db/migrations/20260930100809_additional-privileges-grant-id.ts
index 319c49cdda..948d86910e 100644
--- a/backend/src/db/migrations/20260930100809_additional-privileges-grant-id.ts
+++ b/backend/src/db/migrations/20260930100809_additional-privileges-grant-id.ts
@@ -16,11 +16,10 @@ export async function up(knex: Knex): Promise<void> {
}
export async function down(knex: Knex): Promise<void> {
- await knex.raw(`DROP INDEX IF EXISTS "${GRANT_ID_UNIQUE_INDEX}"`);
-
const hasColumn = await knex.schema.hasColumn(TableName.AdditionalPrivilege, "grantId");
if (hasColumn) {
await knex.schema.alterTable(TableName.AdditionalPrivilege, (t) => {
+ t.dropUnique(["grantId"], GRANT_ID_UNIQUE_INDEX);
t.dropForeign("grantId");
t.dropColumn("grantId");
});
diff --git a/backend/src/services/approval-policy/approval-policy-service.ts b/backend/src/services/approval-policy/approval-policy-service.ts
index ec8f9f00e9..cc336b4562 100644
--- a/backend/src/services/approval-policy/approval-policy-service.ts
+++ b/backend/src/services/approval-policy/approval-policy-service.ts
@@ -1875,6 +1875,12 @@ export const approvalPolicyServiceFactory = ({
}
}
+ if (grantPolicyType === ApprovalPolicyType.SecretAccess) {
+ throw new BadRequestError({
+ message: "This grant is for a secret access request. Revoke it from the access request instead."
+ });
+ }
+
if (grant.status !== ApprovalRequestGrantStatus.Active) {
throw new BadRequestError({ message: "Grant is not active" });
}