Skip to content

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

fix(alerts): reject project-scoped audit log stream alerts

Calvindc8f02642055
diff --git a/backend/src/services/alert/providers/audit-log-stream-alert-provider.ts b/backend/src/services/alert/providers/audit-log-stream-alert-provider.ts
index 171e736931..aa5736e2ef 100644
--- a/backend/src/services/alert/providers/audit-log-stream-alert-provider.ts
+++ b/backend/src/services/alert/providers/audit-log-stream-alert-provider.ts
@@ -119,7 +119,8 @@ export const auditLogStreamAlertProviderFactory = ({
};
// The delivery-failed event carries no resourceId, so only org-wide alerts can hear it. An alert bound
- // to one stream would never fire.
+ // to one stream would never fire. It carries no projectId either, so a project alert would fire for
+ // every stream in the org while staying hidden from the org-level list where these are managed.
const assertResourceInScope = async (input: {
orgId: string;
projectId?: string | null;
@@ -130,6 +131,11 @@ export const auditLogStreamAlertProviderFactory = ({
message: "Audit log stream alerts apply to every stream in the organization and cannot target one stream"
});
}
+ if (input.projectId) {
+ throw new BadRequestError({
+ message: "Audit log stream alerts apply to the whole organization and cannot be scoped to a project"
+ });
+ }
};
const assertPermission = async (input: TAlertPermissionInput): Promise<void> => {