Skip to content

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

fix(ui): disable cert-manager in TypeSelect when no active project, reject ssh/ai slugs

Saif175343282be6
diff --git a/frontend/src/helpers/project.ts b/frontend/src/helpers/project.ts
index 01e2936b9d..d50f3a6ad7 100644
--- a/frontend/src/helpers/project.ts
+++ b/frontend/src/helpers/project.ts
@@ -61,10 +61,18 @@ export const projectTypeToUrlSlug = (type: ProjectType): string => {
return type;
};
+const VALID_PROJECT_SLUGS = new Set<string>([
+ "secret-management",
+ ProjectType.CertificateManager,
+ ProjectType.KMS,
+ ProjectType.SecretScanning,
+ ProjectType.PAM
+]);
+
export const urlSlugToProjectType = (slug: string): ProjectType | null => {
+ if (!VALID_PROJECT_SLUGS.has(slug)) return null;
if (slug === "secret-management") return ProjectType.SecretManager;
- const match = Object.values(ProjectType).find((t) => t === slug);
- return match ?? null;
+ return slug as ProjectType;
};
export const getProjectBaseURL = (type: ProjectType) => {
diff --git a/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx b/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx
index 570f879d2b..e72e7586f6 100644
--- a/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx
+++ b/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx
@@ -121,13 +121,15 @@ const TypeSelectInner = ({
{PRODUCT_TYPES.map((type) => {
const isCertManager = type === ProjectType.CertificateManager;
const count = projectCountsByType[type] || 0;
+ const isCmDisabled = isCertManager && !certManagerInstance?.activeProjectId;
return (
<CommandItem
key={type}
value={getProjectTitle(type)}
- onSelect={() => handleSelectType(type)}
- className="gap-2"
+ disabled={isCmDisabled}
+ onSelect={() => !isCmDisabled && handleSelectType(type)}
+ className={`gap-2 ${isCmDisabled ? "cursor-not-allowed opacity-40" : ""}`}
>
<Check className={currentType === type ? "opacity-100" : "opacity-0"} />
<Lottie className="h-4 w-4 shrink-0" icon={getProjectLottieIcon(type)} />