Skip to content

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

fix(pam): restrict recording connections to org-scoped only

bernie-gb09b31faea6c
diff --git a/backend/src/ee/services/pam/pam-validators.ts b/backend/src/ee/services/pam/pam-validators.ts
index 426a8fc7b7..4d322d741c 100644
--- a/backend/src/ee/services/pam/pam-validators.ts
+++ b/backend/src/ee/services/pam/pam-validators.ts
@@ -86,6 +86,13 @@ const enforceAppConnectionConnect = async (
if (conn.orgId !== ctx.actorOrgId) {
throw new NotFoundError({ message: "Recording connection not found" });
}
+
+ // PAM recording connections are org-scoped. Org-level Connect does not authorize a project-scoped
+ // connection (that requires project-level Connect on its own project), so reject them outright.
+ if (conn.projectId) {
+ throw new BadRequestError({ message: "Recording connection must be an organization-level connection" });
+ }
+
const { permission: orgPermission } = await permissionService.getOrgPermission({
actorId: ctx.actorId,
actor: ctx.actor,
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/RecordingConnectionPicker.tsx b/frontend/src/pages/pam/PamAccountsPage/components/RecordingConnectionPicker.tsx
index a2d15236e5..75a3364ac4 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/RecordingConnectionPicker.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/RecordingConnectionPicker.tsx
@@ -13,7 +13,9 @@ type Props = {
export const RecordingConnectionPicker = ({ value, onChange, isError, includeNone }: Props) => {
const { data: connections = [], isPending } = useListAppConnections();
- const awsConnections = connections.filter((connection) => connection.app === AppConnection.AWS);
+ const awsConnections = connections.filter(
+ (connection) => connection.app === AppConnection.AWS && !connection.projectId
+ );
return (
<Select