Skip to content

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

audit logs

Matheus Nogueirad9b66214fdb1
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 f51c6ad655..8d66748b87 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -937,7 +937,11 @@ export enum EventType {
CREATE_HONEY_TOKEN = "create-honey-token",
UPDATE_HONEY_TOKEN = "update-honey-token",
REVOKE_HONEY_TOKEN = "revoke-honey-token",
- TRIGGER_HONEY_TOKEN = "trigger-honey-token"
+ TRIGGER_HONEY_TOKEN = "trigger-honey-token",
+
+ // Project Grants
+ CREATE_PROJECT_GRANT = "create-project-grant",
+ DELETE_PROJECT_GRANT = "delete-project-grant"
}
// Maps each actor type to the JSONB key that holds the actor's primary ID in actorMetadata.
@@ -7557,6 +7561,26 @@ interface TriggerHoneyTokenEvent {
};
}
+interface CreateProjectGrantEvent {
+ type: EventType.CREATE_PROJECT_GRANT;
+ metadata: {
+ grantId: string;
+ sourceProjectId: string;
+ targetProjectId: string;
+ environment: string;
+ secretPath: string;
+ };
+}
+
+interface DeleteProjectGrantEvent {
+ type: EventType.DELETE_PROJECT_GRANT;
+ metadata: {
+ grantId: string;
+ sourceProjectId: string;
+ targetProjectId: string;
+ };
+}
+
export type Event =
| CreateSubOrganizationEvent
| UpdateSubOrganizationEvent
@@ -8238,4 +8262,6 @@ export type Event =
| RemoveIdentityFromGroupEvent
| AddGroupToProjectEvent
| UpdateGroupProjectMembershipEvent
- | RemoveGroupFromProjectEvent;
+ | RemoveGroupFromProjectEvent
+ | CreateProjectGrantEvent
+ | DeleteProjectGrantEvent;
diff --git a/backend/src/server/routes/v1/project-grant-router.ts b/backend/src/server/routes/v1/project-grant-router.ts
index f84c8f16db..d9a8187221 100644
--- a/backend/src/server/routes/v1/project-grant-router.ts
+++ b/backend/src/server/routes/v1/project-grant-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
import { ProjectFolderGrantsSchema } from "@app/db/schemas";
+import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -63,6 +64,22 @@ export const registerProjectGrantRouter = async (server: FastifyZodProvider) =>
actorOrgId: req.permission.orgId,
...req.body
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: grant.sourceProjectId,
+ event: {
+ type: EventType.CREATE_PROJECT_GRANT,
+ metadata: {
+ grantId: grant.id,
+ sourceProjectId: grant.sourceProjectId,
+ targetProjectId: grant.targetProjectId,
+ environment: req.body.environment,
+ secretPath: req.body.secretPath
+ }
+ }
+ });
+
return { grant };
}
});
@@ -92,6 +109,20 @@ export const registerProjectGrantRouter = async (server: FastifyZodProvider) =>
grantId: req.params.grantId,
sourceProjectId: req.query.sourceProjectId
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: grant.sourceProjectId,
+ event: {
+ type: EventType.DELETE_PROJECT_GRANT,
+ metadata: {
+ grantId: grant.id,
+ sourceProjectId: grant.sourceProjectId,
+ targetProjectId: grant.targetProjectId
+ }
+ }
+ });
+
return { grant };
}
});
diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx
index 8213ddc84f..21501bc209 100644
--- a/frontend/src/hooks/api/auditLogs/enums.tsx
+++ b/frontend/src/hooks/api/auditLogs/enums.tsx
@@ -454,5 +454,9 @@ export enum EventType {
KMIP_SERVER_CREATE = "kmip-server-create",
KMIP_SERVER_UPDATE = "kmip-server-update",
KMIP_SERVER_DELETE = "kmip-server-delete",
- KMIP_SERVER_ENROLLMENT_TOKEN_CREATE = "kmip-server-enrollment-token-create"
+ KMIP_SERVER_ENROLLMENT_TOKEN_CREATE = "kmip-server-enrollment-token-create",
+
+ // Project Grants
+ CREATE_PROJECT_GRANT = "create-project-grant",
+ DELETE_PROJECT_GRANT = "delete-project-grant"
}
diff --git a/frontend/src/hooks/api/auditLogs/types.tsx b/frontend/src/hooks/api/auditLogs/types.tsx
index d856b758e0..4f8403ebf1 100644
--- a/frontend/src/hooks/api/auditLogs/types.tsx
+++ b/frontend/src/hooks/api/auditLogs/types.tsx
@@ -955,6 +955,26 @@ interface PamAccessPolicyBypassedEvent {
};
}
+interface CreateProjectGrantEvent {
+ type: EventType.CREATE_PROJECT_GRANT;
+ metadata: {
+ grantId: string;
+ sourceProjectId: string;
+ targetProjectId: string;
+ environment: string;
+ secretPath: string;
+ };
+}
+
+interface DeleteProjectGrantEvent {
+ type: EventType.DELETE_PROJECT_GRANT;
+ metadata: {
+ grantId: string;
+ sourceProjectId: string;
+ targetProjectId: string;
+ };
+}
+
export type Event =
| GetSecretsEvent
| GetSecretEvent
@@ -1044,7 +1064,9 @@ export type Event =
| GetProjectWorkflowIntegrationConfig
| IntegrationSyncedEvent
| ClearIdentityLdapAuthLockoutsEvent
- | PamAccessPolicyBypassedEvent;
+ | PamAccessPolicyBypassedEvent
+ | CreateProjectGrantEvent
+ | DeleteProjectGrantEvent;
export type AuditLog = {
id: string;