Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix type and add new field into the documentation
adilsondb7fb1d294d6
diff --git a/backend/src/services/secret/secret-queue.ts b/backend/src/services/secret/secret-queue.tsindex fea7a38526..e799103df3 100644--- a/backend/src/services/secret/secret-queue.ts+++ b/backend/src/services/secret/secret-queue.ts@@ -229,6 +229,23 @@ export const secretQueueFactory = ({};};+ const resolveChangedByDisplayName = async (changedBy: string, changedByActorType: ActorType) => {+ switch (changedByActorType) {+ case ActorType.USER: {+ const user = await userDAL.findById(changedBy);+ return user?.email || user?.username || changedBy;+ }+ case ActorType.IDENTITY: {+ const identity = await identityDAL.findById(changedBy);+ return identity?.name || changedBy;+ }+ case ActorType.PLATFORM:+ return "Platform";+ default:+ return changedBy;+ }+ };+const $getJobKey = (projectId: string, environmentSlug: string, secretPath: string) => {// the idea here is a timestamp based id which will be constant in a 3s intervalconst timestampId = Math.floor(Date.now() / SYNC_SECRET_DEBOUNCE_INTERVAL_MS);@@ -1562,25 +1579,7 @@ export const secretQueueFactory = ({if (job.data.type === WebhookEvents.SecretModified) {const { changedBy, changedByActorType } = job.data.payload;if (changedBy && changedByActorType) {- let resolvedName: string | undefined;- switch (changedByActorType) {- case ActorType.USER: {- const user = await userDAL.findById(changedBy);- resolvedName = user?.email || user?.username || changedBy;- break;- }- case ActorType.IDENTITY: {- const identity = await identityDAL.findById(changedBy);- resolvedName = identity?.name || changedBy;- break;- }- case ActorType.PLATFORM:- resolvedName = "Platform";- break;- default:- resolvedName = changedBy;- break;- }+ const resolvedName = await resolveChangedByDisplayName(changedBy, changedByActorType as ActorType);// eslint-disable-next-line no-param-reassignjob.data.payload.changedBy = resolvedName;}diff --git a/backend/src/services/webhook/webhook-types.ts b/backend/src/services/webhook/webhook-types.tsindex 7eb6dda7d7..6fac8efb71 100644--- a/backend/src/services/webhook/webhook-types.ts+++ b/backend/src/services/webhook/webhook-types.ts@@ -1,5 +1,7 @@import { TProjectPermission } from "@app/lib/types";+import { ActorType } from "../auth/auth-type";+export type TCreateWebhookDTO = {environment: string;secretPath?: string;@@ -47,7 +49,7 @@ type TWebhookSecretModifiedEventPayload = {secretPath?: string;type?: string | null;changedBy?: string;- changedByActorType?: string;+ changedByActorType?: ActorType;};};diff --git a/docs/documentation/platform/webhooks.mdx b/docs/documentation/platform/webhooks.mdxindex 19bb272260..d142df586a 100644--- a/docs/documentation/platform/webhooks.mdx+++ b/docs/documentation/platform/webhooks.mdx@@ -31,7 +31,9 @@ If the signature in the header matches the signature that you generated, then yo"project": {"workspaceId": "the workspace id","environment": "project environment",- "secretPath": "project folder path"+ "secretPath": "project folder path",+ "changeBy": "Actor that changed the secret",+ "changedByActorType": "type of the actor that changed the secret"},"timestamp": ""}