Skip to content

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

Add missing token auth to access token findOne fn

Tuan Dang5dff46ee3afb
diff --git a/backend/src/services/identity-access-token/identity-access-token-dal.ts b/backend/src/services/identity-access-token/identity-access-token-dal.ts
index cac17445df..c4f4ec3c85 100644
--- a/backend/src/services/identity-access-token/identity-access-token-dal.ts
+++ b/backend/src/services/identity-access-token/identity-access-token-dal.ts
@@ -57,6 +57,12 @@ export const identityAccessTokenDALFactory = (db: TDbClient) => {
`${TableName.IdentityOidcAuth}.identityId`
);
})
+ .leftJoin(TableName.IdentityOidcAuth, (qb) => {
+ qb.on(`${TableName.Identity}.authMethod`, db.raw("?", [IdentityAuthMethod.TOKEN_AUTH])).andOn(
+ `${TableName.Identity}.id`,
+ `${TableName.IdentityTokenAuth}.identityId`
+ );
+ })
.select(selectAllTableCols(TableName.IdentityAccessToken))
.select(
db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityUniversalAuth).as("accessTokenTrustedIpsUa"),
@@ -65,6 +71,7 @@ export const identityAccessTokenDALFactory = (db: TDbClient) => {
db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityAzureAuth).as("accessTokenTrustedIpsAzure"),
db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityKubernetesAuth).as("accessTokenTrustedIpsK8s"),
db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityOidcAuth).as("accessTokenTrustedIpsOidc"),
+ db.ref("accessTokenTrustedIps").withSchema(TableName.IdentityTokenAuth).as("accessTokenTrustedIpsToken"),
db.ref("name").withSchema(TableName.Identity)
)
.first();
@@ -79,7 +86,8 @@ export const identityAccessTokenDALFactory = (db: TDbClient) => {
doc.accessTokenTrustedIpsAws ||
doc.accessTokenTrustedIpsAzure ||
doc.accessTokenTrustedIpsK8s ||
- doc.accessTokenTrustedIpsOidc
+ doc.accessTokenTrustedIpsOidc ||
+ doc.accessTokenTrustedIpsToken
};
} catch (error) {
throw new DatabaseError({ error, name: "IdAccessTokenFindOne" });