Skip to content

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

fix: add SecretShared telemetry to POST /public endpoint and make organizationId optional

Devin AIbf0822d79c52
diff --git a/backend/src/server/routes/v1/secret-sharing-router.ts b/backend/src/server/routes/v1/secret-sharing-router.ts
index df251efa57..c76cf12f9e 100644
--- a/backend/src/server/routes/v1/secret-sharing-router.ts
+++ b/backend/src/server/routes/v1/secret-sharing-router.ts
@@ -230,6 +230,17 @@ export const registerSecretSharingRouter = async (server: FastifyZodProvider) =>
...req.body,
accessType: SecretSharingAccessType.Anyone
});
+
+ await server.services.telemetry.sendPostHogEvents({
+ event: PostHogEventTypes.SecretShared,
+ distinctId: `anonymous-${sharedSecret.id}`,
+ properties: {
+ accessType: SecretSharingAccessType.Anyone,
+ expiresAt: sharedSecret.expiresAt.toISOString(),
+ hasPassword: !!req.body.password
+ }
+ });
+
return { id: sharedSecret.id };
}
});
diff --git a/backend/src/services/telemetry/telemetry-types.ts b/backend/src/services/telemetry/telemetry-types.ts
index 2e3b8d5ede..298c905430 100644
--- a/backend/src/services/telemetry/telemetry-types.ts
+++ b/backend/src/services/telemetry/telemetry-types.ts
@@ -407,7 +407,7 @@ export type TSecretImportCreatedEvent = {
export type TSecretSharedEvent = {
event: PostHogEventTypes.SecretShared;
properties: {
- organizationId: string;
+ organizationId?: string;
accessType: SecretSharingAccessType;
expiresAt: string;
hasPassword: boolean;