diff --git a/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts b/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts index d36702cb7..802d43093 100644 --- a/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts +++ b/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts @@ -137,6 +137,7 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => { GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.Postgres) }), GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.MySQL) }), GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.SSH) }), + GatewayAccessResponseSchema.extend({ resourceType: z.literal(PamResource.Kubernetes) }), // AWS IAM (no gateway, returns console URL) z.object({ sessionId: z.string(), diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.ts index f901aee07..ec8b37c36 100644 --- a/backend/src/ee/services/pam-account/pam-account-service.ts +++ b/backend/src/ee/services/pam-account/pam-account-service.ts @@ -705,6 +705,7 @@ export const pamAccountServiceFactory = ({ port: portNumber }; })(); + const gatewayConnectionDetails = await gatewayV2Service.getPAMConnectionDetails({ gatewayId, duration, @@ -742,7 +743,7 @@ export const pamAccountServiceFactory = ({ })) as TSqlAccountCredentials; metadata = { - username: (credentials as TSqlAccountCredentials).username, + username: credentials.username, database: connectionCredentials.database, accountName: account.name, accountPath: folderPath @@ -758,7 +759,7 @@ export const pamAccountServiceFactory = ({ })) as TSSHAccountCredentials; metadata = { - username: (credentials as TSSHAccountCredentials).username + username: credentials.username }; } break; diff --git a/backend/src/ee/services/pam-resource/kubernetes/kubernetes-resource-factory.ts b/backend/src/ee/services/pam-resource/kubernetes/kubernetes-resource-factory.ts index 60e19af05..dddeb37ba 100644 --- a/backend/src/ee/services/pam-resource/kubernetes/kubernetes-resource-factory.ts +++ b/backend/src/ee/services/pam-resource/kubernetes/kubernetes-resource-factory.ts @@ -75,6 +75,9 @@ export const kubernetesResourceFactory: TPamResourceFactory< TKubernetesAccountCredentials > = (resourceType, connectionDetails, gatewayId, gatewayV2Service) => { const validateConnection = async () => { + if (!gatewayId) { + throw new BadRequestError({ message: "Gateway ID is required" }); + } try { await executeWithGateway( { connectionDetails, gatewayId, resourceType }, @@ -119,6 +122,9 @@ export const kubernetesResourceFactory: TPamResourceFactory< const validateAccountCredentials: TPamResourceFactoryValidateAccountCredentials< TKubernetesAccountCredentials > = async (credentials) => { + if (!gatewayId) { + throw new BadRequestError({ message: "Gateway ID is required" }); + } try { await executeWithGateway( { connectionDetails, gatewayId, resourceType },