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
improve errors
x03220550ab1bcae4c2
diff --git a/backend/src/services/secret-sharing/secret-sharing-service.ts b/backend/src/services/secret-sharing/secret-sharing-service.tsindex dc9bdad6aa..66705be0e8 100644--- a/backend/src/services/secret-sharing/secret-sharing-service.ts+++ b/backend/src/services/secret-sharing/secret-sharing-service.ts@@ -540,7 +540,11 @@ export const secretSharingServiceFactory = ({if (!user || !user.email) throw new UnauthorizedError();if (!(sharedSecret.authorizedEmails as string[]).includes(user.email))- throw new UnauthorizedError({ message: "Email not authorized to view secret" });+ return {+ isPasswordProtected: false,+ secretOrgId: sharedSecret.orgId,+ error: "Email not authorized to view secret"+ };}// all secrets pass through here, meaning we check if its expired first and then check if it needs verification@@ -551,7 +555,7 @@ export const secretSharingServiceFactory = ({return {isPasswordProtected: false,secretOrgId: sharedSecret.orgId,- error: "Access denied: Secret has expired by lifetime"+ error: "Secret lifetime has expired"};}@@ -561,7 +565,7 @@ export const secretSharingServiceFactory = ({return {isPasswordProtected: false,secretOrgId: sharedSecret.orgId,- error: "Access denied: Secret has expired by view count"+ error: "Secret has expired by view count"};}diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsxindex 5938020822..3fc635d265 100644--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx@@ -310,7 +310,7 @@ export const ViewSharedSecretByIDPage = () => {/>)}{(fetchSecret?.error || (error && !isInvalidCredential && !isUnauthorized)) && (- <SecretErrorContainer brandingTheme={brandingTheme} />+ <SecretErrorContainer brandingTheme={brandingTheme} error={fetchSecret?.error} />)}</>)}diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsxindex 5868f3b376..d33a9fe3d1 100644--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsx+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsx@@ -1,14 +1,14 @@-import { faKey } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { TriangleAlertIcon } from "lucide-react";import { twMerge } from "tailwind-merge";import { BrandingTheme } from "../ViewSharedSecretByIDPage";type Props = {brandingTheme?: BrandingTheme;+ error?: string;};-export const SecretErrorContainer = ({ brandingTheme }: Props) => {+export const SecretErrorContainer = ({ error, brandingTheme }: Props) => {const panelStyle = brandingTheme? {backgroundColor: brandingTheme.panelBg,@@ -20,14 +20,14 @@ export const SecretErrorContainer = ({ brandingTheme }: Props) => {return (<divclassName={twMerge(- "rounded-lg border p-8",+ "rounded-lg border p-6",!brandingTheme && "border-mineshaft-600 bg-mineshaft-800")}style={panelStyle}>- <div className="text-center">- <FontAwesomeIcon icon={faKey} size="2x" />- <p className="mt-4">The secret you are looking for is missing or has expired</p>+ <div className="flex items-center gap-4">+ <TriangleAlertIcon style={{ color: brandingTheme?.textMutedColor || "orangered" }} />+ <span>{error || "The secret you are looking for is missing or has expired"}</span></div></div>);