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
fix: remove Machine actor and fix input validation
Daniel Hougaard40022f937c0e
diff --git a/backend/src/ee/routes/v1/dynamic-secret-router.ts b/backend/src/ee/routes/v1/dynamic-secret-router.tsindex f0ce32270c..46007867f0 100644--- a/backend/src/ee/routes/v1/dynamic-secret-router.ts+++ b/backend/src/ee/routes/v1/dynamic-secret-router.ts@@ -26,7 +26,10 @@ const validateUsernameTemplateCharacters = characterValidator([CharacterType.Fullstop,CharacterType.SingleQuote,CharacterType.Spaces,- CharacterType.Pipe+ CharacterType.Pipe,+ CharacterType.OpenParen,+ CharacterType.CloseParen,+ CharacterType.DoubleQuote]);const userTemplateSchema = zdiff --git a/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-service.ts b/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-service.tsindex 0666eca2d7..d7a32b5010 100644--- a/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-service.ts+++ b/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-service.ts@@ -148,7 +148,7 @@ export const dynamicSecretLeaseServiceFactory = ({if (user) {identity.name = extractEmailUsername(user.username);}- } else if (actor === ActorType.Machine) {+ } else if (actor === ActorType.IDENTITY) {const machineIdentity = await identityDAL.findById(actorId);if (machineIdentity) {identity.name = machineIdentity.name;diff --git a/backend/src/ee/services/dynamic-secret/providers/templateUtils.ts b/backend/src/ee/services/dynamic-secret/providers/templateUtils.tsindex d866e32802..fbd891e842 100644--- a/backend/src/ee/services/dynamic-secret/providers/templateUtils.ts+++ b/backend/src/ee/services/dynamic-secret/providers/templateUtils.ts@@ -44,6 +44,17 @@ const hbsTruncate = (text: string, length: number) => {if (typeof length !== "number" || length <= 0) return textStr;return textStr.substring(0, length);};++const hbsUppercase = (text: string) => {+ const textStr = String(text || "");+ return textStr.toUpperCase();+};++const hbsLowercase = (text: string) => {+ const textStr = String(text || "");+ return textStr.toLowerCase();+};+const compileUsernameTemplate = ({usernameTemplate,randomUsername,@@ -71,6 +82,11 @@ const compileUsernameTemplate = ({// Register truncate helper on local instancehbs.registerHelper("truncate", hbsTruncate);+ // Register uppercase helper on local instance+ hbs.registerHelper("uppercase", hbsUppercase);+ // Register lowercase helper on local instance+ hbs.registerHelper("lowercase", hbsLowercase);+// Compile template with context using local instanceconst context = {randomUsername,diff --git a/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts b/backend/src/ee/services/secret-approval-request/secret-approval-request-service.tsindex 6b0f7e0ede..255da17fb0 100644--- a/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts+++ b/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts@@ -1470,7 +1470,7 @@ export const secretApprovalRequestServiceFactory = ({environment,trx: providedTx}: TGenerateSecretApprovalRequestV2BridgeDTO & { trx?: Knex }) => {- if (actor === ActorType.SERVICE || actor === ActorType.Machine)+ if (actor === ActorType.SERVICE || actor === ActorType.IDENTITY)throw new BadRequestError({ message: "Cannot use service token or machine token over protected branches" });const { permission } = await permissionService.getProjectPermission({diff --git a/backend/src/lib/template/validate-handlebars.ts b/backend/src/lib/template/validate-handlebars.tsindex 4aa0d1f63a..133027be3b 100644--- a/backend/src/lib/template/validate-handlebars.ts+++ b/backend/src/lib/template/validate-handlebars.ts@@ -9,7 +9,7 @@ type SanitizationArg = {const isValidExpression = (expression: string, dto: SanitizationArg): boolean => {// Allow helper functions (replace, truncate)- const allowedHelpers = ["replace", "truncate", "random"];+ const allowedHelpers = ["replace", "truncate", "random", "uppercase", "lowercase"];if (allowedHelpers.includes(expression)) {return true;}diff --git a/backend/src/services/auth/auth-type.ts b/backend/src/services/auth/auth-type.tsindex ffc39ec8b5..d955fead44 100644--- a/backend/src/services/auth/auth-type.ts+++ b/backend/src/services/auth/auth-type.ts@@ -40,7 +40,6 @@ export enum ActorType { // would extend to AWS, Azure, ...USER = "user", // userIdentitySERVICE = "service",IDENTITY = "identity",- Machine = "machine",SCIM_CLIENT = "scimClient",ACME_PROFILE = "acmeProfile",ACME_ACCOUNT = "acmeAccount",