Skip to content

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

feat: offer approval request events in the webhook picker

InfisiCalvinf011b00ea99f
diff --git a/frontend/src/hooks/api/webhooks/types.ts b/frontend/src/hooks/api/webhooks/types.ts
index d2ccbf50bc..3fd538d4ee 100644
--- a/frontend/src/hooks/api/webhooks/types.ts
+++ b/frontend/src/hooks/api/webhooks/types.ts
@@ -7,7 +7,9 @@ export enum WebhookType {
export enum WebhookEvent {
SecretModified = "secrets.modified",
SecretRotationFailed = "secrets.rotation-failed",
- HoneyTokenTriggered = "honey-token.triggered"
+ HoneyTokenTriggered = "honey-token.triggered",
+ ChangeRequestModified = "secrets.change-request.modified",
+ AccessRequestModified = "secrets.access-request.modified"
}
export type TWebhookEventMetadata = {
@@ -29,6 +31,15 @@ export const WEBHOOK_EVENT_METADATA: Record<WebhookEvent, TWebhookEventMetadata>
[WebhookEvent.HoneyTokenTriggered]: {
label: "Honey Token Triggered",
description: "Triggered when a honey token is activated"
+ },
+ [WebhookEvent.ChangeRequestModified]: {
+ label: "Change Request Modified",
+ description:
+ "Triggered when a secret change request is created, reviewed, closed, reopened, or merged"
+ },
+ [WebhookEvent.AccessRequestModified]: {
+ label: "Access Request Modified",
+ description: "Triggered when an access request is created, edited, reviewed, or revoked"
}
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx
index 2135368196..e534440aa5 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx
@@ -49,6 +49,10 @@ const EVENT_OPTIONS: TWebhookEventOption[] = WEBHOOK_EVENTS.map((event) => ({
description: WEBHOOK_EVENT_METADATA[event].description
}));
+const DEFAULT_ENABLED_EVENTS = Object.fromEntries(
+ WEBHOOK_EVENTS.map((event) => [event, true])
+) as Record<WebhookEvent, boolean>;
+
const OptionWithDescription = (props: OptionProps<TWebhookEventOption>) => {
const { data, children, isSelected } = props;
@@ -72,11 +76,7 @@ const formSchema = z
webhookSecretKey: z.string().trim().optional().describe("Secret Key"),
secretPath: z.string().trim().describe("Secret Path"),
type: z.nativeEnum(WebhookType).describe("Type").default(WebhookType.GENERAL),
- enabledEvents: z.record(z.nativeEnum(WebhookEvent), z.boolean()).default({
- [WebhookEvent.SecretModified]: true,
- [WebhookEvent.SecretRotationFailed]: true,
- [WebhookEvent.HoneyTokenTriggered]: true
- })
+ enabledEvents: z.record(z.nativeEnum(WebhookEvent), z.boolean()).default(DEFAULT_ENABLED_EVENTS)
})
.superRefine((data, ctx) => {
if (data.type === WebhookType.SLACK && !data.webhookUrl.includes("hooks.slack.com")) {
@@ -114,11 +114,7 @@ export const AddWebhookForm = ({
resolver: zodResolver(formSchema),
defaultValues: {
type: WebhookType.GENERAL,
- enabledEvents: {
- [WebhookEvent.SecretModified]: true,
- [WebhookEvent.SecretRotationFailed]: true,
- [WebhookEvent.HoneyTokenTriggered]: true
- }
+ enabledEvents: DEFAULT_ENABLED_EVENTS
}
});
@@ -188,11 +184,7 @@ export const AddWebhookForm = ({
if (!isOpen) {
reset({
type: WebhookType.GENERAL,
- enabledEvents: {
- [WebhookEvent.SecretModified]: true,
- [WebhookEvent.SecretRotationFailed]: true,
- [WebhookEvent.HoneyTokenTriggered]: true
- },
+ enabledEvents: DEFAULT_ENABLED_EVENTS,
environment: environments?.[0]?.slug,
secretPath: ""
});