Skip to content

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

fix lint

xd6233b021d33
diff --git a/backend/src/ee/services/pam-discovery/pam-discovered-account-dal.ts b/backend/src/ee/services/pam-discovery/pam-discovered-account-dal.ts
index 78d90c3b9e..ef4a9c67eb 100644
--- a/backend/src/ee/services/pam-discovery/pam-discovered-account-dal.ts
+++ b/backend/src/ee/services/pam-discovery/pam-discovered-account-dal.ts
@@ -85,7 +85,16 @@ export const pamDiscoveredAccountDALFactory = (db: TDbClient) => {
if (limit) void dataQuery.limit(limit);
if (offset) void dataQuery.offset(offset);
- const [countResult, accounts] = await Promise.all([countQuery, dataQuery]);
+ const [countResult, rows] = await Promise.all([countQuery, dataQuery]);
+ const accounts = rows as unknown as {
+ id: string;
+ accountType: string;
+ lastDiscoveredAt: Date | null;
+ importedAccountId: string;
+ accountName: string;
+ folderId: string | null;
+ folderName: string | null;
+ }[];
return { accounts, totalCount: Number(countResult?.count ?? 0) };
};
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 bda55b20c8..834f8dd2d9 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
@@ -664,12 +664,12 @@ export const pamDiscoverySourceServiceFactory = (deps: TPamDiscoverySourceServic
return {
accounts: accounts.map((a) => ({
id: a.id,
- accountId: a.importedAccountId as string,
- name: a.accountName as string,
- folderId: (a.folderId as string | null) ?? null,
- folderName: (a.folderName as string | null) ?? null,
+ accountId: a.importedAccountId,
+ name: a.accountName,
+ folderId: a.folderId ?? null,
+ folderName: a.folderName ?? null,
accountType: a.accountType as PamAccountType,
- lastDiscoveredAt: (a.lastDiscoveredAt as Date | null) ?? null
+ lastDiscoveredAt: a.lastDiscoveredAt ?? null
})),
totalCount
};
@@ -724,6 +724,9 @@ export const pamDiscoverySourceServiceFactory = (deps: TPamDiscoverySourceServic
if (!discovered || discovered.discoverySourceId !== sourceId) {
throw new NotFoundError({ message: "Discovered account not found" });
}
+ if (discovered.isStale) {
+ throw new BadRequestError({ message: "This account is no longer available in the environment" });
+ }
if (discovered.importedAccountId) {
// Already imported. Re-run the idempotent backfill so a retry heals a prior import whose backfill
// didn't complete (the three writes aren't one transaction), rather than stranding still-staged deps.