Skip to content

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

move warning to sidebar

x271272052e0a
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx
index 405fdd879b..d6376a3436 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx
@@ -86,6 +86,7 @@ import { AssignAccessModal, EditMemberTarget } from "./AssignAccessModal";
import { EditAccountForm } from "./EditAccountForm";
import { RecordingConnectionPicker } from "./RecordingConnectionPicker";
import { RotationTab } from "./RotationTab";
+import { SshCaSetupCallout } from "./SshCaSetupCallout";
type Props = {
isOpen: boolean;
@@ -940,6 +941,13 @@ export const AccountDetailSheet = ({ isOpen, accountId, onOpenChange }: Props) =
) : undefined
}
metadata={metadata}
+ footer={
+ <SshCaSetupCallout
+ accountType={account?.accountType}
+ authMethod={account?.credentials?.authMethod as string | undefined}
+ accountId={accountId}
+ />
+ }
activeTab={tab}
onTabChange={setTab}
tabs={availableTabs.map((tabDef) => ({
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx
index ba3d681fc8..58b3c81416 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx
@@ -476,7 +476,10 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: Pr
<h3 className="mb-3 text-sm font-medium text-foreground">Credentials</h3>
<div className="flex flex-col gap-4">
<CredentialsForm control={control} />
- <SshCaSetupCallout control={control} />
+ <SshCaSetupCallout
+ accountType={watch("accountType")}
+ authMethod={watch("credentials")?.authMethod as string | undefined}
+ />
</div>
</div>
)}
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/EditAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/EditAccountForm.tsx
index eb912574fb..e875a90847 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/EditAccountForm.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/EditAccountForm.tsx
@@ -35,7 +35,6 @@ import {
} from "./accountFormSchema";
import { ConnectionDetailsForm } from "./ConnectionDetailsForm";
import { CredentialsForm } from "./CredentialsForm";
-import { SshCaSetupCallout } from "./SshCaSetupCallout";
function filterUnchangedCredentials(
credentials: Record<string, unknown>
@@ -301,9 +300,8 @@ export const EditAccountForm = ({ accountId, onDirtyChange }: Props) => {
<CardTitle className="text-base">Credentials</CardTitle>
<CardDescription>Authentication used to connect to this account.</CardDescription>
</CardHeader>
- <CardContent className="flex flex-col gap-4">
+ <CardContent>
<CredentialsForm control={control} />
- <SshCaSetupCallout control={control} accountId={accountId} />
</CardContent>
</Card>
)}
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/SshCaSetupCallout.tsx b/frontend/src/pages/pam/PamAccountsPage/components/SshCaSetupCallout.tsx
index 527186b06c..9cece88c78 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/SshCaSetupCallout.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/SshCaSetupCallout.tsx
@@ -1,4 +1,3 @@
-import { Control, useWatch } from "react-hook-form";
import { AlertTriangle, Copy } from "lucide-react";
import { createNotification } from "@app/components/notifications";
@@ -7,28 +6,20 @@ import { PamAccountType } from "@app/hooks/api/pam";
import { getAuthToken } from "@app/hooks/api/reactQuery";
import { PamDocsUrls } from "@app/pages/pam/pam-docs-urls";
-import { TAccountFormValues } from "./accountFormSchema";
-
const SSH_CERTIFICATE_AUTH_METHOD = "certificate";
const buildInstallCommand = (accountId: string) =>
`curl -sSf -H "Authorization: Bearer ${getAuthToken()}" "${window.location.origin}/api/v1/pam/accounts/${accountId}/ssh-ca-setup" | sudo bash`;
type Props = {
- control: Control<TAccountFormValues>;
- accountId?: string; // present only when editing an existing account
+ accountType?: string;
+ authMethod?: string;
+ // present only for an existing account; the CA is per-account and can't be provisioned until it exists
+ accountId?: string;
};
-export const SshCaSetupCallout = ({ control, accountId }: Props) => {
- const accountType = useWatch({ control, name: "accountType" });
- const credentials = useWatch({ control, name: "credentials" }) as
- | Record<string, unknown>
- | undefined;
-
- if (
- accountType !== PamAccountType.SSH ||
- credentials?.authMethod !== SSH_CERTIFICATE_AUTH_METHOD
- ) {
+export const SshCaSetupCallout = ({ accountType, authMethod, accountId }: Props) => {
+ if (accountType !== PamAccountType.SSH || authMethod !== SSH_CERTIFICATE_AUTH_METHOD) {
return null;
}
@@ -43,7 +34,7 @@ export const SshCaSetupCallout = ({ control, accountId }: Props) => {
<div className="flex items-start gap-2">
<AlertTriangle className="mt-0.5 size-4 shrink-0 text-warning" />
<div className="min-w-0 flex-1 text-sm">
- <div className="flex items-center gap-2">
+ <div className="flex flex-wrap items-center gap-2">
<p className="font-medium text-warning">SSH CA setup required</p>
<DocumentationLinkBadge href={PamDocsUrls.guides.sshCertificateAuth} />
</div>