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
Merge branch 'main' into SECRETS-528
Thiago Araujo da Silva40ea7681b0c6
diff --cc frontend/src/views/Alerts/AlertForm.tsxindex d4aab5892f,2a6a961349..913810ba08--- a/frontend/src/views/Alerts/AlertForm.tsx+++ b/frontend/src/views/Alerts/AlertForm.tsx@@@ -53,11 -54,8 +53,15 @@@ type Props =};const DEFAULT_ALERT_BEFORE_DAYS = 7;-const DEFAULT_ALERT_NAME = "Secret expiration alert";-const ALERT_NAME_PLACEHOLDER = "Client secret expiration alert";+const DEFAULT_ALERT_NAMES: Record<AlertEventType, string> = {+ [AlertEventType.IdentityAuthenticationExpiry]: "Secret expiration alert",+ [AlertEventType.IdentityAuthMethodChanged]: "Auth method change alert"+};++const AGENT_VAULT_ALERT_NAME_PLACEHOLDERS: Record<AlertEventType, string> = {++ [AlertEventType.IdentityAuthenticationExpiry]: "Client secret expiration alert",++ [AlertEventType.IdentityAuthMethodChanged]: "Auth method change alert"++};+const DEFAULT_EVENT_TYPE = AlertEventType.IdentityAuthenticationExpiry;const toChannelForm = (channel: TAlert["channels"][number]): TChannelForm => ({id: channel.id,@@@ -74,13 -72,13 +78,13 @@@hasIntegrationKey: Boolean(channel.config.hasIntegrationKey)});- const buildFormDefaults = (alert?: TAlert): TAlertForm => {+ const buildFormDefaults = (alert: TAlert | undefined, defaultName: string): TAlertForm => {if (!alert) {return {- name: DEFAULT_ALERT_NAMES[DEFAULT_EVENT_TYPE],+ name: defaultName,description: "",resourceType: AlertResourceType.IdentityAuthentication,- eventType: AlertEventType.IdentityAuthenticationExpiry,+ eventType: DEFAULT_EVENT_TYPE,alertBeforeDays: DEFAULT_ALERT_BEFORE_DAYS,dailyReminder: false,enabled: true,@@@ -102,15 -100,24 +106,19 @@@};};-export const AlertForm = ({- projectId,- scopeName,- resourceId,- resourceName,- alert,- onComplete,- onCancel-}: Props) => {+export const AlertForm = ({ projectId, resourceId, alert, onComplete, onCancel }: Props) => {const isEditing = Boolean(alert);const scopeVariant = useScopeVariant();+ const isAgentVault = scopeVariant === "av";const createAlert = useCreateAlert();const updateAlert = useUpdateAlert();const formMethods = useForm<TAlertForm>({resolver: zodResolver(alertFormSchema),- defaultValues: buildFormDefaults(alert)- defaultValues: buildFormDefaults(alert, isAgentVault ? "" : DEFAULT_ALERT_NAME)++ defaultValues: buildFormDefaults(++ alert,++ isAgentVault ? "" : DEFAULT_ALERT_NAMES[DEFAULT_EVENT_TYPE]++ )});const {@@@ -123,21 -128,20 +131,24 @@@} = formMethods;const resourceTypeValue = useWatch({ control, name: "resourceType" });- const isProjectScope = Boolean(projectId);+ const eventTypeValue = useWatch({ control, name: "eventType" });+ const isExpiryEvent = eventTypeValue === AlertEventType.IdentityAuthenticationExpiry;++ const alertNamePlaceholders = isAgentVault++ ? AGENT_VAULT_ALERT_NAME_PLACEHOLDERS++ : DEFAULT_ALERT_NAMES;const isResourceScope = Boolean(resourceId ?? alert?.resourceId);- // eslint-disable-next-line no-nested-ternary- const watchTarget = isResourceScope- ? (resourceName ?? "this machine identity")- : isProjectScope- ? `every machine identity in ${scopeName ?? "this project"}`- : `every machine identity in this ${scopeVariant === "sub-org" ? "sub-organization" : "organization"}`;+ const handleEventTypeChange = (previous: AlertEventType, next: AlertEventType) => {+ setValue("eventType", next, { shouldDirty: true });+ if (getValues("name") === DEFAULT_ALERT_NAMES[previous]) {+ setValue("name", DEFAULT_ALERT_NAMES[next]);+ }+ };const onSubmit = async (data: TAlertForm) => {- const condition = {- alertBefore: toAlertBefore(data.alertBeforeDays),- dailyReminder: data.dailyReminder- };+ const condition =+ data.eventType === AlertEventType.IdentityAuthenticationExpiry+ ? { alertBefore: toAlertBefore(data.alertBeforeDays), dailyReminder: data.dailyReminder }+ : null;const channels = data.channels.map(toChannelInput);try {if (isEditing && alert) {@@@ -184,11 -188,10 +195,12 @@@<Inputid="alert-name"autoFocus- placeholder={isAgentVault ? ALERT_NAME_PLACEHOLDER : DEFAULT_ALERT_NAME}+ placeholder={- DEFAULT_ALERT_NAMES[eventTypeValue] ?? DEFAULT_ALERT_NAMES[DEFAULT_EVENT_TYPE]++ alertNamePlaceholders[eventTypeValue] ?? alertNamePlaceholders[DEFAULT_EVENT_TYPE]+ }isError={Boolean(errors.name)}{...register("name")}+ autoComplete="off"/><FieldError errors={[errors.name]} /></FieldContent>