Skip to content

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

misc: addressed bot

Sheen Capadngan680ef9ae0e45
diff --git a/backend/src/ee/services/pam-account/pam-account-schemas.ts b/backend/src/ee/services/pam-account/pam-account-schemas.ts
index 44fbd42e5d..4a01bfbaab 100644
--- a/backend/src/ee/services/pam-account/pam-account-schemas.ts
+++ b/backend/src/ee/services/pam-account/pam-account-schemas.ts
@@ -26,13 +26,7 @@ const ACCOUNT_TYPE_CONFIGS = {
connectionDetails: z.object({
host: z.string().trim().min(1).max(255),
port: z.coerce.number(),
- database: z
- .string()
- .trim()
- .min(1)
- .max(255)
- .transform((v) => v || undefined)
- .optional(),
+ database: z.string().trim().min(1).max(255).optional(),
sslEnabled: z.boolean(),
sslRejectUnauthorized: z.boolean(),
sslCertificate: z
diff --git a/frontend/src/hooks/api/pam/maps.ts b/frontend/src/hooks/api/pam/maps.ts
index d4d3128524..b85ab98e2e 100644
--- a/frontend/src/hooks/api/pam/maps.ts
+++ b/frontend/src/hooks/api/pam/maps.ts
@@ -1,5 +1,10 @@
import { PamAccountType } from "./enums";
+export const PAM_WEB_ACCESS_SUPPORTED_TYPES = new Set<PamAccountType>([
+ PamAccountType.Postgres,
+ PamAccountType.SSH
+]);
+
export const PAM_ACCOUNT_TYPE_MAP: Record<PamAccountType, { name: string; image: string }> = {
[PamAccountType.Postgres]: { name: "PostgreSQL", image: "Postgres.png" },
[PamAccountType.MySQL]: { name: "MySQL", image: "MySql.png" },
diff --git a/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx b/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx
index 92f179159b..9feda5a4d8 100644
--- a/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx
+++ b/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { Link } from "@tanstack/react-router";
import { Copy, FolderOpen, Globe, Rocket, Terminal } from "lucide-react";
@@ -6,7 +6,12 @@ import { createNotification } from "@app/components/notifications";
import { Badge, Button, IconButton } from "@app/components/v3";
import { Sheet, SheetContent } from "@app/components/v3/generic/Sheet";
import { useOrganization } from "@app/context";
-import { PAM_ACCOUNT_TYPE_MAP, TAccessiblePamAccount } from "@app/hooks/api/pam";
+import {
+ PAM_ACCOUNT_TYPE_MAP,
+ PAM_WEB_ACCESS_SUPPORTED_TYPES,
+ PamAccountType,
+ TAccessiblePamAccount
+} from "@app/hooks/api/pam";
import { AccountPlatformIcon } from "./AccountPlatformIcon";
@@ -23,7 +28,18 @@ type Props = {
export const LaunchSessionSheet = ({ account, isOpen, onOpenChange }: Props) => {
const { currentOrg } = useOrganization();
- const [launchMethod, setLaunchMethod] = useState<LaunchMethod>(LaunchMethod.Browser);
+
+ const isWebAccessSupported = account
+ ? PAM_WEB_ACCESS_SUPPORTED_TYPES.has(account.accountType as PamAccountType)
+ : false;
+
+ const [launchMethod, setLaunchMethod] = useState<LaunchMethod>(
+ isWebAccessSupported ? LaunchMethod.Browser : LaunchMethod.CLI
+ );
+
+ useEffect(() => {
+ setLaunchMethod(isWebAccessSupported ? LaunchMethod.Browser : LaunchMethod.CLI);
+ }, [account?.id, isWebAccessSupported]);
if (!account) return null;
@@ -67,39 +83,43 @@ export const LaunchSessionSheet = ({ account, isOpen, onOpenChange }: Props) =>
<div className="flex flex-1 flex-col">
<div className="flex-1 p-6">
- <p className="mb-3 text-sm font-medium text-foreground">Launch method</p>
- <div className="flex gap-3">
- <button
- type="button"
- onClick={() => setLaunchMethod(LaunchMethod.Browser)}
- className={`flex flex-1 cursor-pointer items-start gap-3 rounded-md border p-3.5 transition-colors ${
- launchMethod === LaunchMethod.Browser
- ? "border-product-pam/40 bg-product-pam/5"
- : "hover:border-muted-foreground/30 border-border"
- }`}
- >
- <Globe className="mt-0.5 size-5 shrink-0 text-foreground" />
- <div className="text-left">
- <p className="text-sm font-medium text-foreground">Browser</p>
- <p className="text-xs text-muted">Connect directly from your browser.</p>
- </div>
- </button>
- <button
- type="button"
- onClick={() => setLaunchMethod(LaunchMethod.CLI)}
- className={`flex flex-1 cursor-pointer items-start gap-3 rounded-md border p-3.5 transition-colors ${
- launchMethod === LaunchMethod.CLI
- ? "border-product-pam/40 bg-product-pam/5"
- : "hover:border-muted-foreground/30 border-border"
- }`}
- >
- <Terminal className="mt-0.5 size-5 shrink-0 text-foreground" />
- <div className="text-left">
- <p className="text-sm font-medium text-foreground">CLI</p>
- <p className="text-xs text-muted">Proxy locally via the Infisical CLI.</p>
+ {isWebAccessSupported && (
+ <>
+ <p className="mb-3 text-sm font-medium text-foreground">Launch method</p>
+ <div className="flex gap-3">
+ <button
+ type="button"
+ onClick={() => setLaunchMethod(LaunchMethod.Browser)}
+ className={`flex flex-1 cursor-pointer items-start gap-3 rounded-md border p-3.5 transition-colors ${
+ launchMethod === LaunchMethod.Browser
+ ? "border-product-pam/40 bg-product-pam/5"
+ : "hover:border-muted-foreground/30 border-border"
+ }`}
+ >
+ <Globe className="mt-0.5 size-5 shrink-0 text-foreground" />
+ <div className="text-left">
+ <p className="text-sm font-medium text-foreground">Browser</p>
+ <p className="text-xs text-muted">Connect directly from your browser.</p>
+ </div>
+ </button>
+ <button
+ type="button"
+ onClick={() => setLaunchMethod(LaunchMethod.CLI)}
+ className={`flex flex-1 cursor-pointer items-start gap-3 rounded-md border p-3.5 transition-colors ${
+ launchMethod === LaunchMethod.CLI
+ ? "border-product-pam/40 bg-product-pam/5"
+ : "hover:border-muted-foreground/30 border-border"
+ }`}
+ >
+ <Terminal className="mt-0.5 size-5 shrink-0 text-foreground" />
+ <div className="text-left">
+ <p className="text-sm font-medium text-foreground">CLI</p>
+ <p className="text-xs text-muted">Proxy locally via the Infisical CLI.</p>
+ </div>
+ </button>
</div>
- </button>
- </div>
+ </>
+ )}
{launchMethod === LaunchMethod.Browser && (
<>
@@ -123,7 +143,11 @@ export const LaunchSessionSheet = ({ account, isOpen, onOpenChange }: Props) =>
{launchMethod === LaunchMethod.CLI && (
<>
- <p className="mt-5 mb-2.5 text-sm text-foreground">Run this command</p>
+ <p
+ className={`${isWebAccessSupported ? "mt-5" : ""} mb-2.5 text-sm text-foreground`}
+ >
+ Run this command
+ </p>
<div className="flex items-center justify-between rounded-md border border-border bg-mineshaft-800 px-4 py-3">
<code className="font-mono text-sm text-foreground">
<span className="text-product-pam">$</span> {cliCommand}