Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
reviews
x032205fa73506d460d
diff --git a/backend/src/ee/services/pam-account-template/pam-account-template-service.ts b/backend/src/ee/services/pam-account-template/pam-account-template-service.tsindex 8989e638e4..432cf91a6e 100644--- a/backend/src/ee/services/pam-account-template/pam-account-template-service.ts+++ b/backend/src/ee/services/pam-account-template/pam-account-template-service.ts@@ -31,10 +31,11 @@ export const pamAccountTemplateServiceFactory = (deps: TPamAccountTemplateServicconst verifyMembership = (projectId: string, ctx: TActorContext) =>verifyProductMembership(permissionService, projectId, ctx);- const validateTemplatePolicies = (accountType: string, policies: unknown) => {- if (!policies || typeof policies !== "object") return;+ const validateTemplatePolicies = (accountType: string, policies: unknown): Record<string, unknown> | undefined => {+ if (!policies || typeof policies !== "object") return undefined;const result = validatePolicyValues(accountType as PamAccountType, policies as Record<string, unknown>);if (!result.ok) throw new BadRequestError({ message: result.message });+ return result.data;};const verifyProductAdmin = async (projectId: string, ctx: TActorContext) => {@@ -77,7 +78,7 @@ export const pamAccountTemplateServiceFactory = (deps: TPamAccountTemplateServicawait verifyProductAdmin(projectId, ctx);await validateGatewayAttachment(deps, gatewayId, gatewayPoolId, ctx);await validateRecordingConnection(deps, recordingConnectionId, ctx);- validateTemplatePolicies(type, policies);+ const validatedPolicies = validateTemplatePolicies(type, policies);try {return await pamAccountTemplateDAL.create({@@ -85,7 +86,7 @@ export const pamAccountTemplateServiceFactory = (deps: TPamAccountTemplateServicname,description,type,- policies: policies ?? undefined,+ policies: validatedPolicies,settings: settings ?? undefined,gatewayId,gatewayPoolId,@@ -123,12 +124,12 @@ export const pamAccountTemplateServiceFactory = (deps: TPamAccountTemplateServicthrow new NotFoundError({ message: `Account template with ID '${templateId}' not found` });}- validateTemplatePolicies(existing.type, policies);+ const validatedPolicies = validateTemplatePolicies(existing.type, policies);const updateData: Record<string, unknown> = {};if (name !== undefined) updateData.name = name;if (description !== undefined) updateData.description = description;- if (policies !== undefined) updateData.policies = policies;+ if (policies !== undefined) updateData.policies = validatedPolicies;if (settings !== undefined) updateData.settings = settings;if (gatewayId !== undefined) updateData.gatewayId = gatewayId;if (gatewayPoolId !== undefined) updateData.gatewayPoolId = gatewayPoolId;diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.tsindex fb251a9a42..b840be9038 100644--- a/frontend/src/hooks/api/pam/types/index.ts+++ b/frontend/src/hooks/api/pam/types/index.ts@@ -3,6 +3,7 @@ import {PamAccountOrderBy,PamAccountType,PamAccountView,+ PamPolicyType,PamResourcePermissionActions,PamResourcePermissionSub,PamSessionStatus,@@ -35,7 +36,7 @@ export type TPamFieldDescriptor = {};export type TPamPolicyDescriptor = {- key: string;+ key: PamPolicyType;label: string;description: string;};diff --git a/frontend/src/pages/pam/components/policyEditors/DurationPolicyEditor.tsx b/frontend/src/pages/pam/components/policyEditors/DurationPolicyEditor.tsxindex a0d093f61c..502d780194 100644--- a/frontend/src/pages/pam/components/policyEditors/DurationPolicyEditor.tsx+++ b/frontend/src/pages/pam/components/policyEditors/DurationPolicyEditor.tsx@@ -16,8 +16,8 @@ export const DurationPolicyEditor = ({placeholder="e.g. 3600 (leave empty for no limit)"value={typeof value === "number" ? value : ""}onChange={(e) => {- const v = e.target.value;- onChange(v === "" ? null : Number(v));+ const parsed = Number(e.target.value);+ onChange(e.target.value === "" || Number.isNaN(parsed) ? null : parsed);}}/><FieldDescription>{description}</FieldDescription>diff --git a/frontend/src/pages/pam/components/policyEditors/index.tsx b/frontend/src/pages/pam/components/policyEditors/index.tsxindex d4ff5efa98..041f4a1f66 100644--- a/frontend/src/pages/pam/components/policyEditors/index.tsx+++ b/frontend/src/pages/pam/components/policyEditors/index.tsx@@ -6,7 +6,7 @@ import { BooleanPolicyEditor } from "./BooleanPolicyEditor";import { DurationPolicyEditor } from "./DurationPolicyEditor";import { PolicyEditorProps } from "./types";-export const POLICY_EDITORS: Partial<Record<string, ComponentType<PolicyEditorProps>>> = {+export const POLICY_EDITORS: Partial<Record<PamPolicyType, ComponentType<PolicyEditorProps>>> = {[PamPolicyType.RequireMfa]: BooleanPolicyEditor,[PamPolicyType.RequireReason]: BooleanPolicyEditor,[PamPolicyType.MaxSessionDuration]: DurationPolicyEditor