Skip to content

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

address reviews

xf152739c0b1e
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 0d2d369de6..bfceac48fb 100644
--- a/backend/src/ee/services/pam-account/pam-account-schemas.ts
+++ b/backend/src/ee/services/pam-account/pam-account-schemas.ts
@@ -43,9 +43,10 @@ const normalizeDelimitedStringList = (value: unknown): unknown => {
return items;
};
+const hostPattern = new RE2(/^[A-Za-z0-9.:_-]+$/);
const delimitedStringList = z.preprocess(
normalizeDelimitedStringList,
- z.array(z.string().trim().min(1).max(255)).min(1)
+ z.array(z.string().trim().min(1).max(255).regex(hostPattern, "Must be a valid hostname or IP address")).min(1)
);
// Source of truth for account types: per-type schemas + sparse UI hints
diff --git a/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx b/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx
index 72cbd85e73..9f2ee09427 100644
--- a/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx
+++ b/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx
@@ -68,9 +68,9 @@ const LaunchTab = ({
);
const hostMissing = needsHost && !selectedHost;
- const cliHost = selectedHost ?? (needsHost ? "<host>" : undefined);
+ const cliHost = selectedHost ?? (needsHost ? "HOST" : undefined);
const cliCommand = `infisical pam access ${account.folderName}/${account.name}${
- cliHost ? ` --target ${cliHost}` : ""
+ cliHost ? ` --target '${cliHost}'` : ""
}`;
const handleCopyCommand = async () => {
await navigator.clipboard.writeText(cliCommand);
diff --git a/frontend/src/pages/pam/PamAccountAccessPage/RdpLauncher.tsx b/frontend/src/pages/pam/PamAccountAccessPage/RdpLauncher.tsx
index 765592b60d..b9b5737f0d 100644
--- a/frontend/src/pages/pam/PamAccountAccessPage/RdpLauncher.tsx
+++ b/frontend/src/pages/pam/PamAccountAccessPage/RdpLauncher.tsx
@@ -29,10 +29,13 @@ const getSelectableHosts = (account: TPamAccount): string[] => {
export const RdpLauncher = ({ account, reason, mfaSessionId, preselectedHost }: Props) => {
const hosts = useMemo(() => getSelectableHosts(account), [account]);
- const needsPicker = hosts.length > 1 && !preselectedHost;
+
+ const validPreselectedHost =
+ preselectedHost && hosts.includes(preselectedHost) ? preselectedHost : undefined;
+ const needsPicker = hosts.length > 1 && !validPreselectedHost;
const [selectedHost, setSelectedHost] = useState<string | undefined>(
- preselectedHost ?? (hosts.length > 1 ? undefined : hosts[0])
+ validPreselectedHost ?? (hosts.length > 1 ? undefined : hosts[0])
);
const [pendingHost, setPendingHost] = useState<string>(hosts[0] ?? "");