Skip to content

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

block iam accs

Andrey53a5b1b1c85a
diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts b/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts
index d8622a156b..9f5963befa 100644
--- a/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts
+++ b/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts
@@ -223,10 +223,17 @@ export const pamDiscoverySourceServiceFactory = (deps: TPamDiscoverySourceServic
}
// discovery transmits a password to every scanned host, so a password account may only be used by an actor
- // allowed to view its secret. PostgreSQL scans are always password-based, so every one of them qualifies.
+ // allowed to view its secret
if (account.accountType === PamAccountType.SSH || account.accountType === PamAccountType.Postgres) {
const { decryptor } = await getProjectCipher(projectId);
const { authMethod } = decryptToObject(account.encryptedCredentials, decryptor) as { authMethod?: string };
+
+ if (account.accountType === PamAccountType.Postgres && authMethod === PamPostgresAuthMethod.AwsIam) {
+ throw new BadRequestError({
+ message: `PostgreSQL account '${account.name}' uses AWS IAM authentication, which cannot scan. Its login token is minted for one host, port, and user, so it cannot be reused across the instances a source scans. Select an account that authenticates with a password.`
+ });
+ }
+
const sendsPassword =
account.accountType === PamAccountType.Postgres
? authMethod !== PamPostgresAuthMethod.AwsIam
diff --git a/docs/documentation/platform/pam/discovery/postgres.mdx b/docs/documentation/platform/pam/discovery/postgres.mdx
index d58725c8c1..a51b6cbb58 100644
--- a/docs/documentation/platform/pam/discovery/postgres.mdx
+++ b/docs/documentation/platform/pam/discovery/postgres.mdx
@@ -33,7 +33,7 @@ The scanning account needs no special grant or elevated privileges. Any role tha
</Note>
<Warning>
-Only password authentication can drive a scan. An AWS IAM account's token is minted for one host, port, and user, so it cannot be reused across the instances a source scans. IAM accounts are skipped as credential accounts.
+Only password authentication can drive a scan. An AWS IAM account's token is minted for one host, port, and user, so it cannot be reused across the instances a source scans. IAM accounts cannot be used as credential accounts.
</Warning>
## Creating a source