Skip to content

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

fix audit log permissioning

x0322051b7a701eb1b1
diff --git a/backend/src/ee/routes/v1/pam-routers/pam-session-chunk-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-session-chunk-router.ts
index b0c1f8885c..4462389016 100644
--- a/backend/src/ee/routes/v1/pam-routers/pam-session-chunk-router.ts
+++ b/backend/src/ee/routes/v1/pam-routers/pam-session-chunk-router.ts
@@ -162,6 +162,7 @@ export const registerPamSessionChunkRouter = async (server: FastifyZodProvider)
type: EventType.PAM_SESSION_CHUNK_UPLOAD,
metadata: {
sessionId: req.params.sessionId,
+ accountId: result.accountId ?? undefined,
chunkIndex: req.body.chunkIndex,
storageBackend: result.storageBackend,
ciphertextBytes: req.body.ciphertextBytes
diff --git a/backend/src/ee/routes/v1/pam-routers/pam-session-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-session-router.ts
index ccb43ccd3e..24fdeed364 100644
--- a/backend/src/ee/routes/v1/pam-routers/pam-session-router.ts
+++ b/backend/src/ee/routes/v1/pam-routers/pam-session-router.ts
@@ -156,6 +156,7 @@ export const registerPamSessionRouter = async (server: FastifyZodProvider) => {
type: EventType.PAM_SESSION_START,
metadata: {
sessionId: req.params.sessionId,
+ accountId: result.accountId ?? undefined,
accountName: result.accountName
}
}
@@ -186,10 +187,8 @@ export const registerPamSessionRouter = async (server: FastifyZodProvider) => {
},
onRequest: verifyAuth([AuthMode.GATEWAY_ACCESS_TOKEN]),
handler: async (req) => {
- const { projectId, accountName, alreadyEnded } = await server.services.pamSession.endSessionFromGateway(
- req.params.sessionId,
- req.permission.id
- );
+ const { projectId, accountId, accountName, alreadyEnded } =
+ await server.services.pamSession.endSessionFromGateway(req.params.sessionId, req.permission.id);
if (!alreadyEnded) {
await server.services.auditLog.createAuditLog({
@@ -200,6 +199,7 @@ export const registerPamSessionRouter = async (server: FastifyZodProvider) => {
type: EventType.PAM_SESSION_END,
metadata: {
sessionId: req.params.sessionId,
+ accountId: accountId ?? undefined,
accountName
}
}
@@ -245,6 +245,7 @@ export const registerPamSessionRouter = async (server: FastifyZodProvider) => {
type: EventType.PAM_SESSION_TERMINATE,
metadata: {
sessionId: req.params.sessionId,
+ accountId: session.accountId ?? undefined,
accountName
}
}
diff --git a/backend/src/ee/services/audit-log/audit-log-clickhouse-dal.ts b/backend/src/ee/services/audit-log/audit-log-clickhouse-dal.ts
index a11141db50..f545e5dfe4 100644
--- a/backend/src/ee/services/audit-log/audit-log-clickhouse-dal.ts
+++ b/backend/src/ee/services/audit-log/audit-log-clickhouse-dal.ts
@@ -7,6 +7,7 @@ import { DatabaseError } from "@app/lib/errors";
import { logger } from "@app/lib/logger";
import { ActorType } from "@app/services/auth/auth-type";
+import { TPamAuditLogScope } from "./audit-log-dal";
import { ACTOR_TYPE_TO_METADATA_ID_KEY, EventType, filterableSecretEvents } from "./audit-log-types";
type TAuditLogWithProjectName = TAuditLogs & { projectName: string | null };
@@ -26,6 +27,7 @@ type TClickHouseFindArg = {
secretKey?: string;
eventType?: EventType[];
eventMetadata?: Record<string, string>;
+ pamScope?: TPamAuditLogScope;
};
// Shape of a row returned from ClickHouse's JSONEachRow format
@@ -122,6 +124,26 @@ export const clickhouseAuditLogDALFactory = (clickhouseClient: ClickHouseClient,
}
}
+ // PAM resource scoping: account logs by accountId, folder logs by folderId, and resource-less
+ // (product-level) logs only for product admins
+ if (arg.pamScope) {
+ const scopeClauses: string[] = [];
+ if (arg.pamScope.accountIds.length) {
+ scopeClauses.push("JSONExtractString(eventMetadata, 'accountId') IN ({pamAccountIds:Array(String)})");
+ params.pamAccountIds = arg.pamScope.accountIds;
+ }
+ if (arg.pamScope.folderIds.length) {
+ scopeClauses.push(
+ "(JSONHas(eventMetadata, 'folderId') AND NOT JSONHas(eventMetadata, 'accountId') AND JSONExtractString(eventMetadata, 'folderId') IN ({pamFolderIds:Array(String)}))"
+ );
+ params.pamFolderIds = arg.pamScope.folderIds;
+ }
+ if (arg.pamScope.includeProductLevel) {
+ scopeClauses.push("(NOT JSONHas(eventMetadata, 'accountId') AND NOT JSONHas(eventMetadata, 'folderId'))");
+ }
+ conditions.push(scopeClauses.length ? `(${scopeClauses.join(" OR ")})` : "1 = 0");
+ }
+
// Secret-specific filters (environment, secretPath, secretKey)
const eventIsSecretType =
!arg.eventType?.length || arg.eventType.some((event) => filterableSecretEvents.includes(event));
diff --git a/backend/src/ee/services/audit-log/audit-log-dal.ts b/backend/src/ee/services/audit-log/audit-log-dal.ts
index 88e901265b..624b4496f7 100644
--- a/backend/src/ee/services/audit-log/audit-log-dal.ts
+++ b/backend/src/ee/services/audit-log/audit-log-dal.ts
@@ -33,6 +33,7 @@ export interface TAuditLogDALFactory extends Omit<TOrmify<TableName.AuditLog>, "
secretKey?: string | undefined;
eventType?: EventType[] | undefined;
eventMetadata?: Record<string, string> | undefined;
+ pamScope?: TPamAuditLogScope | undefined;
},
tx?: knex.Knex
) => Promise<TAuditLogs[]>;
@@ -60,6 +61,12 @@ type TFindQuery = {
offset?: number;
};
+export type TPamAuditLogScope = {
+ accountIds: string[];
+ folderIds: string[];
+ includeProductLevel: boolean;
+};
+
const QUERY_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes
const AUDIT_LOG_PRUNE_BATCH_SIZE = 10000;
const MAX_RETRY_ON_FAILURE = 3;
@@ -83,7 +90,8 @@ export const auditLogDALFactory = (db: TDbClient) => {
secretPath,
secretKey,
eventType,
- eventMetadata
+ eventMetadata,
+ pamScope
},
tx
) => {
@@ -104,6 +112,43 @@ export const auditLogDALFactory = (db: TDbClient) => {
void sqlQuery.where("userAgentType", userAgentType);
}
+ // PAM resource scoping: account logs by accountId, folder logs by folderId, and resource-less
+ // (product-level) logs only for product admins
+ if (pamScope) {
+ const metaColumn = `"${TableName.AuditLog}"."eventMetadata"`;
+ const placeholders = (values: string[]) => values.map(() => "?").join(", ");
+ void sqlQuery.where((scope) => {
+ let matched = false;
+ if (pamScope.accountIds.length) {
+ matched = true;
+ void scope.orWhereRaw(
+ `${metaColumn}->>'accountId' IN (${placeholders(pamScope.accountIds)})`,
+ pamScope.accountIds
+ );
+ }
+ if (pamScope.folderIds.length) {
+ matched = true;
+ void scope.orWhere((folderScope) => {
+ void folderScope
+ .whereRaw(`jsonb_exists(${metaColumn}, 'folderId')`)
+ .whereRaw(`NOT jsonb_exists(${metaColumn}, 'accountId')`)
+ .whereRaw(`${metaColumn}->>'folderId' IN (${placeholders(pamScope.folderIds)})`, pamScope.folderIds);
+ });
+ }
+ if (pamScope.includeProductLevel) {
+ matched = true;
+ void scope.orWhere((productScope) => {
+ void productScope
+ .whereRaw(`NOT jsonb_exists(${metaColumn}, 'accountId')`)
+ .whereRaw(`NOT jsonb_exists(${metaColumn}, 'folderId')`);
+ });
+ }
+ if (!matched) {
+ void scope.whereRaw("1 = 0");
+ }
+ });
+ }
+
// Select statements
void sqlQuery
.select(selectAllTableCols(TableName.AuditLog))
diff --git a/backend/src/ee/services/audit-log/audit-log-service.ts b/backend/src/ee/services/audit-log/audit-log-service.ts
index 9c30f1838a..e986a30cb3 100644
--- a/backend/src/ee/services/audit-log/audit-log-service.ts
+++ b/backend/src/ee/services/audit-log/audit-log-service.ts
@@ -7,7 +7,7 @@ import { getConfig } from "@app/lib/config/env";
import { BadRequestError } from "@app/lib/errors";
import { logger } from "@app/lib/logger";
import { RequestContextKey } from "@app/lib/request-context/request-context-keys";
-import { ActorType } from "@app/services/auth/auth-type";
+import { ActorAuthMethod, ActorType } from "@app/services/auth/auth-type";
import { TNotificationServiceFactory } from "@app/services/notification/notification-service";
import { NotificationType } from "@app/services/notification/notification-types";
import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";
@@ -17,7 +17,7 @@ import { OrgPermissionAuditLogsActions, OrgPermissionSubjects } from "../permiss
import { TPermissionServiceFactory } from "../permission/permission-service-types";
import { ProjectPermissionAuditLogsActions, ProjectPermissionSub } from "../permission/project-permission";
import { TClickHouseAuditLogDALFactory } from "./audit-log-clickhouse-dal";
-import { TAuditLogDALFactory } from "./audit-log-dal";
+import { TAuditLogDALFactory, TPamAuditLogScope } from "./audit-log-dal";
import { TAuditLogQueueServiceFactory } from "./audit-log-queue";
import { ACTOR_TYPE_TO_METADATA_ID_KEY, EventType, TAuditLogServiceFactory } from "./audit-log-types";
@@ -33,6 +33,13 @@ type TAuditLogServiceFactoryDep = {
smtpService: Pick<TSmtpService, "sendMail">;
userDAL: Pick<TUserDALFactory, "getUsersByFilter">;
notificationService: Pick<TNotificationServiceFactory, "createUserNotifications">;
+ resolvePamAuditScope?: (args: {
+ projectId: string;
+ actor: ActorType;
+ actorId: string;
+ actorAuthMethod: ActorAuthMethod;
+ actorOrgId: string;
+ }) => Promise<TPamAuditLogScope | null>;
};
export const auditLogServiceFactory = ({
@@ -43,7 +50,8 @@ export const auditLogServiceFactory = ({
keyStore,
smtpService,
userDAL,
- notificationService
+ notificationService,
+ resolvePamAuditScope
}: TAuditLogServiceFactoryDep): TAuditLogServiceFactory => {
const listAuditLogs: TAuditLogServiceFactory["listAuditLogs"] = async ({
actorAuthMethod,
@@ -52,20 +60,35 @@ export const auditLogServiceFactory = ({
actor,
filter
}) => {
+ // Products with their own permission model (e.g. PAM) scope logs by resource
+ let pamScope: TPamAuditLogScope | null = null;
+
// Filter logs for specific project
if (filter.projectId) {
- const { permission } = await permissionService.getProjectPermission({
- actor,
- actorId,
- projectId: filter.projectId,
- actorAuthMethod,
- actorOrgId,
- actionProjectType: ActionProjectType.Any
- });
- ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionAuditLogsActions.Read,
- ProjectPermissionSub.AuditLogs
- );
+ pamScope = resolvePamAuditScope
+ ? await resolvePamAuditScope({
+ projectId: filter.projectId,
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId
+ })
+ : null;
+
+ if (!pamScope) {
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ projectId: filter.projectId,
+ actorAuthMethod,
+ actorOrgId,
+ actionProjectType: ActionProjectType.Any
+ });
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionAuditLogsActions.Read,
+ ProjectPermissionSub.AuditLogs
+ );
+ }
} else {
// Organization-wide logs
const { permission } = await permissionService.getOrgPermission({
@@ -106,7 +129,8 @@ export const auditLogServiceFactory = ({
secretKey: filter.secretKey,
environment: filter.environment,
orgId: actorOrgId,
- ...(filter.projectId ? { projectId: filter.projectId } : {})
+ ...(filter.projectId ? { projectId: filter.projectId } : {}),
+ ...(pamScope ? { pamScope } : {})
};
// If ClickHouse querying is enabled and available, use it instead of Postgres
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index b65b411660..d6c3af5a06 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -5736,6 +5736,7 @@ interface PamSessionStartEvent {
type: EventType.PAM_SESSION_START;
metadata: {
sessionId: string;
+ accountId?: string;
accountName: string;
};
}
@@ -5744,6 +5745,7 @@ interface PamSessionEndEvent {
type: EventType.PAM_SESSION_END;
metadata: {
sessionId: string;
+ accountId?: string;
accountName: string;
};
}
@@ -5752,6 +5754,7 @@ interface PamSessionTerminateEvent {
type: EventType.PAM_SESSION_TERMINATE;
metadata: {
sessionId: string;
+ accountId?: string;
accountName: string;
};
}
@@ -5760,6 +5763,7 @@ interface PamSessionChunkUploadEvent {
type: EventType.PAM_SESSION_CHUNK_UPLOAD;
metadata: {
sessionId: string;
+ accountId?: string;
chunkIndex: number;
storageBackend: string;
ciphertextBytes: number;
@@ -5770,6 +5774,7 @@ interface PamSessionUploadTokenInvalidEvent {
type: EventType.PAM_SESSION_UPLOAD_TOKEN_INVALID;
metadata: {
sessionId: string;
+ accountId?: string;
chunkIndex?: number;
};
}
diff --git a/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts b/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts
index 34871ea2c2..7e3ebcb581 100644
--- a/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts
+++ b/backend/src/ee/services/pam-session-recording/pam-recording-chunk-service.ts
@@ -244,7 +244,7 @@ export const pamSessionChunkServiceFactory = ({
throw err;
}
- return { ok: true as const, projectId: session.projectId, storageBackend: backend };
+ return { ok: true as const, projectId: session.projectId, accountId: session.accountId, storageBackend: backend };
};
const getSessionPlayback = async (sessionId: string, actor: OrgServiceActor) => {
diff --git a/backend/src/ee/services/pam-session/pam-session-service.ts b/backend/src/ee/services/pam-session/pam-session-service.ts
index c9f6cc3c5d..f3f71aa671 100644
--- a/backend/src/ee/services/pam-session/pam-session-service.ts
+++ b/backend/src/ee/services/pam-session/pam-session-service.ts
@@ -209,6 +209,7 @@ export const pamSessionServiceFactory = ({
credentials: { ...connectionDetails, ...credentials },
recording,
projectId: session.projectId,
+ accountId: session.accountId,
accountName: session.accountName,
sessionStarted
};
@@ -225,6 +226,7 @@ export const pamSessionServiceFactory = ({
return {
projectId: session.projectId,
+ accountId: session.accountId,
accountName: session.accountName,
alreadyEnded: !updatedSession
};
diff --git a/backend/src/ee/services/pam-web-access/pam-web-access-service.ts b/backend/src/ee/services/pam-web-access/pam-web-access-service.ts
index 01667c3594..96f4b27e8a 100644
--- a/backend/src/ee/services/pam-web-access/pam-web-access-service.ts
+++ b/backend/src/ee/services/pam-web-access/pam-web-access-service.ts
@@ -234,7 +234,7 @@ export const pamWebAccessServiceFactory = ({
socket.off("message", preAuthHandler);
};
- let session: { id: string } | null = null;
+ let session: { id: string; accountId?: string | null } | null = null;
let cleanedUp = false;
let handlerResult: TSessionHandlerResult | null = null;
let relayServer: { port: number; cleanup: () => Promise<void> } | null = null;
@@ -292,7 +292,7 @@ export const pamWebAccessServiceFactory = ({
projectId,
event: {
type: EventType.PAM_SESSION_END,
- metadata: { sessionId, accountName }
+ metadata: { sessionId, accountId: session.accountId ?? undefined, accountName }
}
});
}
diff --git a/backend/src/ee/services/pam/CLAUDE.md b/backend/src/ee/services/pam/CLAUDE.md
index 67856ccbc2..66cf9b16d0 100644
--- a/backend/src/ee/services/pam/CLAUDE.md
+++ b/backend/src/ee/services/pam/CLAUDE.md
@@ -60,6 +60,15 @@ Every list/mutation endpoint checks action-level permissions, not just membershi
| Edit/delete folder | `EditFolder`/`DeleteFolder` (via folder permission) |
| Template list/getById | Product membership only (templates are project-wide config) |
| Template create/update/delete | Product Admin |
+| View audit logs | `ViewAuditLogs` per resource for account/folder logs; Product Admin for resource-less (product-level) logs |
+
+### Audit Log Scoping
+
+PAM audit logs are served through the shared `GET /organization/audit-logs` endpoint, but scoped by the PAM permission model rather than the generic project `AuditLogs` permission. `pamAuditLogScopeResolverFactory` (`pam/pam-audit-log-fns.ts`) is injected into `auditLogServiceFactory` as `resolvePamAuditScope`; for a PAM project it returns `{ accountIds, folderIds, includeProductLevel }` and the shared service skips its generic permission check and passes the scope to `auditLogDAL.find`. Returns `null` for non-PAM projects (generic check still applies).
+
+Scoping rules (enforced via `eventMetadata` json): account-scoped logs (have `accountId`) and folder-scoped logs (have `folderId`) are returned only when the actor has `ViewAuditLogs` on that resource — a folder grant cascades to the accounts inside it. Resource-less logs (neither id, e.g. template/product-member events) are returned only to product admins. Admins are **not** exempt from the resource check. The scope filter is implemented in both audit-log backends (Postgres `auditLogDAL` and `clickhouseAuditLogDAL`), so it holds regardless of `CLICKHOUSE_AUDIT_LOG_ENABLED`.
+
+**Requirement for new PAM events:** any account- or folder-scoped audit event must put `accountId`/`folderId` in its `eventMetadata`, or it falls into the product-level bucket and is hidden from resource viewers.
### Auth Modes
diff --git a/backend/src/ee/services/pam/pam-audit-log-fns.ts b/backend/src/ee/services/pam/pam-audit-log-fns.ts
new file mode 100644
index 0000000000..6ec7f30bf3
--- /dev/null
+++ b/backend/src/ee/services/pam/pam-audit-log-fns.ts
@@ -0,0 +1,69 @@
+import { ProjectType } from "@app/db/schemas";
+import { ActorAuthMethod, ActorType } from "@app/services/auth/auth-type";
+import { TMembershipDALFactory } from "@app/services/membership/membership-dal";
+import { TMembershipRoleDALFactory } from "@app/services/membership/membership-role-dal";
+import { TProjectDALFactory } from "@app/services/project/project-dal";
+
+import { TPamAuditLogScope } from "../audit-log/audit-log-dal";
+import { TPamAccountDALFactory } from "../pam-account/pam-account-dal";
+import { TPermissionServiceFactory } from "../permission/permission-service-types";
+import { ResourcePermissionPamResourceActions } from "../permission/resource-permission";
+import { PamProductRole } from "./pam-enums";
+import { getResourceIdsWithActions, verifyProductMembership } from "./pam-permission";
+
+type TPamAuditLogScopeResolverDeps = {
+ projectDAL: Pick<TProjectDALFactory, "findById">;
+ permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
+ membershipDAL: Pick<TMembershipDALFactory, "findResourceMembershipsForActor">;
+ membershipRoleDAL: Pick<TMembershipRoleDALFactory, "find">;
+ pamAccountDAL: Pick<TPamAccountDALFactory, "find">;
+};
+
+export const pamAuditLogScopeResolverFactory = ({
+ projectDAL,
+ permissionService,
+ membershipDAL,
+ membershipRoleDAL,
+ pamAccountDAL
+}: TPamAuditLogScopeResolverDeps) => {
+ return async ({
+ projectId,
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId
+ }: {
+ projectId: string;
+ actor: ActorType;
+ actorId: string;
+ actorAuthMethod: ActorAuthMethod;
+ actorOrgId: string;
+ }): Promise<TPamAuditLogScope | null> => {
+ const project = await projectDAL.findById(projectId);
+ if (!project || project.type !== ProjectType.PAM) return null;
+
+ const ctx = { actor, actorId, actorAuthMethod, actorOrgId };
+ const { hasRole } = await verifyProductMembership(permissionService, projectId, ctx);
+
+ const { folderIds, accountIds } = await getResourceIdsWithActions(
+ membershipDAL,
+ membershipRoleDAL,
+ projectId,
+ { anyOf: [ResourcePermissionPamResourceActions.ViewAuditLogs] },
+ ctx
+ );
+
+ // A ViewAuditLogs grant on a folder also covers logs for the accounts within it
+ let resolvedAccountIds = accountIds;
+ if (folderIds.length) {
+ const accountsInFolders = await pamAccountDAL.find({ $in: { folderId: folderIds } });
+ resolvedAccountIds = [...new Set([...accountIds, ...accountsInFolders.map((account) => account.id)])];
+ }
+
+ return {
+ accountIds: resolvedAccountIds,
+ folderIds,
+ includeProductLevel: hasRole(PamProductRole.Admin)
+ };
+ };
+};
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index 3b004a32f4..4a0835e8c0 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -100,6 +100,7 @@ import { licenseDALFactory } from "@app/ee/services/license/license-dal";
import { licenseServiceFactory } from "@app/ee/services/license/license-service";
import { oidcConfigDALFactory } from "@app/ee/services/oidc/oidc-config-dal";
import { oidcConfigServiceFactory } from "@app/ee/services/oidc/oidc-config-service";
+import { pamAuditLogScopeResolverFactory } from "@app/ee/services/pam/pam-audit-log-fns";
import { pamAccountDALFactory } from "@app/ee/services/pam-account/pam-account-dal";
import { pamAccountServiceFactory } from "@app/ee/services/pam-account/pam-account-service";
import { pamAccountTemplateDALFactory } from "@app/ee/services/pam-account-template/pam-account-template-dal";
@@ -965,6 +966,7 @@ export const registerRoutes = async (
? clickhouseAuditLogDALFactory(clickhouse, db, envConfig.CLICKHOUSE_AUDIT_LOG_TABLE_NAME)
: undefined;
+ const pamAccountDAL = pamAccountDALFactory(db);
const auditLogService = auditLogServiceFactory({
auditLogDAL,
clickhouseAuditLogDAL,
@@ -973,7 +975,14 @@ export const registerRoutes = async (
keyStore,
smtpService,
userDAL,
- notificationService
+ notificationService,
+ resolvePamAuditScope: pamAuditLogScopeResolverFactory({
+ projectDAL,
+ permissionService,
+ membershipDAL,
+ membershipRoleDAL,
+ pamAccountDAL
+ })
});
const secretApprovalPolicyService = secretApprovalPolicyServiceFactory({
projectEnvDAL,
@@ -1601,7 +1610,6 @@ export const registerRoutes = async (
const pamAccountTemplateDAL = pamAccountTemplateDALFactory(db);
const pamFolderDAL = pamFolderDALFactory(db);
- const pamAccountDAL = pamAccountDALFactory(db);
const pamFolderService = pamFolderServiceFactory({
pamFolderDAL,
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
index 79ad090b68..71c89740c8 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
@@ -22,7 +22,7 @@ import { Timezone } from "@app/helpers/datetime";
import { isInfisicalCloud } from "@app/helpers/platform";
import { withPermission, withProjectPermission } from "@app/hoc";
import { useGetAuditLogPostgresStorageStatus } from "@app/hooks/api/auditLogs";
-import { Project } from "@app/hooks/api/projects/types";
+import { Project, ProjectType } from "@app/hooks/api/projects/types";
import { usePopUp } from "@app/hooks/usePopUp";
import {
@@ -299,6 +299,12 @@ export const LogsSection = (props: Props) => {
const { project } = props;
if (project) {
+ // PAM uses its own product/resource permission model and scopes audit logs server-side, so the
+ // generic project audit-log permission gate doesn't apply here
+ if (project.type === ProjectType.PAM) {
+ return <LogsSectionComponent {...props} />;
+ }
+
const ProjectLogsSectionWithPermission = withProjectPermission(LogsSectionComponent, {
action: ProjectPermissionAuditLogsActions.Read,
subject: ProjectPermissionSub.AuditLogs
diff --git a/frontend/src/pages/pam/components/PamDetailSheet.tsx b/frontend/src/pages/pam/components/PamDetailSheet.tsx
index e41c73e3ec..daa638e5c8 100644
--- a/frontend/src/pages/pam/components/PamDetailSheet.tsx
+++ b/frontend/src/pages/pam/components/PamDetailSheet.tsx
@@ -170,7 +170,9 @@ export const PamDetailSheet = ({
{metadata.map((field) => (
<div key={field.label}>
<p className="text-xs font-medium text-muted">{field.label}</p>
- <div className="mt-1 text-sm text-foreground">{field.value}</div>
+ <div className="mt-1 text-sm break-words whitespace-pre-wrap text-foreground">
+ {field.value}
+ </div>
</div>
))}
</div>