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 audit log
Thiago Araujo da Silva8eab7679fb00
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex 0950d9a0b9..ade2a21bfd 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -6750,6 +6750,8 @@ interface CreateOauthClientEvent {clientId: string;name: string;grantTypes: string[];+ tokenExchangeAudience?: string | null;+ tokenExchangeIdpSatisfiesMfa: boolean;};}diff --git a/backend/src/server/config/rateLimiter.ts b/backend/src/server/config/rateLimiter.tsindex b69bc32836..dbdca95001 100644--- a/backend/src/server/config/rateLimiter.ts+++ b/backend/src/server/config/rateLimiter.ts@@ -3,6 +3,7 @@ import type { RateLimitOptions, RateLimitPluginOptions } from "@fastify/rate-limimport { getConfig } from "@app/lib/config/env";import { buildRedisFromConfig } from "@app/lib/config/redis";import { RateLimitError } from "@app/lib/errors";+import { parseBasicAuthHeader } from "@app/services/oauth-client/oauth-client-fns";export const globalRateLimiterCfg = (): RateLimitPluginOptions => {const appCfg = getConfig();@@ -54,12 +55,20 @@ export const authRateLimit: RateLimitOptions = {keyGenerator: (req) => req.realIp};-export const oauthTokenLimit = ({ keyGenerator }: Pick<RateLimitOptions, "keyGenerator">): RateLimitOptions => ({+// Keyed per IP *and* client, so one noisy integration cannot exhaust the budget of every other client+// behind the same egress IP. The hook runs before validation, so the body is still unparsed.+export const oauthTokenLimit: RateLimitOptions = {timeWindow: 60 * 1000,hook: "preValidation",max: (req) => req.rateLimits.writeLimit,- keyGenerator-});+ keyGenerator: (req) => {+ const suppliedClientId = (req.body as { client_id?: unknown } | undefined)?.client_id;+ const clientId =+ parseBasicAuthHeader(req.headers.authorization)?.clientId ??+ (typeof suppliedClientId === "string" ? suppliedClientId : undefined);+ return clientId ? `${req.realIp}:${clientId.slice(0, 256)}` : req.realIp;+ }+};export const inviteUserRateLimit: RateLimitOptions = {timeWindow: 60 * 1000,diff --git a/backend/src/server/routes/v1/oauth-router.ts b/backend/src/server/routes/v1/oauth-router.tsindex 9cf6ff164b..0ddb763dad 100644--- a/backend/src/server/routes/v1/oauth-router.ts+++ b/backend/src/server/routes/v1/oauth-router.ts@@ -87,7 +87,9 @@ export const registerOAuthRouter = async (server: FastifyZodProvider) => {clientDbId: client.id,clientId: client.clientId,name: client.name,- grantTypes: client.grantTypes+ grantTypes: client.grantTypes,+ tokenExchangeAudience: client.tokenExchangeAudience,+ tokenExchangeIdpSatisfiesMfa: client.tokenExchangeIdpSatisfiesMfa}}});@@ -414,15 +416,7 @@ export const registerOAuthRouter = async (server: FastifyZodProvider) => {method: "POST",url: "/token",config: {- rateLimit: oauthTokenLimit({- keyGenerator: (req) => {- const suppliedClientId = (req.body as { client_id?: unknown } | undefined)?.client_id;- const clientId =- parseBasicAuthHeader(req.headers.authorization)?.clientId ??- (typeof suppliedClientId === "string" ? suppliedClientId : undefined);- return clientId ? `${req.realIp}:${clientId.slice(0, 256)}` : req.realIp;- }- })+ rateLimit: oauthTokenLimit},schema: {body: z.object({diff --git a/frontend/src/hooks/api/oauthClients/index.tsx b/frontend/src/hooks/api/oauthClients/index.tsxindex a25e07c847..4927413194 100644--- a/frontend/src/hooks/api/oauthClients/index.tsx+++ b/frontend/src/hooks/api/oauthClients/index.tsx@@ -7,3 +7,4 @@ export {} from "./mutations";export { useGetOauthAuthorizeInfo, useGetOauthClients } from "./queries";export type { TOauthAuthorizeInfo, TOauthClient } from "./types";+export { OauthGrantType } from "./types";diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsTableRow.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsTableRow.tsxindex fa573b6e68..ecfca05b7f 100644--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsTableRow.tsx+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsTableRow.tsx@@ -67,10 +67,12 @@ export const LogsTableRow = ({ auditLog, rowNumber, timezone, onClick }: Props)<Tag label="event" value={auditLog.event.type} /><Tag label="actor" value={auditLog.actor.type} />{auditLog.actor.type === ActorType.USER && (- <Tag label="user_email" value={auditLog.actor.metadata.email} />- )}- {auditLog.actor.type === ActorType.USER && auditLog.actor.metadata.oauthClientId && (- <Tag label="oauth_application" value={auditLog.actor.metadata.oauthClientId} />+ <>+ <Tag label="user_email" value={auditLog.actor.metadata.email} />+ {auditLog.actor.metadata.oauthClientId && (+ <Tag label="oauth_application" value={auditLog.actor.metadata.oauthClientId} />+ )}+ </>)}{auditLog.actor.type === ActorType.IDENTITY && (<Tag label="identity_name" value={auditLog.actor.metadata.name} />diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientModal.tsxindex ada84a1610..397946e56c 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OauthClientModal.tsx@@ -32,12 +32,12 @@ import {} from "@app/components/v3";import { useOrganization } from "@app/context";import {+ OauthGrantType,TOauthClient,useCreateOauthClient,useGetOIDCConfig,useUpdateOauthClient} from "@app/hooks/api";-import { OauthGrantType } from "@app/hooks/api/oauthClients/types";import { UsePopUpState } from "@app/hooks/usePopUp";const LOOPBACK_HOSTNAMES = new Set(["localhost", "127.0.0.1", "::1"]);diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OrgOauthClientsTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OrgOauthClientsTab.tsxindex ca0c3d0c67..ad34330d35 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OrgOauthClientsTab.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgOauthClientsTab/OrgOauthClientsTab.tsx@@ -51,12 +51,12 @@ import {} from "@app/context";import { usePopUp } from "@app/hooks";import {+ OauthGrantType,TOauthClient,useDeleteOauthClient,useGetOauthClients,useRotateOauthClientSecret} from "@app/hooks/api";-import { OauthGrantType } from "@app/hooks/api/oauthClients/types";import { OauthClientModal } from "./OauthClientModal";import { OauthClientSecretModal } from "./OauthClientSecretModal";diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsxindex 81984730eb..5d15bf835b 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx@@ -37,8 +37,7 @@ import {useOrgPermission,useSubscription} from "@app/context";-import { useGetOauthClients, useGetOIDCConfig } from "@app/hooks/api";-import { OauthGrantType } from "@app/hooks/api/oauthClients/types";+import { OauthGrantType, useGetOauthClients, useGetOIDCConfig } from "@app/hooks/api";import { useUpdateOIDCConfig } from "@app/hooks/api/oidcConfig/mutations";import { usePopUp } from "@app/hooks/usePopUp";@@ -64,6 +63,7 @@ export const OrgOIDCSection = ({ onSwitchProvider }: Props): JSX.Element => {canReadApplications ? (currentOrg?.id ?? "") : "",OauthGrantType.TokenExchange);+ const dependentClients = tokenExchangeClients ?? [];const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp(["addOIDC",@@ -245,13 +245,13 @@ export const OrgOIDCSection = ({ onSwitchProvider }: Props): JSX.Element => {)}</OrgPermissionCan></Field>- {Boolean(tokenExchangeClients?.length) && (+ {dependentClients.length > 0 && (<Alert variant="info"><Info /><AlertTitle>- {tokenExchangeClients?.length === 1+ {dependentClients.length === 1? "1 application depends on this issuer"- : `${tokenExchangeClients?.length} applications depend on this issuer`}+ : `${dependentClients.length} applications depend on this issuer`}</AlertTitle><AlertDescription><p>@@ -260,7 +260,7 @@ export const OrgOIDCSection = ({ onSwitchProvider }: Props): JSX.Element => {changing the issuer stops them working.</p><div className="mt-2 flex flex-wrap gap-1">- {tokenExchangeClients?.map((client) => (+ {dependentClients.map((client) => (<Badge key={client.id} variant="neutral">{client.name}</Badge>