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 review points
Thiago Araujo da Silvaba4cb19a5a12
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex 173f0fc209..6a9e7c745d 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -937,7 +937,8 @@ export enum EventType {// AlertsCREATE_ALERT = "create-alert",UPDATE_ALERT = "update-alert",- DELETE_ALERT = "delete-alert"+ DELETE_ALERT = "delete-alert",+ TEST_ALERT_CHANNEL = "test-alert-channel"}// Maps each actor type to the JSONB key that holds the actor's primary ID in actorMetadata.@@ -7491,10 +7492,24 @@ interface DeleteAlertEvent {};}+interface TestAlertChannelEvent {+ type: EventType.TEST_ALERT_CHANNEL;+ metadata: {+ channelId?: string;+ channelType: string;+ resourceType: string;+ resourceId?: string | null;+ success: boolean;+ deliveredTo?: number;+ error?: string;+ };+}+export type Event =| CreateAlertEvent| UpdateAlertEvent| DeleteAlertEvent+ | TestAlertChannelEvent| CreateSubOrganizationEvent| UpdateSubOrganizationEvent| DeleteSubOrganizationEventdiff --git a/backend/src/server/routes/v1/alert-router.ts b/backend/src/server/routes/v1/alert-router.tsindex 7fe93bdd33..a83bc1ea5a 100644--- a/backend/src/server/routes/v1/alert-router.ts+++ b/backend/src/server/routes/v1/alert-router.ts@@ -131,14 +131,34 @@ export const registerAlertRouter = async (server: FastifyZodProvider) => {}},onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),- handler: async (req) =>- server.services.alertChannelTest.testChannel({+ handler: async (req) => {+ const result = await server.services.alertChannelTest.testChannel({...req.body,actor: req.permission.type,actorId: req.permission.id,actorAuthMethod: req.permission.authMethod,actorOrgId: req.permission.orgId- })+ });++ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ ...(req.body.projectId ? { projectId: req.body.projectId } : { orgId: req.permission.orgId }),+ event: {+ type: EventType.TEST_ALERT_CHANNEL,+ metadata: {+ channelId: req.body.channelId,+ channelType: req.body.channelType,+ resourceType: req.body.resourceType,+ resourceId: req.body.resourceId,+ success: result.success,+ deliveredTo: result.deliveredTo,+ error: result.error+ }+ }+ });++ return result;+ }});server.route({diff --git a/backend/src/services/super-admin/super-admin-service.ts b/backend/src/services/super-admin/super-admin-service.tsindex 359316a2c0..2dfc794862 100644--- a/backend/src/services/super-admin/super-admin-service.ts+++ b/backend/src/services/super-admin/super-admin-service.ts@@ -1035,15 +1035,22 @@ export const superAdminServiceFactory = ({if (!membershipRole) {throw new NotFoundError({ name: "Membership Role", message: "Membership role not found" });}- const [organizationMembership] = await membershipUserDAL.delete({- scopeOrgId: organizationId,- scope: AccessScope.Organization,- id: membershipId- });+ const organizationMembership = await membershipUserDAL.transaction(async (tx) => {+ const [deletedMembership] = await membershipUserDAL.delete(+ {+ scopeOrgId: organizationId,+ scope: AccessScope.Organization,+ id: membershipId+ },+ tx+ );- if (organizationMembership?.actorUserId) {- await alertChannelRecipientDAL.pruneOutOfScopeRecipients({ userIds: [organizationMembership.actorUserId] });- }+ if (deletedMembership?.actorUserId) {+ await alertChannelRecipientDAL.pruneOutOfScopeRecipients({ userIds: [deletedMembership.actorUserId] }, tx);+ }++ return deletedMembership;+ });return { ...organizationMembership, role: membershipRole.role, orgId: organizationId };};diff --git a/frontend/src/views/Alerts/AlertDetail.tsx b/frontend/src/views/Alerts/AlertDetail.tsxindex 2c90dd4e73..ded8d09b28 100644--- a/frontend/src/views/Alerts/AlertDetail.tsx+++ b/frontend/src/views/Alerts/AlertDetail.tsx@@ -79,13 +79,9 @@ export const AlertDetail = ({const handleDeleteAlert = async () => {if (!existingAlert) return;- try {- await deleteAlert.mutateAsync({ alertId: existingAlert.id });- createNotification({ text: "Successfully deleted alert", type: "success" });- handlePopUpToggle("deleteAlert", false);- } catch {- createNotification({ text: "Failed to delete alert", type: "error" });- }+ await deleteAlert.mutateAsync({ alertId: existingAlert.id });+ createNotification({ text: "Successfully deleted alert", type: "success" });+ handlePopUpToggle("deleteAlert", false);};const renderValue = () => {diff --git a/frontend/src/views/Alerts/AlertForm.tsx b/frontend/src/views/Alerts/AlertForm.tsxindex 79f06c6d3f..a331bafa05 100644--- a/frontend/src/views/Alerts/AlertForm.tsx+++ b/frontend/src/views/Alerts/AlertForm.tsx@@ -13,6 +13,7 @@ import {FieldError,FieldLabel,Input,+ Label,OrgIcon,ProjectIcon,Select,@@ -308,7 +309,15 @@ export const AlertForm = ({render={({ field: { value } }) => (<FixedField label="Event"><Badge variant="warning">{ALERT_EVENT_TYPE_LABELS[value]}</Badge>- <span className="text-xs text-muted">Alerts before a credential expires</span>+ <div className="flex flex-col gap-0.5">+ <span className="text-sm text-foreground">+ Alerts before a credential expires.+ </span>+ <span className="text-xs text-muted">+ Supports Universal Auth client secrets with a TTL. More credential types+ coming.+ </span>+ </div></FixedField>)}/>@@ -394,9 +403,9 @@ export const AlertForm = ({control={control}name="enabled"render={({ field }) => (- <FieldLabel+ <LabelhtmlFor="alert-enabled"- className="flex cursor-pointer items-center gap-2 text-sm text-muted"+ className="cursor-pointer text-sm font-normal text-muted">Enabled<Switch@@ -405,7 +414,7 @@ export const AlertForm = ({checked={field.value}onCheckedChange={field.onChange}/>- </FieldLabel>+ </Label>)}/></div>diff --git a/frontend/src/views/Alerts/ChannelCard.tsx b/frontend/src/views/Alerts/ChannelCard.tsxindex 80e144a14e..a50784e723 100644--- a/frontend/src/views/Alerts/ChannelCard.tsx+++ b/frontend/src/views/Alerts/ChannelCard.tsx@@ -10,6 +10,7 @@ import {FieldLabel,IconButton,Input,+ Label,Switch} from "@app/components/v3";import { useScopeVariant } from "@app/hooks";@@ -120,9 +121,9 @@ export const ChannelCard = ({control={control}name={`channels.${index}.enabled`}render={({ field }) => (- <FieldLabel+ <LabelhtmlFor={`channel-${index}-enabled`}- className="flex cursor-pointer items-center gap-2 text-xs text-muted"+ className="cursor-pointer text-xs font-normal text-muted">Enabled<Switch@@ -131,7 +132,7 @@ export const ChannelCard = ({checked={field.value}onCheckedChange={field.onChange}/>- </FieldLabel>+ </Label>)}/>{canRemove && (