Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

remove email enumeration and change tost message

adilson5e48bd6a59c6
diff --git a/backend/src/services/secret-sharing/secret-sharing-service.ts b/backend/src/services/secret-sharing/secret-sharing-service.ts
index cf7533a8c5..38ac0b89bf 100644
--- a/backend/src/services/secret-sharing/secret-sharing-service.ts
+++ b/backend/src/services/secret-sharing/secret-sharing-service.ts
@@ -159,20 +159,6 @@ export const secretSharingServiceFactory = ({
const encryptWithRoot = kmsService.encryptWithRootKey();
- // makes sure the user is not sharing secrets with users that are not registered on Infisical without knowing it
- if (emails && emails.length > 0 && accessType !== SecretSharingAccessType.Organization && !allowExternalEmails) {
- const platformUsers = await userDAL.getVerifiedEmailsByEmailList(emails);
- const platformEmailSet = new Set(platformUsers.map((u) => u.email!.toLowerCase()));
- const hasUnregisteredEmail = emails.some((e) => !platformEmailSet.has(e.toLowerCase()));
-
- if (hasUnregisteredEmail) {
- throw new BadRequestError({
- message:
- "One or more recipient emails are not registered on Infisical. Set allowExternalEmails to share secrets with users outside Infisical."
- });
- }
- }
-
const orgMemberEmails: string[] = [];
if (emails && emails.length > 0) {
diff --git a/backend/src/services/user/user-dal.ts b/backend/src/services/user/user-dal.ts
index 7375572752..88cd1a7347 100644
--- a/backend/src/services/user/user-dal.ts
+++ b/backend/src/services/user/user-dal.ts
@@ -31,18 +31,6 @@ export const userDALFactory = (db: TDbClient) => {
isEmailVerified: true
});
- const getVerifiedEmailsByEmailList = async (emails: string[], tx?: Knex) => {
- if (emails.length === 0) return [];
-
- return (tx || db.replicaNode())(TableName.Users)
- .whereRaw(
- `lower("email") IN (${emails.map(() => "?").join(",")})`,
- emails.map((e) => e.toLowerCase())
- )
- .where({ isEmailVerified: true })
- .select("email");
- };
-
const getUsersByFilter = async ({
limit,
offset,
@@ -276,7 +264,6 @@ export const userDALFactory = (db: TDbClient) => {
createUserAction,
getUsersByFilter,
findAllMyAccounts,
- findUserByEmail,
- getVerifiedEmailsByEmailList
+ findUserByEmail
};
};
diff --git a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
index cec4562fdd..3826f6fdf9 100644
--- a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
@@ -156,7 +156,7 @@ export const ShareSecretForm = ({
if (processedEmails && processedEmails.length > 0) {
setSecretLink("");
createNotification({
- text: `Shared secret link emailed to ${processedEmails.length} user(s).`,
+ text: "if the provided email is associated with an infisical account they will receive a link",
type: "success"
});
} else {