mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-19 11:42:52 +00:00
addressed reviews
This commit is contained in:
@@ -5,17 +5,17 @@ import { KmsDataKey } from "@app/services/kms/kms-types";
|
||||
import { TPamSanitizedSession, TPamSessionCommandLog } from "./pam-session.types";
|
||||
|
||||
export const decryptSessionCommandLogs = async ({
|
||||
orgId,
|
||||
projectId,
|
||||
encryptedLogs,
|
||||
kmsService
|
||||
}: {
|
||||
orgId: string;
|
||||
projectId: string;
|
||||
encryptedLogs: Buffer;
|
||||
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
|
||||
}) => {
|
||||
const { decryptor } = await kmsService.createCipherPairWithDataKey({
|
||||
type: KmsDataKey.Organization,
|
||||
orgId
|
||||
type: KmsDataKey.SecretManager,
|
||||
projectId
|
||||
});
|
||||
|
||||
const decryptedPlainTextBlob = decryptor({
|
||||
@@ -27,14 +27,14 @@ export const decryptSessionCommandLogs = async ({
|
||||
|
||||
export const decryptSession = async (
|
||||
session: TPamSessions,
|
||||
orgId: string,
|
||||
projectId: string,
|
||||
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">
|
||||
) => {
|
||||
return {
|
||||
...session,
|
||||
commandLogs: session.encryptedLogsBlob
|
||||
? await decryptSessionCommandLogs({
|
||||
orgId,
|
||||
projectId,
|
||||
encryptedLogs: session.encryptedLogsBlob,
|
||||
kmsService
|
||||
})
|
||||
|
||||
@@ -53,7 +53,7 @@ export const pamSessionServiceFactory = ({
|
||||
);
|
||||
|
||||
return {
|
||||
session: await decryptSession(session, actor.orgId, kmsService)
|
||||
session: await decryptSession(session, session.projectId, kmsService)
|
||||
};
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ export const pamSessionServiceFactory = ({
|
||||
const sessions = await pamSessionDAL.find({ projectId });
|
||||
|
||||
return {
|
||||
sessions: await Promise.all(sessions.map((session) => decryptSession(session, actor.orgId, kmsService)))
|
||||
sessions: await Promise.all(sessions.map((session) => decryptSession(session, projectId, kmsService)))
|
||||
};
|
||||
};
|
||||
|
||||
@@ -112,8 +112,8 @@ export const pamSessionServiceFactory = ({
|
||||
);
|
||||
|
||||
const { encryptor } = await kmsService.createCipherPairWithDataKey({
|
||||
type: KmsDataKey.Organization,
|
||||
orgId: project.orgId
|
||||
type: KmsDataKey.SecretManager,
|
||||
projectId: session.projectId
|
||||
});
|
||||
|
||||
const { cipherTextBlob } = encryptor({
|
||||
|
||||
Reference in New Issue
Block a user