Skip to content

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

feat: add audit log

adilson57c808431b04
diff --git a/backend/src/ee/routes/v1/product-insights-router.ts b/backend/src/ee/routes/v1/product-insights-router.ts
index 9f39be89f3..c383d901f6 100644
--- a/backend/src/ee/routes/v1/product-insights-router.ts
+++ b/backend/src/ee/routes/v1/product-insights-router.ts
@@ -1,5 +1,6 @@
import { z } from "zod";
+import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { SecretsUsageInsightsSchema } from "@app/ee/services/product-insights/product-insights-schemas";
import { readLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
@@ -31,6 +32,15 @@ export const registerProductInsightsRouter = async (server: FastifyZodProvider)
orgId: req.permission.orgId
});
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ event: {
+ type: EventType.VIEW_INSIGHTS_SECRETS_MANAGEMENT_USAGE,
+ metadata: usageInsights
+ }
+ });
+
return { usageInsights };
}
});
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 5b5d31b571..1adae48a14 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -681,6 +681,7 @@ export enum EventType {
VIEW_INSIGHTS_SECRETS_MANAGEMENT_SUMMARY = "view-insights-secrets-management-summary",
VIEW_INSIGHTS_SECRETS_DUPLICATION = "view-insights-secrets-duplication",
VIEW_INSIGHTS_SECRETS_MANAGEMENT_COUNTS = "view-insights-secrets-management-counts",
+ VIEW_INSIGHTS_SECRETS_MANAGEMENT_USAGE = "view-insights-secrets-management-usage",
CREATE_AUDIT_REPORT = "create-audit-report",
GET_AUDIT_REPORTS = "get-audit-reports",
@@ -5520,6 +5521,15 @@ interface ViewSecretManagementInsightsCountsEvent {
};
}
+interface ViewSecretManagementInsightsUsageEvent {
+ type: EventType.VIEW_INSIGHTS_SECRETS_MANAGEMENT_USAGE;
+ metadata: {
+ activeLeases: number;
+ users: number;
+ identities: number;
+ };
+}
+
interface CreateAuditReportEvent {
type: EventType.CREATE_AUDIT_REPORT;
metadata: {
@@ -7470,6 +7480,7 @@ export type Event =
| ViewSecretManagementInsightsSummaryEvent
| ViewInsightsSecretsDuplicationEvent
| ViewSecretManagementInsightsCountsEvent
+ | ViewSecretManagementInsightsUsageEvent
| CreateAuditReportEvent
| GetAuditReportsEvent
| GetAuditReportEvent
diff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsx
index aa54ee1cd9..d2168736f8 100644
--- a/frontend/src/hooks/api/auditLogs/constants.tsx
+++ b/frontend/src/hooks/api/auditLogs/constants.tsx
@@ -291,6 +291,7 @@ export const eventToNameMap: { [K in EventType]: string } = {
[EventType.VIEW_INSIGHTS_SECRETS_DUPLICATION]: "View Secrets Duplication Insights",
[EventType.VIEW_INSIGHTS_SECRETS_MANAGEMENT_COUNTS]:
"View Secrets Management Resource Counts Insights",
+ [EventType.VIEW_INSIGHTS_SECRETS_MANAGEMENT_USAGE]: "View Secrets Management Usage Insights",
[EventType.CREATE_PROJECT_ROLE]: "Create Project Role",
[EventType.UPDATE_PROJECT_ROLE]: "Update Project Role",
diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx
index 7bafbb061b..56b4140635 100644
--- a/frontend/src/hooks/api/auditLogs/enums.tsx
+++ b/frontend/src/hooks/api/auditLogs/enums.tsx
@@ -282,6 +282,7 @@ export enum EventType {
VIEW_INSIGHTS_AUTH_METHODS = "view-insights-auth-methods",
VIEW_INSIGHTS_SECRETS_DUPLICATION = "view-insights-secrets-duplication",
VIEW_INSIGHTS_SECRETS_MANAGEMENT_COUNTS = "view-insights-secrets-management-counts",
+ VIEW_INSIGHTS_SECRETS_MANAGEMENT_USAGE = "view-insights-secrets-management-usage",
CREATE_PROJECT_ROLE = "create-project-role",
UPDATE_PROJECT_ROLE = "update-project-role",