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: actor_id feedback
Tre Dubravaf517eddc7eeb
diff --git a/backend/src/ee/services/audit-log/audit-log-service.ts b/backend/src/ee/services/audit-log/audit-log-service.tsindex 7b0870243e..ab61f7f4c7 100644--- a/backend/src/ee/services/audit-log/audit-log-service.ts+++ b/backend/src/ee/services/audit-log/audit-log-service.ts@@ -13,7 +13,7 @@ import { ProjectPermissionAuditLogsActions, ProjectPermissionSub } from "../permimport { TClickHouseAuditLogDALFactory } from "./audit-log-clickhouse-dal";import { TAuditLogDALFactory } from "./audit-log-dal";import { TAuditLogQueueServiceFactory } from "./audit-log-queue";-import { EventType, TAuditLogServiceFactory } from "./audit-log-types";+import { ACTOR_TYPE_TO_METADATA_ID_KEY, EventType, TAuditLogServiceFactory } from "./audit-log-types";type TAuditLogServiceFactoryDep = {auditLogDAL: TAuditLogDALFactory;@@ -66,6 +66,12 @@ export const auditLogServiceFactory = ({);}+ if (filter.auditLogActorId && filter.actorType && !ACTOR_TYPE_TO_METADATA_ID_KEY[filter.actorType]) {+ throw new BadRequestError({+ message: `Actor type '${filter.actorType}' does not support filtering by actor ID`+ });+ }+const appCfg = getConfig();const useClickHouse = appCfg.CLICKHOUSE_AUDIT_LOG_ENABLED && clickhouseAuditLogDAL;diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex accccf87f5..fa247d355d 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -698,6 +698,10 @@ export enum EventType {PKI_SIGNER_SIGN = "pki-signer-sign"}+// Maps each actor type to the JSONB key that holds the actor's primary ID in actorMetadata.+// Derived from the *ActorMetadata interfaces below. Note that ACME_PROFILE and EST_ACCOUNT+// both use "profileId" as their identifying key — this is intentional and matches their+// respective metadata schemas (AcmeProfileActorMetadata, EstAccountActorMetadata).export const ACTOR_TYPE_TO_METADATA_ID_KEY: Partial<Record<ActorType, string>> = {[ActorType.USER]: "userId",[ActorType.IDENTITY]: "identityId",diff --git a/frontend/src/hooks/api/auditLogs/useAuditLogActorSuggestions.ts b/frontend/src/hooks/api/auditLogs/useAuditLogActorSuggestions.tsindex f2e9097d64..f14f4b6517 100644--- a/frontend/src/hooks/api/auditLogs/useAuditLogActorSuggestions.ts+++ b/frontend/src/hooks/api/auditLogs/useAuditLogActorSuggestions.ts@@ -16,7 +16,8 @@ type UseAuditLogActorSuggestionsResult = {};export const useAuditLogActorSuggestions = (- actorType?: ActorType+ actorType?: ActorType,+ enabled = false): UseAuditLogActorSuggestionsResult => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id ?? "";@@ -24,12 +25,12 @@ export const useAuditLogActorSuggestions = (const { data: orgUsers = [], isLoading: isLoadingUsers } = useQuery({queryKey: userKeys.getOrgUsers(orgId),queryFn: () => fetchOrgUsers(orgId),- enabled: Boolean(orgId) && (!actorType || actorType === ActorType.USER)+ enabled: enabled && Boolean(orgId) && (!actorType || actorType === ActorType.USER)});const { data: orgIdentities, isLoading: isLoadingIdentities } = useQuery({...orgIdentityQuery.list({ limit: 100 }),- enabled: actorType === ActorType.IDENTITY+ enabled: enabled && actorType === ActorType.IDENTITY});const suggestions = useMemo<ActorSuggestion[]>(() => {diff --git a/frontend/src/pages/organization/AuditLogsPage/components/AuditSearchFilter.tsx b/frontend/src/pages/organization/AuditLogsPage/components/AuditSearchFilter.tsxindex 26ba3c689a..8841e25a81 100644--- a/frontend/src/pages/organization/AuditLogsPage/components/AuditSearchFilter.tsx+++ b/frontend/src/pages/organization/AuditLogsPage/components/AuditSearchFilter.tsx@@ -73,7 +73,6 @@ export const AuditSearchFilter = ({ filters, onFiltersChange, hasProjectContextconst currentActorType = filters.find((f) => f.property === "actor")?.value as| ActorType| undefined;- const { suggestions: actorIdSuggestions } = useAuditLogActorSuggestions(currentActorType);const [isOpen, setIsOpen] = useState(false);const [query, setQuery] = useState("");const [highlightedIndex, setHighlightedIndex] = useState(-1);@@ -92,6 +91,11 @@ export const AuditSearchFilter = ({ filters, onFiltersChange, hasProjectContextconst isComposing = isTypingValue && (propertyDef || isFreetext);const hasProjectFilter =hasProjectContext || filters.some((filter) => filter.property === "project");+ const hasActorId = propertyKey === "actor_id" || filters.some((f) => f.property === "actor_id");+ const { suggestions: actorIdSuggestions } = useAuditLogActorSuggestions(+ currentActorType,+ hasActorId+ );const valueSuggestions = useMemo(() => {const suggestions = propertyKey === "actor_id" ? actorIdSuggestions : propertyDef?.suggestions;