mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 06:26:16 +00:00
misc: addressed comments
This commit is contained in:
@@ -35,7 +35,7 @@ export const registerPamSessionRouter = async (server: FastifyZodProvider) => {
|
||||
}),
|
||||
response: {
|
||||
200: z.object({
|
||||
credentials: z.any() // UNION DOES NOT WORK WITH ZOD SCHEMA
|
||||
credentials: SessionCredentialsSchema
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -24,11 +24,10 @@ import { TGatewayV2ServiceFactory } from "../gateway-v2/gateway-v2-service";
|
||||
import { TLicenseServiceFactory } from "../license/license-service";
|
||||
import { TPamFolderDALFactory } from "../pam-folder/pam-folder-dal";
|
||||
import { getFullPamFolderPath } from "../pam-folder/pam-folder-fns";
|
||||
import { TMySQLResourceConnectionDetails } from "../pam-resource/mysql/mysql-resource-types";
|
||||
import { TPamResourceDALFactory } from "../pam-resource/pam-resource-dal";
|
||||
import { PamResource } from "../pam-resource/pam-resource-enums";
|
||||
import { TPamAccountCredentials } from "../pam-resource/pam-resource-types";
|
||||
import { TPostgresResourceConnectionDetails } from "../pam-resource/postgres/postgres-resource-types";
|
||||
import { TSqlResourceConnectionDetails } from "../pam-resource/shared/sql/sql-resource-types";
|
||||
import { TPamSessionDALFactory } from "../pam-session/pam-session-dal";
|
||||
import { PamSessionStatus } from "../pam-session/pam-session-enums";
|
||||
import { OrgPermissionGatewayActions, OrgPermissionSubjects } from "../permission/org-permission";
|
||||
@@ -492,7 +491,7 @@ export const pamAccountServiceFactory = ({
|
||||
encryptedConnectionDetails: resource.encryptedConnectionDetails,
|
||||
kmsService,
|
||||
projectId: account.projectId
|
||||
})) as TMySQLResourceConnectionDetails | TPostgresResourceConnectionDetails;
|
||||
})) as TSqlResourceConnectionDetails;
|
||||
|
||||
const credentials = await decryptAccountCredentials({
|
||||
encryptedCredentials: account.encryptedCredentials,
|
||||
@@ -517,9 +516,7 @@ export const pamAccountServiceFactory = ({
|
||||
});
|
||||
|
||||
metadata = {
|
||||
username: credentials.username,
|
||||
accountName: account.name,
|
||||
accountPath
|
||||
username: credentials.username
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -20,25 +20,25 @@ export const SSHResourceListItemSchema = z.object({
|
||||
});
|
||||
|
||||
export const SSHResourceConnectionDetailsSchema = z.object({
|
||||
host: z.string().trim(),
|
||||
host: z.string().trim().max(255),
|
||||
port: z.number()
|
||||
});
|
||||
|
||||
export const SSHPasswordCredentialsSchema = z.object({
|
||||
authMethod: z.literal(SSHAuthMethod.Password),
|
||||
username: z.string().trim(),
|
||||
password: z.string().trim()
|
||||
username: z.string().trim().max(255),
|
||||
password: z.string().trim().max(255)
|
||||
});
|
||||
|
||||
export const SSHPublicKeyCredentialsSchema = z.object({
|
||||
authMethod: z.literal(SSHAuthMethod.PublicKey),
|
||||
username: z.string().trim(),
|
||||
privateKey: z.string().trim()
|
||||
username: z.string().trim().max(255),
|
||||
privateKey: z.string().trim().max(5000)
|
||||
});
|
||||
|
||||
export const SSHCertificateCredentialsSchema = z.object({
|
||||
authMethod: z.literal(SSHAuthMethod.Certificate),
|
||||
username: z.string().trim()
|
||||
username: z.string().trim().max(255)
|
||||
});
|
||||
|
||||
export const SSHAccountCredentialsSchema = z.discriminatedUnion("authMethod", [
|
||||
|
||||
@@ -2,7 +2,7 @@ import { TPamSessions } from "@app/db/schemas";
|
||||
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
|
||||
import { KmsDataKey } from "@app/services/kms/kms-types";
|
||||
|
||||
import { TPamSanitizedSession, TPamSessionCommandLog, TTerminalEvent } from "./pam-session.types";
|
||||
import { TPamSanitizedSession, TPamSessionCommandLog, TTerminalEvent } from "./pam-session-types";
|
||||
|
||||
export const decryptSessionCommandLogs = async ({
|
||||
projectId,
|
||||
|
||||
@@ -12,10 +12,10 @@ import { TProjectDALFactory } from "@app/services/project/project-dal";
|
||||
import { TLicenseServiceFactory } from "../license/license-service";
|
||||
import { OrgPermissionGatewayActions, OrgPermissionSubjects } from "../permission/org-permission";
|
||||
import { ProjectPermissionPamSessionActions, ProjectPermissionSub } from "../permission/project-permission";
|
||||
import { TUpdateSessionLogsDTO } from "./pam-session.types";
|
||||
import { TPamSessionDALFactory } from "./pam-session-dal";
|
||||
import { PamSessionStatus } from "./pam-session-enums";
|
||||
import { decryptSession } from "./pam-session-fns";
|
||||
import { TUpdateSessionLogsDTO } from "./pam-session-types";
|
||||
|
||||
type TPamSessionServiceFactoryDep = {
|
||||
pamSessionDAL: TPamSessionDALFactory;
|
||||
|
||||
Reference in New Issue
Block a user