Skip to content

Commit 39aa338

Browse files
committed
pam: allow account credentials to be fetched more than once
1 parent 4bff4ca commit 39aa338

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

backend/src/ee/services/pam-account/pam-account-service.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -668,11 +668,6 @@ export const pamAccountServiceFactory = ({
668668
throw new BadRequestError({ message: "Session has ended or expired" });
669669
}
670670

671-
// Verify that the session has not already had credentials fetched
672-
if (session.status !== PamSessionStatus.Starting) {
673-
throw new BadRequestError({ message: "Session has already been started" });
674-
}
675-
676671
const account = await pamAccountDAL.findById(session.accountId);
677672
if (!account) throw new NotFoundError({ message: `Account with ID '${session.accountId}' not found` });
678673

@@ -690,10 +685,12 @@ export const pamAccountServiceFactory = ({
690685
const decryptedResource = await decryptResource(resource, session.projectId, kmsService);
691686

692687
// Mark session as started
693-
await pamSessionDAL.updateById(sessionId, {
694-
status: PamSessionStatus.Active,
695-
startedAt: new Date()
696-
});
688+
if (session.status === PamSessionStatus.Starting) {
689+
await pamSessionDAL.updateById(sessionId, {
690+
status: PamSessionStatus.Active,
691+
startedAt: new Date()
692+
});
693+
}
697694

698695
return {
699696
credentials: {

0 commit comments

Comments
 (0)