Skip to content

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

fix(agent-vault): coalesce the nullable membership status on the available query

Scott Wilson36374688430c
diff --git a/backend/src/ee/services/agent-vault-member/agent-vault-member-dal.ts b/backend/src/ee/services/agent-vault-member/agent-vault-member-dal.ts
index d116653d61..cb26d4de0b 100644
--- a/backend/src/ee/services/agent-vault-member/agent-vault-member-dal.ts
+++ b/backend/src/ee/services/agent-vault-member/agent-vault-member-dal.ts
@@ -296,7 +296,12 @@ export const agentVaultMemberDALFactory = (db: TDbClient) => {
db.ref("projectId").withSchema(TableName.Identity).as("machineIdentityProjectId"),
db.ref("orgId").withSchema(TableName.Identity).as("machineIdentityOrgId"),
db.ref("name").withSchema(TableName.Groups).as("groupName"),
- db.raw(`(??."status" = ?) as "isOrgMembershipPending"`, [TableName.Membership, OrgMembershipStatus.Invited])
+ // status is nullable and the response schema takes a boolean. The member query reads this through
+ // EXISTS, which cannot be null; this one compares the column, so it has to coalesce.
+ db.raw(`COALESCE(??."status" = ?, false) as "isOrgMembershipPending"`, [
+ TableName.Membership,
+ OrgMembershipStatus.Invited
+ ])
)
.orderByRaw(`COALESCE(??, ??, ??, '') ASC`, [
`${TableName.Users}.username`,