Skip to content

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

feat: add machine identity PostHog telemetry events

Devin AI864d51a93011
diff --git a/backend/src/server/routes/v1/dashboard-router.ts b/backend/src/server/routes/v1/dashboard-router.ts
index 21f48f9e93..9279ecf51f 100644
--- a/backend/src/server/routes/v1/dashboard-router.ts
+++ b/backend/src/server/routes/v1/dashboard-router.ts
@@ -1524,6 +1524,7 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => {
environment,
secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
diff --git a/backend/src/server/routes/v1/identity-alicloud-auth-router.ts b/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
index 2f693260ea..598a7bf8d4 100644
--- a/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
@@ -6,8 +6,10 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ALICLOUD_AUTH, ApiDocsTags } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { validateArns } from "@app/services/identity-alicloud-auth/identity-alicloud-auth-validators";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
@@ -92,6 +94,17 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityAliCloudAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityAliCloudAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "alicloud"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -190,6 +203,17 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAliCloudAuth.orgId,
+ properties: {
+ identityId: identityAliCloudAuth.identityId,
+ orgId: identityAliCloudAuth.orgId,
+ authMethod: "alicloud"
+ }
+ }).catch(() => {});
+
return { identityAliCloudAuth };
}
});
@@ -283,6 +307,17 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAliCloudAuth.orgId,
+ properties: {
+ identityId: identityAliCloudAuth.identityId,
+ orgId: identityAliCloudAuth.orgId,
+ authMethod: "alicloud"
+ }
+ }).catch(() => {});
+
return { identityAliCloudAuth };
}
});
@@ -382,6 +417,17 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAliCloudAuth.orgId,
+ properties: {
+ identityId: identityAliCloudAuth.identityId,
+ orgId: identityAliCloudAuth.orgId,
+ authMethod: "alicloud"
+ }
+ }).catch(() => {});
+
return { identityAliCloudAuth };
}
});
diff --git a/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts b/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
index 1f98145e5b..fbecdcc034 100644
--- a/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
@@ -5,6 +5,7 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, AWS_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
@@ -13,6 +14,7 @@ import {
validatePrincipalArns
} from "@app/services/identity-aws-auth/identity-aws-auth-validators";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider) => {
server.route({
@@ -59,6 +61,17 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityAwsAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityAwsAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "aws_iam"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -161,6 +174,17 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAwsAuth.orgId,
+ properties: {
+ identityId: identityAwsAuth.identityId,
+ orgId: identityAwsAuth.orgId,
+ authMethod: "aws_iam"
+ }
+ }).catch(() => {});
+
return { identityAwsAuth };
}
});
@@ -246,6 +270,17 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAwsAuth.orgId,
+ properties: {
+ identityId: identityAwsAuth.identityId,
+ orgId: identityAwsAuth.orgId,
+ authMethod: "aws_iam"
+ }
+ }).catch(() => {});
+
return { identityAwsAuth };
}
});
@@ -345,6 +380,17 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAwsAuth.orgId,
+ properties: {
+ identityId: identityAwsAuth.identityId,
+ orgId: identityAwsAuth.orgId,
+ authMethod: "aws_iam"
+ }
+ }).catch(() => {});
+
return { identityAwsAuth };
}
});
diff --git a/backend/src/server/routes/v1/identity-azure-auth-router.ts b/backend/src/server/routes/v1/identity-azure-auth-router.ts
index 3aae1f57c2..1a057090f1 100644
--- a/backend/src/server/routes/v1/identity-azure-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-azure-auth-router.ts
@@ -5,11 +5,13 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, AZURE_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { validateAzureAuthField } from "@app/services/identity-azure-auth/identity-azure-auth-validators";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider) => {
server.route({
@@ -54,6 +56,17 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityAzureAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityAzureAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "azure"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -155,6 +168,17 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAzureAuth.orgId,
+ properties: {
+ identityId: identityAzureAuth.identityId,
+ orgId: identityAzureAuth.orgId,
+ authMethod: "azure"
+ }
+ }).catch(() => {});
+
return { identityAzureAuth };
}
});
@@ -246,6 +270,17 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAzureAuth.orgId,
+ properties: {
+ identityId: identityAzureAuth.identityId,
+ orgId: identityAzureAuth.orgId,
+ authMethod: "azure"
+ }
+ }).catch(() => {});
+
return { identityAzureAuth };
}
});
@@ -346,6 +381,17 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAzureAuth.orgId,
+ properties: {
+ identityId: identityAzureAuth.identityId,
+ orgId: identityAzureAuth.orgId,
+ authMethod: "azure"
+ }
+ }).catch(() => {});
+
return { identityAzureAuth };
}
});
diff --git a/backend/src/server/routes/v1/identity-gcp-auth-router.ts b/backend/src/server/routes/v1/identity-gcp-auth-router.ts
index f82cd9767e..8a3ec65c32 100644
--- a/backend/src/server/routes/v1/identity-gcp-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-gcp-auth-router.ts
@@ -5,11 +5,13 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, GCP_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { validateGcpAuthField } from "@app/services/identity-gcp-auth/identity-gcp-auth-validators";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider) => {
server.route({
@@ -54,6 +56,17 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityGcpAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityGcpAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "gcp"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -153,6 +166,17 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityGcpAuth.orgId,
+ properties: {
+ identityId: identityGcpAuth.identityId,
+ orgId: identityGcpAuth.orgId,
+ authMethod: "gcp"
+ }
+ }).catch(() => {});
+
return { identityGcpAuth };
}
});
@@ -240,6 +264,17 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityGcpAuth.orgId,
+ properties: {
+ identityId: identityGcpAuth.identityId,
+ orgId: identityGcpAuth.orgId,
+ authMethod: "gcp"
+ }
+ }).catch(() => {});
+
return { identityGcpAuth };
}
});
@@ -340,6 +375,17 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityGcpAuth.orgId,
+ properties: {
+ identityId: identityGcpAuth.identityId,
+ orgId: identityGcpAuth.orgId,
+ authMethod: "gcp"
+ }
+ }).catch(() => {});
+
return { identityGcpAuth };
}
});
diff --git a/backend/src/server/routes/v1/identity-jwt-auth-router.ts b/backend/src/server/routes/v1/identity-jwt-auth-router.ts
index 06bab6aa98..91c7712ebf 100644
--- a/backend/src/server/routes/v1/identity-jwt-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-jwt-auth-router.ts
@@ -5,8 +5,10 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, JWT_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { JwtConfigurationType } from "@app/services/identity-jwt-auth/identity-jwt-auth-types";
import {
@@ -129,6 +131,18 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
}
}
});
+
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityJwtAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityJwtAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "jwt"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -202,6 +216,17 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityJwtAuth.orgId,
+ properties: {
+ identityId: identityJwtAuth.identityId,
+ orgId: identityJwtAuth.orgId,
+ authMethod: "jwt"
+ }
+ }).catch(() => {});
+
return {
identityJwtAuth
};
@@ -271,6 +296,17 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityJwtAuth.orgId,
+ properties: {
+ identityId: identityJwtAuth.identityId,
+ orgId: identityJwtAuth.orgId,
+ authMethod: "jwt"
+ }
+ }).catch(() => {});
+
return { identityJwtAuth };
}
});
@@ -374,6 +410,17 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityJwtAuth.orgId,
+ properties: {
+ identityId: identityJwtAuth.identityId,
+ orgId: identityJwtAuth.orgId,
+ authMethod: "jwt"
+ }
+ }).catch(() => {});
+
return { identityJwtAuth };
}
});
diff --git a/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts b/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
index 2cdfd64f95..787f2e44f9 100644
--- a/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
@@ -6,8 +6,10 @@ import { ApiDocsTags, KUBERNETES_AUTH } from "@app/lib/api-docs";
import { CharacterType, characterValidator } from "@app/lib/validator/validate-string";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { IdentityKubernetesAuthTokenReviewMode } from "@app/services/identity-kubernetes-auth/identity-kubernetes-auth-types";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
@@ -74,6 +76,18 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
}
}
});
+
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityKubernetesAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityKubernetesAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "kubernetes"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -227,6 +241,17 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityKubernetesAuth.orgId,
+ properties: {
+ identityId: identityKubernetesAuth.identityId,
+ orgId: identityKubernetesAuth.orgId,
+ authMethod: "kubernetes"
+ }
+ }).catch(() => {});
+
return { identityKubernetesAuth: IdentityKubernetesAuthResponseSchema.parse(identityKubernetesAuth) };
}
});
@@ -371,6 +396,17 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityKubernetesAuth.orgId,
+ properties: {
+ identityId: identityKubernetesAuth.identityId,
+ orgId: identityKubernetesAuth.orgId,
+ authMethod: "kubernetes"
+ }
+ }).catch(() => {});
+
return { identityKubernetesAuth };
}
});
@@ -474,6 +510,17 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityKubernetesAuth.orgId,
+ properties: {
+ identityId: identityKubernetesAuth.identityId,
+ orgId: identityKubernetesAuth.orgId,
+ authMethod: "kubernetes"
+ }
+ }).catch(() => {});
+
return { identityKubernetesAuth };
}
});
diff --git a/backend/src/server/routes/v1/identity-ldap-auth-router.ts b/backend/src/server/routes/v1/identity-ldap-auth-router.ts
index 70700f6806..bbd3a31bd5 100644
--- a/backend/src/server/routes/v1/identity-ldap-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-ldap-auth-router.ts
@@ -22,8 +22,10 @@ import { UnauthorizedError } from "@app/lib/errors";
import { logger } from "@app/lib/logger";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { AllowedFieldsSchema } from "@app/services/identity-ldap-auth/identity-ldap-auth-types";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
@@ -202,6 +204,17 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${authIdentityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: authIdentityId,
+ orgId: identity.orgId,
+ authMethod: "ldap"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -399,6 +412,17 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: req.params.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "ldap"
+ }
+ }).catch(() => {});
+
return { identityLdapAuth };
}
});
@@ -521,6 +545,17 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: req.params.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "ldap"
+ }
+ }).catch(() => {});
+
return { identityLdapAuth };
}
});
@@ -634,6 +669,17 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: identityLdapAuth.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "ldap"
+ }
+ }).catch(() => {});
+
return { identityLdapAuth };
}
});
diff --git a/backend/src/server/routes/v1/identity-oci-auth-router.ts b/backend/src/server/routes/v1/identity-oci-auth-router.ts
index 3868afb686..667c9c4e9e 100644
--- a/backend/src/server/routes/v1/identity-oci-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-oci-auth-router.ts
@@ -5,8 +5,10 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, OCI_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { validateTenancy, validateUsernames } from "@app/services/identity-oci-auth/identity-oci-auth-validators";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
@@ -71,6 +73,17 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityOciAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityOciAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "oci"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -166,6 +179,17 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOciAuth.orgId,
+ properties: {
+ identityId: identityOciAuth.identityId,
+ orgId: identityOciAuth.orgId,
+ authMethod: "oci"
+ }
+ }).catch(() => {});
+
return { identityOciAuth };
}
});
@@ -250,6 +274,17 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOciAuth.orgId,
+ properties: {
+ identityId: identityOciAuth.identityId,
+ orgId: identityOciAuth.orgId,
+ authMethod: "oci"
+ }
+ }).catch(() => {});
+
return { identityOciAuth };
}
});
@@ -349,6 +384,17 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOciAuth.orgId,
+ properties: {
+ identityId: identityOciAuth.identityId,
+ orgId: identityOciAuth.orgId,
+ authMethod: "oci"
+ }
+ }).catch(() => {});
+
return { identityOciAuth };
}
});
diff --git a/backend/src/server/routes/v1/identity-oidc-auth-router.ts b/backend/src/server/routes/v1/identity-oidc-auth-router.ts
index 2b86a3ba6c..3430ec2e2b 100644
--- a/backend/src/server/routes/v1/identity-oidc-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-oidc-auth-router.ts
@@ -5,8 +5,10 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, OIDC_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import {
validateOidcAuthAudiencesField,
@@ -81,6 +83,18 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
}
}
});
+
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityOidcAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityOidcAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "oidc"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -186,6 +200,17 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOidcAuth.orgId,
+ properties: {
+ identityId: identityOidcAuth.identityId,
+ orgId: identityOidcAuth.orgId,
+ authMethod: "oidc"
+ }
+ }).catch(() => {});
+
return {
identityOidcAuth
};
@@ -288,6 +313,17 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOidcAuth.orgId,
+ properties: {
+ identityId: identityOidcAuth.identityId,
+ orgId: identityOidcAuth.orgId,
+ authMethod: "oidc"
+ }
+ }).catch(() => {});
+
return { identityOidcAuth };
}
});
@@ -390,6 +426,17 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOidcAuth.orgId,
+ properties: {
+ identityId: identityOidcAuth.identityId,
+ orgId: identityOidcAuth.orgId,
+ authMethod: "oidc"
+ }
+ }).catch(() => {});
+
return { identityOidcAuth };
}
});
diff --git a/backend/src/server/routes/v1/identity-router.ts b/backend/src/server/routes/v1/identity-router.ts
index c807043891..ccdd22b8cc 100644
--- a/backend/src/server/routes/v1/identity-router.ts
+++ b/backend/src/server/routes/v1/identity-router.ts
@@ -164,6 +164,19 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identity.id,
+ orgId: identity.orgId,
+ name: identity.name,
+ hasDeleteProtection: identity.hasDeleteProtection,
+ ...req.auditLogInfo
+ }
+ }).catch(() => {});
+
return { identity };
}
});
@@ -214,6 +227,18 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
}
}
});
+
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityDeleted,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identity.id,
+ orgId: identity.orgId,
+ ...req.auditLogInfo
+ }
+ }).catch(() => {});
+
return { identity };
}
});
diff --git a/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts b/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
index b93151e560..7a7a4ed9a7 100644
--- a/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
@@ -8,8 +8,10 @@ import { crypto } from "@app/lib/crypto/cryptography";
import { BadRequestError } from "@app/lib/errors";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
@@ -86,6 +88,17 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityTlsCertAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityTlsCertAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "tls"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -193,6 +206,17 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: identityTlsCertAuth.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "tls"
+ }
+ }).catch(() => {});
+
return { identityTlsCertAuth };
}
});
@@ -295,6 +319,17 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: identityTlsCertAuth.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "tls"
+ }
+ }).catch(() => {});
+
return { identityTlsCertAuth };
}
});
@@ -396,6 +431,17 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: identityTlsCertAuth.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "tls"
+ }
+ }).catch(() => {});
+
return { identityTlsCertAuth };
}
});
diff --git a/backend/src/server/routes/v1/identity-token-auth-router.ts b/backend/src/server/routes/v1/identity-token-auth-router.ts
index dad7a91ace..4c1eeb00a9 100644
--- a/backend/src/server/routes/v1/identity-token-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-token-auth-router.ts
@@ -5,8 +5,10 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, TOKEN_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
@@ -98,6 +100,17 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityTokenAuth.orgId,
+ properties: {
+ identityId: identityTokenAuth.identityId,
+ orgId: identityTokenAuth.orgId,
+ authMethod: "token"
+ }
+ }).catch(() => {});
+
return {
identityTokenAuth
};
@@ -185,6 +198,17 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityTokenAuth.orgId,
+ properties: {
+ identityId: identityTokenAuth.identityId,
+ orgId: identityTokenAuth.orgId,
+ authMethod: "token"
+ }
+ }).catch(() => {});
+
return {
identityTokenAuth
};
@@ -288,6 +312,17 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityTokenAuth.orgId,
+ properties: {
+ identityId: identityTokenAuth.identityId,
+ orgId: identityTokenAuth.orgId,
+ authMethod: "token"
+ }
+ }).catch(() => {});
+
return { identityTokenAuth };
}
});
@@ -350,6 +385,16 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityTokenCreated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityTokenAuth.identityId,
+ orgId: identity.orgId
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -615,6 +660,16 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
isActorSuperAdmin: isSuperAdmin(req.auth)
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityTokenRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: req.permission.id,
+ orgId: req.permission.orgId
+ }
+ }).catch(() => {});
+
return {
message: "Successfully revoked access token"
};
diff --git a/backend/src/server/routes/v1/identity-universal-auth-router.ts b/backend/src/server/routes/v1/identity-universal-auth-router.ts
index 5afb2a6c43..703996a23d 100644
--- a/backend/src/server/routes/v1/identity-universal-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-universal-auth-router.ts
@@ -5,10 +5,12 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, UNIVERSAL_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
export const sanitizedClientSecretSchema = IdentityUaClientSecretsSchema.pick({
id: true,
@@ -77,6 +79,17 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityUa.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityUa.identityId,
+ orgId: identity.orgId,
+ authMethod: "universal_auth"
+ }
+ }).catch(() => {});
+
return {
accessToken,
tokenType: "Bearer" as const,
@@ -201,6 +214,17 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityUniversalAuth.orgId,
+ properties: {
+ identityId: identityUniversalAuth.identityId,
+ orgId: identityUniversalAuth.orgId,
+ authMethod: "universal_auth"
+ }
+ }).catch(() => {});
+
return { identityUniversalAuth };
}
});
@@ -325,6 +349,17 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityUniversalAuth.orgId,
+ properties: {
+ identityId: identityUniversalAuth.identityId,
+ orgId: identityUniversalAuth.orgId,
+ authMethod: "universal_auth"
+ }
+ }).catch(() => {});
+
return { identityUniversalAuth };
}
});
@@ -425,6 +460,17 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityUniversalAuth.orgId,
+ properties: {
+ identityId: identityUniversalAuth.identityId,
+ orgId: identityUniversalAuth.orgId,
+ authMethod: "universal_auth"
+ }
+ }).catch(() => {});
+
return { identityUniversalAuth };
}
});
@@ -484,6 +530,16 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityClientSecretCreated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: orgId,
+ properties: {
+ identityId: req.params.identityId,
+ orgId
+ }
+ }).catch(() => {});
+
return { clientSecret, clientSecretData };
}
});
@@ -641,6 +697,16 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
+ void server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityClientSecretRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: clientSecretData.orgId,
+ properties: {
+ identityId: clientSecretData.identityId,
+ orgId: clientSecretData.orgId
+ }
+ }).catch(() => {});
+
return { clientSecretData };
}
});
diff --git a/backend/src/server/routes/v3/deprecated-secret-router.ts b/backend/src/server/routes/v3/deprecated-secret-router.ts
index 8d4a21f90a..221ccb2d70 100644
--- a/backend/src/server/routes/v3/deprecated-secret-router.ts
+++ b/backend/src/server/routes/v3/deprecated-secret-router.ts
@@ -342,6 +342,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment,
secretPath: req.query.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -506,6 +507,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment,
secretPath: req.query.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -654,6 +656,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -812,6 +815,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -930,6 +934,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -1038,6 +1043,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.query.environment,
secretPath: req.query.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -1118,6 +1124,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.query.environment,
secretPath: req.query.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -1293,6 +1300,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -1487,6 +1495,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -1615,6 +1624,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -1802,6 +1812,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -1935,6 +1946,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -2060,6 +2072,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -2192,6 +2205,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -2376,6 +2390,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -2494,6 +2509,7 @@ export const registerDeprecatedSecretRouter = async (server: FastifyZodProvider)
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
diff --git a/backend/src/server/routes/v4/secret-router.ts b/backend/src/server/routes/v4/secret-router.ts
index 9be378af9a..3ec6cbec70 100644
--- a/backend/src/server/routes/v4/secret-router.ts
+++ b/backend/src/server/routes/v4/secret-router.ts
@@ -220,6 +220,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
environment,
secretPath: req.query.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -373,6 +374,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
environment,
secretPath: req.query.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -512,6 +514,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -661,6 +664,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -770,6 +774,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -960,6 +965,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -1143,6 +1149,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
@@ -1264,6 +1271,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
environment: req.body.environment,
secretPath: req.body.secretPath,
channel: getUserAgentType(req.headers["user-agent"]),
+ actorType: req.permission.type,
...req.auditLogInfo
}
});
diff --git a/backend/src/services/telemetry/telemetry-types.ts b/backend/src/services/telemetry/telemetry-types.ts
index 125deb876e..b2bcf675de 100644
--- a/backend/src/services/telemetry/telemetry-types.ts
+++ b/backend/src/services/telemetry/telemetry-types.ts
@@ -27,6 +27,16 @@ export enum PostHogEventTypes {
IntegrationSynced = "Integration Synced",
IntegrationDeleted = "Integration Deleted",
MachineIdentityCreated = "Machine Identity Created",
+ MachineIdentityUpdated = "Machine Identity Updated",
+ MachineIdentityDeleted = "Machine Identity Deleted",
+ MachineIdentityLogin = "Machine Identity Login",
+ MachineIdentityAuthMethodAttached = "Machine Identity Auth Method Attached",
+ MachineIdentityAuthMethodUpdated = "Machine Identity Auth Method Updated",
+ MachineIdentityAuthMethodRevoked = "Machine Identity Auth Method Revoked",
+ MachineIdentityClientSecretCreated = "Machine Identity Client Secret Created",
+ MachineIdentityClientSecretRevoked = "Machine Identity Client Secret Revoked",
+ MachineIdentityTokenCreated = "Machine Identity Token Created",
+ MachineIdentityTokenRevoked = "Machine Identity Token Revoked",
UserOrgInvitation = "User Org Invitation",
TelemetryInstanceStats = "Self Hosted Instance Stats",
SecretRequestCreated = "Secret Request Created",
@@ -62,6 +72,7 @@ export type TSecretModifiedEvent = {
secretPath: string;
channel?: string;
userAgent?: string;
+ actorType?: string;
actor?:
| UserActor
| IdentityActor
@@ -120,6 +131,61 @@ export type TMachineIdentityCreatedEvent = {
};
};
+export type TMachineIdentityUpdatedEvent = {
+ event: PostHogEventTypes.MachineIdentityUpdated;
+ properties: {
+ identityId: string;
+ orgId: string;
+ name: string;
+ hasDeleteProtection: boolean;
+ };
+};
+
+export type TMachineIdentityDeletedEvent = {
+ event: PostHogEventTypes.MachineIdentityDeleted;
+ properties: {
+ identityId: string;
+ orgId: string;
+ };
+};
+
+export type TMachineIdentityLoginEvent = {
+ event: PostHogEventTypes.MachineIdentityLogin;
+ properties: {
+ identityId: string;
+ orgId: string;
+ authMethod: string;
+ };
+};
+
+export type TMachineIdentityAuthMethodEvent = {
+ event:
+ | PostHogEventTypes.MachineIdentityAuthMethodAttached
+ | PostHogEventTypes.MachineIdentityAuthMethodUpdated
+ | PostHogEventTypes.MachineIdentityAuthMethodRevoked;
+ properties: {
+ identityId: string;
+ orgId: string;
+ authMethod: string;
+ };
+};
+
+export type TMachineIdentityClientSecretEvent = {
+ event: PostHogEventTypes.MachineIdentityClientSecretCreated | PostHogEventTypes.MachineIdentityClientSecretRevoked;
+ properties: {
+ identityId: string;
+ orgId: string;
+ };
+};
+
+export type TMachineIdentityTokenEvent = {
+ event: PostHogEventTypes.MachineIdentityTokenCreated | PostHogEventTypes.MachineIdentityTokenRevoked;
+ properties: {
+ identityId: string;
+ orgId: string;
+ };
+};
+
export type TIntegrationCreatedEvent = {
event: PostHogEventTypes.IntegrationCreated;
properties: {
@@ -375,6 +441,12 @@ export type TPostHogEvent = { distinctId: string; organizationId?: string; organ
| TSecretScannerEvent
| TUserOrgInvitedEvent
| TMachineIdentityCreatedEvent
+ | TMachineIdentityUpdatedEvent
+ | TMachineIdentityDeletedEvent
+ | TMachineIdentityLoginEvent
+ | TMachineIdentityAuthMethodEvent
+ | TMachineIdentityClientSecretEvent
+ | TMachineIdentityTokenEvent
| TIntegrationCreatedEvent
| TIntegrationSyncedEvent
| TIntegrationDeletedEvent