Skip to content

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

Small fix on SSH reason

Carlos Monastyrski23c87822f7a9
diff --git a/frontend/src/pages/pam/PamAccountAccessPage/ReasonGate.tsx b/frontend/src/pages/pam/PamAccountAccessPage/ReasonGate.tsx
index 90f2f425d7..e80276cf2e 100644
--- a/frontend/src/pages/pam/PamAccountAccessPage/ReasonGate.tsx
+++ b/frontend/src/pages/pam/PamAccountAccessPage/ReasonGate.tsx
@@ -40,8 +40,8 @@ export const ReasonGate = ({ account, children }: Props) => {
</h2>
<p className="max-w-sm text-center text-xs text-mineshaft-400">
{isReasonRequired
- ? "This account's policy requires a reason for access. The reason will be stored with the session for audit purposes."
- : "Optionally provide a reason for this session. The reason will be stored with the session for audit purposes."}
+ ? "This account's policy requires a reason for access. The reason will be stored for audit purposes."
+ : "Optionally provide a reason for this session. The reason will be stored for audit purposes."}
</p>
<div className="flex w-full max-w-sm flex-col gap-2">
<textarea
diff --git a/frontend/src/pages/pam/PamAccountAccessPage/useWebAccessSession.ts b/frontend/src/pages/pam/PamAccountAccessPage/useWebAccessSession.ts
index b97ea99465..e65c2a2952 100644
--- a/frontend/src/pages/pam/PamAccountAccessPage/useWebAccessSession.ts
+++ b/frontend/src/pages/pam/PamAccountAccessPage/useWebAccessSession.ts
@@ -50,6 +50,7 @@ export const useWebAccessSession = ({
// Seed with the prop so non-SSH flows (which collect reason via the upfront ReasonGate)
// pass it on the first connect; SSH leaves it undefined and uses the inline terminal prompt.
const submittedReasonRef = useRef<string | undefined>(reason);
+ const askedOptionalReasonRef = useRef(false);
useEffect(() => {
onSessionEndRef.current = onSessionEnd;
@@ -249,6 +250,20 @@ export const useWebAccessSession = ({
isWidenedRef.current = false;
}
if (fitAddonRef.current) fitAddonRef.current.fit();
+
+ if (isSSH && submittedReasonRef.current === undefined && !askedOptionalReasonRef.current) {
+ askedOptionalReasonRef.current = true;
+ const optional = await prompt(
+ "\r\nOptionally provide a reason for this session (press Enter to skip): "
+ );
+ if (optional.trim()) {
+ submittedReasonRef.current = optional.trim();
+ terminal.reset();
+ connect();
+ return;
+ }
+ }
+
terminal.reset();
openWebSocket(terminal, data.ticket);
} catch (err: unknown) {
diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionDetailsSection.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionDetailsSection.tsx
index 05da111c50..d845ab12da 100644
--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionDetailsSection.tsx
+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/PamSessionDetailsSection.tsx
@@ -108,13 +108,9 @@ export const PamSessionDetailsSection = ({
</DetailItem>
<DetailItem label="Reason">
- {reason ? (
- <div className="max-h-32 overflow-y-auto rounded border border-mineshaft-600 bg-mineshaft-800 p-2">
- <p className="break-words whitespace-pre-wrap">{reason}</p>
- </div>
- ) : (
- <p>—</p>
- )}
+ <div className="max-h-32 overflow-y-auto">
+ <p className="break-words whitespace-pre-wrap">{reason || "—"}</p>
+ </div>
</DetailItem>
<DetailItem label="Created At">