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
unique name
Matheus Nogueira27bbded8e668
diff --git a/backend/src/db/migrations/20260427174746_honey-tokens.ts b/backend/src/db/migrations/20260427174746_honey-tokens.tsindex 6cbd62b96f..24ec714df4 100644--- a/backend/src/db/migrations/20260427174746_honey-tokens.ts+++ b/backend/src/db/migrations/20260427174746_honey-tokens.ts@@ -44,6 +44,9 @@ export async function up(knex: Knex): Promise<void> {});await createOnUpdateTrigger(knex, TableName.HoneyToken);+ await knex.schema.alterTable(TableName.HoneyToken, (t) => {+ t.unique(["name", "folderId"]);+ });}if (!(await knex.schema.hasTable(TableName.HoneyTokenEvent))) {diff --git a/backend/src/ee/services/honey-token/honey-token-service.ts b/backend/src/ee/services/honey-token/honey-token-service.tsindex 400353f013..0c3f519665 100644--- a/backend/src/ee/services/honey-token/honey-token-service.ts+++ b/backend/src/ee/services/honey-token/honey-token-service.ts@@ -146,6 +146,14 @@ export const honeyTokenServiceFactory = ({});}+ const existingHoneyToken = await honeyTokenDAL.findOne({ name, folderId: folder.id });++ if (existingHoneyToken) {+ throw new BadRequestError({+ message: `A honey token with the name "${name}" already exists at the path "${secretPath}" in environment "${environment}"`+ });+ }+const secretKeys = Object.values(secretsMapping);if (new Set(secretKeys).size !== secretKeys.length) {@@ -317,6 +325,16 @@ export const honeyTokenServiceFactory = ({throw new NotFoundError({ message: `Honey token with ID "${honeyTokenId}" not found` });}+ if (name && name !== honeyToken.name) {+ const existingHoneyToken = await honeyTokenDAL.findOne({ name, folderId: honeyToken.folderId });++ if (existingHoneyToken) {+ throw new BadRequestError({+ message: `A honey token with the name "${name}" already exists in this path`+ });+ }+ }+const oldMapping = honeyToken.secretsMapping as Record<string, string>;if (secretsMapping) {