Skip to content

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

apply changes requested on review

adilson65071c1cf4db
diff --git a/backend/src/services/secret-sharing/secret-sharing-service.ts b/backend/src/services/secret-sharing/secret-sharing-service.ts
index 541e58dae3..d53bdb330b 100644
--- a/backend/src/services/secret-sharing/secret-sharing-service.ts
+++ b/backend/src/services/secret-sharing/secret-sharing-service.ts
@@ -170,7 +170,6 @@ export const secretSharingServiceFactory = ({
if (isOrgMember) {
orgMemberEmails.push(email);
} else if (
- !allowExternalEmails ||
!rootOrg.allowSecretSharingOutsideOrganization ||
accessType === SecretSharingAccessType.Organization
) {
@@ -185,7 +184,7 @@ export const secretSharingServiceFactory = ({
// const hasExternalEmails = emails && emails.length > orgMemberEmails.length;
if (allowExternalEmails && !password) {
throw new BadRequestError({
- message: "A password is required when sharing secrets with users outside your organization"
+ message: "A password is required when sharing secrets with users outside of Infisical"
});
}
@@ -669,9 +668,9 @@ export const secretSharingServiceFactory = ({
if (!isAuthorizedUser && !sharedSecret.allowExternalEmails) {
if (!actorId) {
- throw new UnauthorizedError();
+ throw new UnauthorizedError({ message: "Authentication required to view this secret" });
}
- throw new ForbiddenRequestError();
+ throw new ForbiddenRequestError({ message: "You are not authorized to view this secret" });
}
// all secrets pass through here, meaning we check if its expired first and then check if it needs verification
diff --git a/docs/documentation/platform/secret-sharing.mdx b/docs/documentation/platform/secret-sharing.mdx
index 76e842d706..346876b90a 100644
--- a/docs/documentation/platform/secret-sharing.mdx
+++ b/docs/documentation/platform/secret-sharing.mdx
@@ -25,7 +25,7 @@ Infisical offers a secure solution for sharing secrets over the internet in a ti
- **Max Views:** How many times the secret can be viewed before it's destroyed.
- **Emails (optional):** Email addresses to share the secret with. Each recipient will receive the shared secret link in their inbox after creation. When the "Allow external recipients" toggle is off, only organization member emails are accepted and recipients must have an Infisical account to verify their identity.
- - **Allow external recipients (optional):** When enabled, any email address can be added as a recipient — not just organization members. A password becomes mandatory in this case. All recipients (including external ones) will receive the secret link via email and must use the password to access the secret. This toggle is automatically disabled when "Limit access to people within organization" is enabled.
+ - **Allow external recipients (optional):** When enabled, any email address can be added as a recipient — Even users that don't have an infisical account. A password becomes mandatory in this case. All recipients (including external ones) will receive the secret link via email and must use the password to access the secret. This toggle is automatically disabled when "Limit access to people within organization" is enabled.
</Step>
<Step title="Copy Link and Share Secret">
After creating the shared secret, its link will be displayed. Share this with the intended recipients.
diff --git a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
index 0582b6558e..6363f1f619 100644
--- a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
@@ -418,7 +418,7 @@ export const ShareSecretForm = ({
</p>
<p className="mt-2">
{isAllowingExternalEmails
- ? "External recipients (not in your organization) will need the password to view the secret. Authorized recipients will also need a password if the secret is password-protected."
+ ? "External recipients (user without an Infisical account) will need the password to view the secret. Authorized recipients will also need a password if the secret is password-protected."
: "Recipients must have an Infisical account to verify their identity."}
</p>
</>
@@ -442,11 +442,21 @@ export const ShareSecretForm = ({
field: { onChange, value: isChecked, ...field },
fieldState: { error }
}) => (
- <FormControl errorText={error?.message} isError={Boolean(error)}>
+ <FormControl
+ helperText={
+ !allowSecretSharingOutsideOrganization ? (
+ <span className="text-red-500">
+ External sharing is disabled by your organization
+ </span>
+ ) : undefined
+ }
+ errorText={error?.message}
+ isError={Boolean(error)}
+ >
<Switch
className={`mr-2 ml-0 bg-mineshaft-400/50 shadow-inner data-[state=checked]:bg-primary ${isOrgAccess ? "opacity-50" : ""}`}
thumbClassName="bg-mineshaft-800"
- containerClassName="flex-row-reverse w-fit"
+ containerClassName={`flex-row-reverse w-fit ${isOrgAccess ? "pointer-events-none opacity-50" : ""}`}
isChecked={isOrgAccess ? false : (isChecked ?? false)}
onCheckedChange={onChange}
isDisabled={isOrgAccess}