Skip to content

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

remove duplication

Thiago Araujo da Silva84c234a08003
diff --git a/backend/src/ee/services/audit-log-stream-outbox/audit-log-stream-outbox-service.ts b/backend/src/ee/services/audit-log-stream-outbox/audit-log-stream-outbox-service.ts
index 4a9284bccb..058a744474 100644
--- a/backend/src/ee/services/audit-log-stream-outbox/audit-log-stream-outbox-service.ts
+++ b/backend/src/ee/services/audit-log-stream-outbox/audit-log-stream-outbox-service.ts
@@ -17,7 +17,8 @@ import { LOG_STREAM_FACTORY_MAP } from "../audit-log-stream/audit-log-stream-fac
import {
auditLogMatchesStreamFilter,
decryptLogStreamCredentials,
- resolveAuditLogProduct
+ resolveAuditLogProduct,
+ streamHasProductFilter
} from "../audit-log-stream/audit-log-stream-fns";
import { TAuditLogStreamFilters } from "../audit-log-stream/audit-log-stream-schemas";
import { TAuditLogStreamOutboxDALFactory } from "./audit-log-stream-outbox-dal";
@@ -150,9 +151,7 @@ export const auditLogStreamOutboxServiceFactory = ({
// that most orgs have no streams configured, so a per-org loop is mostly empty round-trips.
const streams = await auditLogStreamDAL.find({ $in: { orgId: [...logsByOrg.keys()] } });
- const hasProductFilter = streams.some(
- (stream) => ((stream.filters as TAuditLogStreamFilters | null)?.products?.length ?? 0) > 0
- );
+ const hasProductFilter = streams.some(streamHasProductFilter);
let projectTypeById = new Map<string, string>();
if (hasProductFilter) {
const projectIds = new Set<string>();
@@ -172,7 +171,7 @@ export const auditLogStreamOutboxServiceFactory = ({
if (!logs) continue;
const filters = stream.filters as TAuditLogStreamFilters | null;
- const streamHasFilter = (filters?.products?.length ?? 0) > 0;
+ const streamHasFilter = streamHasProductFilter(stream);
let streamReceivedRow = false;
for (const log of logs) {
if (streamHasFilter && !auditLogMatchesStreamFilter(resolveAuditLogProduct(log, projectTypeById), filters)) {
diff --git a/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts b/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts
index 3049d526ca..4f40f49aa8 100644
--- a/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts
+++ b/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts
@@ -63,6 +63,9 @@ export const decryptLogStreamCredentials = async ({
return JSON.parse(decryptedPlainTextBlob.toString()) as TAuditLogStreamCredentials;
};
+export const streamHasProductFilter = (stream: Pick<TAuditLogStreams, "filters">): boolean =>
+ ((stream.filters as TAuditLogStreamFilters | null)?.products?.length ?? 0) > 0;
+
export const resolveAuditLogProduct = (
log: Pick<TAuditLogs, "projectId">,
projectTypeById: Map<string, string>
diff --git a/frontend/src/components/v2/FilterableSelect/FilterableSelect.tsx b/frontend/src/components/v2/FilterableSelect/FilterableSelect.tsx
index 2a8838c64f..92e1bb341b 100644
--- a/frontend/src/components/v2/FilterableSelect/FilterableSelect.tsx
+++ b/frontend/src/components/v2/FilterableSelect/FilterableSelect.tsx
@@ -16,10 +16,12 @@ export const FilterableSelect = <T,>({
groupBy = null,
getGroupHeaderLabel = null,
options = [],
+ menuListClassName,
...props
}: Props<T> & {
groupBy?: string | null;
getGroupHeaderLabel?: ((groupValue: any) => string) | null;
+ menuListClassName?: string;
}) => {
let processedOptions = options;
@@ -104,7 +106,7 @@ export const FilterableSelect = <T,>({
clearIndicator: () => "p-1 hover:text-red text-bunker-400",
indicatorSeparator: () => "bg-bunker-400",
dropdownIndicator: () => "text-bunker-200 p-1",
- menuList: () => "flex flex-col gap-1 max-h-[18rem] overflow-y-auto thin-scrollbar",
+ menuList: () => twMerge("flex flex-col gap-1", menuListClassName),
menu: () =>
"my-2 p-2 border text-sm text-mineshaft-200 thin-scrollbar bg-mineshaft-900 border-mineshaft-600 rounded-md",
groupHeading: () => "ml-3 mt-2 mb-1 text-mineshaft-400 text-sm",
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamProductsField.tsx b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamProductsField.tsx
index e6ef1cedef..4db383ed87 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamProductsField.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamProductsField.tsx
@@ -155,6 +155,7 @@ export const ProductsField = () => {
placeholder="All products"
getOptionValue={(option) => option.value}
getOptionLabel={(option) => option.label}
+ menuListClassName="max-h-[18rem] overflow-y-auto thin-scrollbar"
components={{ Option: ProductOptionItem }}
menuPortalTarget={menuPortalTarget ?? undefined}
menuPlacement="auto"