Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Last improvements on PKI dashboard
Carlos Monastyrski287ee07c6544
diff --git a/backend/src/ee/services/permission/default-roles.ts b/backend/src/ee/services/permission/default-roles.tsindex 199c40ddae..7c3809538f 100644--- a/backend/src/ee/services/permission/default-roles.ts+++ b/backend/src/ee/services/permission/default-roles.ts@@ -753,15 +753,7 @@ const buildViewerPermissionRules = () => {can(ProjectPermissionActions.Read, ProjectPermissionSub.IpAllowList);can(ProjectPermissionCertificateAuthorityActions.Read, ProjectPermissionSub.CertificateAuthorities);can(ProjectPermissionCertificateActions.Read, ProjectPermissionSub.Certificates);- can(- [- ProjectPermissionActions.Read,- ProjectPermissionActions.Create,- ProjectPermissionActions.Edit,- ProjectPermissionActions.Delete- ],- ProjectPermissionSub.CertificateInventoryViews- );+ can([ProjectPermissionActions.Read], ProjectPermissionSub.CertificateInventoryViews);can(ProjectPermissionPkiTemplateActions.Read, ProjectPermissionSub.CertificateTemplates);can(ProjectPermissionCertificatePolicyActions.Read, ProjectPermissionSub.CertificatePolicies);can(ProjectPermissionCmekActions.Read, ProjectPermissionSub.Cmek);diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.tsindex 929ba7bf6e..80d1523069 100644--- a/backend/src/services/project/project-service.ts+++ b/backend/src/services/project/project-service.ts@@ -41,13 +41,13 @@ import { TSshCertificateTemplateDALFactory } from "@app/ee/services/ssh-certificimport { TSshHostDALFactory } from "@app/ee/services/ssh-host/ssh-host-dal";import { TSshHostGroupDALFactory } from "@app/ee/services/ssh-host-group/ssh-host-group-dal";import { KeyStorePrefixes, PgSqlLock, TKeyStoreFactory } from "@app/keystore/keystore";+import { withCache } from "@app/lib/cache/with-cache";import { getProcessedPermissionRules } from "@app/lib/casl/permission-filter-utils";import { getConfig } from "@app/lib/config/env";import { crypto } from "@app/lib/crypto/cryptography";import { DatabaseErrorCode } from "@app/lib/error-codes";import { BadRequestError, DatabaseError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";import { groupBy } from "@app/lib/fn";-import { logger } from "@app/lib/logger";import { alphaNumericNanoId } from "@app/lib/nanoid";import { TProjectPermission } from "@app/lib/types";import { TPkiSubscriberDALFactory } from "@app/services/pki-subscriber/pki-subscriber-dal";@@ -1359,19 +1359,12 @@ export const projectServiceFactory = ({ProjectPermissionSub.Certificates);- const cacheKey = KeyStorePrefixes.CertDashboardStats(projectId);- const cached = await keyStore.getItem(cacheKey);- if (cached) {- try {- return JSON.parse(cached) as Awaited<ReturnType<typeof certificateDAL.getDashboardStats>>;- } catch {- logger.error(`Malformed dashboard stats cache entry [projectId=${projectId}]`);- }- }-- const stats = await certificateDAL.getDashboardStats(projectId);- await keyStore.setItemWithExpiry(cacheKey, DASHBOARD_CACHE_TTL, JSON.stringify(stats));- return stats;+ return withCache({+ keyStore,+ key: KeyStorePrefixes.CertDashboardStats(projectId),+ ttlSeconds: DASHBOARD_CACHE_TTL,+ fetcher: () => certificateDAL.getDashboardStats(projectId)+ });};const getActivityTrend = async ({@@ -1402,19 +1395,12 @@ export const projectServiceFactory = ({const rangeDaysMap: Record<string, number> = { "7d": 7, "30d": 30, "6m": 180 };const daysBack = rangeDaysMap[range];- const cacheKey = KeyStorePrefixes.CertActivityTrend(projectId, range);- const cached = await keyStore.getItem(cacheKey);- if (cached) {- try {- return JSON.parse(cached) as Awaited<ReturnType<typeof certificateDAL.getActivityTrend>>;- } catch {- logger.error(`Malformed activity trend cache entry [projectId=${projectId}] [range=${range}]`);- }- }-- const trend = await certificateDAL.getActivityTrend(projectId, daysBack);- await keyStore.setItemWithExpiry(cacheKey, DASHBOARD_CACHE_TTL, JSON.stringify(trend));- return trend;+ return withCache({+ keyStore,+ key: KeyStorePrefixes.CertActivityTrend(projectId, range),+ ttlSeconds: DASHBOARD_CACHE_TTL,+ fetcher: () => certificateDAL.getActivityTrend(projectId, daysBack)+ });};/**diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsxindex 20815c11a5..8f7b2e0d59 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx@@ -9,6 +9,7 @@ import {UnstableCard,UnstableCardAction,UnstableCardContent,+ UnstableCardDescription,UnstableCardHeader,UnstableCardTitle} from "@app/components/v3";@@ -125,9 +126,9 @@ export const CertificatesSection = ({Certificates<DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/pki/certificates/overview" /></UnstableCardTitle>- <p className="text-sm text-muted">+ <UnstableCardDescription>View, filter, and manage all certificates across your project.- </p>+ </UnstableCardDescription><UnstableCardAction><ProjectPermissionCanI={ProjectPermissionCertificateActions.Import}diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsxindex d0f0b57a5d..8f8d69c32b 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx@@ -55,6 +55,7 @@ import {UnstableTableRow} from "@app/components/v3";import {+ ProjectPermissionActions,ProjectPermissionCertificateActions,ProjectPermissionPkiSyncActions,ProjectPermissionSub,@@ -132,8 +133,10 @@ const VIEW_STORAGE_KEY = "cert-inventory-active-view";const MS_PER_DAY = 86_400_000;const SEARCH_DEBOUNCE_MS = 500;+const EmptyCell = () => <span className="text-muted">—</span>;+const getEnrollmentMethodBadge = (enrollmentType: string | null | undefined) => {- if (!enrollmentType) return null;+ if (!enrollmentType) return <EmptyCell />;const label = enrollmentType.toUpperCase();return <Badge variant="ghost">{label}</Badge>;};@@ -192,6 +195,23 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter, dashboardFiconst { currentProject } = useProject();const { permission } = useProjectPermission();+ const canReadViews = permission.can(+ ProjectPermissionActions.Read,+ ProjectPermissionSub.CertificateInventoryViews+ );+ const canCreateViews = permission.can(+ ProjectPermissionActions.Create,+ ProjectPermissionSub.CertificateInventoryViews+ );+ const canEditViews = permission.can(+ ProjectPermissionActions.Edit,+ ProjectPermissionSub.CertificateInventoryViews+ );+ const canDeleteViews = permission.can(+ ProjectPermissionActions.Delete,+ ProjectPermissionSub.CertificateInventoryViews+ );+const projectId = currentProject?.id ?? "";const [visibleColumns, setVisibleColumns] = useState<Set<string>>(() =>getDefaultVisibleColumns(projectId)@@ -598,7 +618,7 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter, dashboardFihandleClearAllFilters();setIsFilterOpen(false);}}- onSaveView={() => setIsSaveViewOpen(true)}+ onSaveView={canCreateViews ? () => setIsSaveViewOpen(true) : undefined}dynamicFieldOptions={dynamicFieldOptions}/></PopoverContent>@@ -614,18 +634,18 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter, dashboardFi<DownloadIcon /></UnstableIconButton>- <ViewsDropdown- activeViewId={activeViewId}- systemViews={viewsData?.systemViews || []}- sharedViews={viewsData?.sharedViews || []}- customViews={viewsData?.customViews || []}- currentUserId={user?.id}- onSelectView={handleSelectView}- onDeleteView={(viewId) => {- handleDeleteView(viewId);- }}- onToggleShare={handleToggleShare}- />+ {canReadViews && (+ <ViewsDropdown+ activeViewId={activeViewId}+ systemViews={viewsData?.systemViews || []}+ sharedViews={viewsData?.sharedViews || []}+ customViews={viewsData?.customViews || []}+ currentUserId={user?.id}+ onSelectView={handleSelectView}+ onDeleteView={canDeleteViews ? (viewId) => handleDeleteView(viewId) : undefined}+ onToggleShare={canEditViews ? handleToggleShare : undefined}+ />+ )}<ColumnVisibilityTogglevisibleColumns={visibleColumns}@@ -783,32 +803,36 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter, dashboardFi)}{visibleColumns.has("issuedAt") && (<UnstableTableCell>- {certificate.notBefore- ? format(new Date(certificate.notBefore), "MMM d, yyyy")- : "-"}+ {certificate.notBefore ? (+ format(new Date(certificate.notBefore), "MMM d, yyyy")+ ) : (+ <EmptyCell />+ )}</UnstableTableCell>)}{visibleColumns.has("expiresAt") && (<UnstableTableCell>- {certificate.notAfter- ? format(new Date(certificate.notAfter), "MMM d, yyyy")- : "-"}+ {certificate.notAfter ? (+ format(new Date(certificate.notAfter), "MMM d, yyyy")+ ) : (+ <EmptyCell />+ )}</UnstableTableCell>)}{visibleColumns.has("ca") && (<UnstableTableCell isTruncatable>- {certificate.caName || "-"}+ {certificate.caName || <EmptyCell />}</UnstableTableCell>)}{visibleColumns.has("profile") && (<UnstableTableCell isTruncatable>- {certificate.profileName || "-"}+ {certificate.profileName || <EmptyCell />}</UnstableTableCell>)}{visibleColumns.has("algorithm") && (<UnstableTableCell><span className="text-xs">- {certificate.keyAlgorithm?.replace("_", "-") || "-"}+ {certificate.keyAlgorithm?.replace("_", "-") || <EmptyCell />}</span></UnstableTableCell>)}diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/ColumnVisibilityToggle.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/ColumnVisibilityToggle.tsxindex 135c34ae54..eafcfab4ff 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/ColumnVisibilityToggle.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/ColumnVisibilityToggle.tsx@@ -64,8 +64,10 @@ export const ColumnVisibilityToggle = ({ visibleColumns, onChange, projectId }:const allColumnKeys = INVENTORY_COLUMNS.map((c) => c.key);const allVisible = visibleColumns.size === INVENTORY_COLUMNS.length;+ const MIN_COLUMN = "sanCn";+const handleToggleAll = () => {- const next = allVisible ? new Set<string>() : new Set(allColumnKeys);+ const next = allVisible ? new Set<string>([MIN_COLUMN]) : new Set(allColumnKeys);onChange(next);saveVisibleColumns(next, projectId);};@@ -73,6 +75,7 @@ export const ColumnVisibilityToggle = ({ visibleColumns, onChange, projectId }:const handleToggle = (key: string) => {const next = new Set(visibleColumns);if (next.has(key)) {+ if (next.size <= 1) return;next.delete(key);} else {next.add(key);diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/FilterBuilder.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/FilterBuilder.tsxindex f0807c3031..bd81315f1c 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/FilterBuilder.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/FilterBuilder.tsx@@ -25,7 +25,7 @@ type Props = {onApply: () => void;onCancel: () => void;onClearAll: () => void;- onSaveView: () => void;+ onSaveView?: () => void;dynamicFieldOptions?: Record<string, { value: string; label: string }[]>;};@@ -84,6 +84,12 @@ const DatePickerInput = ({);};+const isRuleEmpty = (rule: FilterRule): boolean => {+ if (rule.value === null || rule.value === undefined || rule.value === "") return true;+ if (Array.isArray(rule.value) && rule.value.length === 0) return true;+ return false;+};+const FilterRow = ({rule,onUpdate,@@ -186,8 +192,10 @@ const FilterRow = ({}};+ const empty = isRuleEmpty(rule);+return (- <div className="flex items-start gap-2">+ <div className={`flex items-start gap-2 ${empty ? "rounded ring-1 ring-warning/30" : ""}`}><Select value={rule.field} onValueChange={handleFieldChange}><SelectTrigger className="w-[180px] shrink-0"><SelectValue />@@ -241,6 +249,18 @@ export const FilterBuilder = ({onSaveView,dynamicFieldOptions}: Props) => {+ const hasEmptyRules = rules.some(isRuleEmpty);++ const handleApplyWithValidation = () => {+ onChange(rules.filter((r) => !isRuleEmpty(r)));+ onApply();+ };++ const handleSaveWithValidation = () => {+ onChange(rules.filter((r) => !isRuleEmpty(r)));+ onSaveView?.();+ };+const handleAddRule = () => {const defaultField = FILTER_FIELDS[0];onChange([@@ -303,14 +323,19 @@ export const FilterBuilder = ({</Button><div className="flex items-center justify-between border-t border-border pt-3">- <Button variant="outline" size="xs" onClick={onSaveView}>- Save as View...- </Button>+ {onSaveView && (+ <Button variant="outline" size="xs" onClick={handleSaveWithValidation}>+ Save as View...+ </Button>+ )}<div className="flex items-center gap-2">+ {hasEmptyRules && (+ <span className="text-xs text-warning">Empty filters will be removed</span>+ )}<Button variant="ghost" size="sm" onClick={onCancel}>Cancel</Button>- <Button variant="project" size="sm" onClick={onApply}>+ <Button variant="project" size="sm" onClick={handleApplyWithValidation}>Apply Filters</Button></div>diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsxindex f932351f50..a8d8b0769a 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsx@@ -28,7 +28,7 @@ type Props = {customViews: (TCertificateInventoryView & { isSystem: false; isShared: false })[];currentUserId?: string;onSelectView: (viewId: string, filters: TInventoryViewFilters | TSystemViewFilters) => void;- onDeleteView: (viewId: string) => void;+ onDeleteView?: (viewId: string) => void;onToggleShare?: (viewId: string, isShared: boolean) => void;};@@ -50,10 +50,13 @@ export const ViewsDropdown = ({customViews.find((v) => v.id === activeViewId);const label = activeView?.name || "All Certificates";- const renderActions = (viewId: string, isShared: boolean) => {- if (pendingDeleteId === viewId) {+ const renderActions = (viewId: string, isShared: boolean, isActive = false) => {+ if (!onDeleteView && !onToggleShare) return null;+ if (isActive && pendingDeleteId !== viewId) return null;++ if (pendingDeleteId === viewId && onDeleteView) {return (- <div className="absolute top-1/2 right-2 flex -translate-y-1/2 items-center gap-0.5">+ <div className="absolute top-1/2 right-10 flex -translate-y-1/2 items-center gap-0.5"><UnstableIconButtonvariant="ghost"size="xs"@@ -106,18 +109,20 @@ export const ViewsDropdown = ({</TooltipContent></Tooltip>)}- <UnstableIconButton- variant="ghost"- size="xs"- aria-label="Delete view"- onClick={(e) => {- e.stopPropagation();- setPendingDeleteId(viewId);- }}- className="text-muted hover:text-red-400"- >- <Trash2Icon />- </UnstableIconButton>+ {onDeleteView && (+ <UnstableIconButton+ variant="ghost"+ size="xs"+ aria-label="Delete view"+ onClick={(e) => {+ e.stopPropagation();+ setPendingDeleteId(viewId);+ }}+ className="text-muted hover:text-red-400"+ >+ <Trash2Icon />+ </UnstableIconButton>+ )}</div>);};@@ -162,8 +167,8 @@ export const ViewsDropdown = ({className="group relative"onClick={() => onSelectView(view.id, view.filters as Record<string, unknown>)}>- <span className="flex-1 pr-12">{view.name}</span>- {isOwner && renderActions(view.id, true)}+ <span className="min-w-0 flex-1 truncate pr-16">{view.name}</span>+ {isOwner && renderActions(view.id, true, activeViewId === view.id)}</UnstableDropdownMenuRadioItem>);})}@@ -189,8 +194,8 @@ export const ViewsDropdown = ({className="group relative"onClick={() => onSelectView(view.id, view.filters as Record<string, unknown>)}>- <span className="flex-1 pr-12">{view.name}</span>- {renderActions(view.id, false)}+ <span className="min-w-0 flex-1 truncate pr-16">{view.name}</span>+ {renderActions(view.id, false, activeViewId === view.id)}</UnstableDropdownMenuRadioItem>))}</UnstableDropdownMenuRadioGroup>diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsxindex 7720ad0c40..fd6efdd85c 100644--- a/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsx+++ b/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsx@@ -346,7 +346,7 @@ export const ValidityReadinessSection = ({ stats }: Props) => {return (<div className="flex flex-col gap-4"><h2 className="text-lg font-semibold text-foreground">47-Day Validity Readiness</h2>- <div className="grid auto-rows-[1fr] grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3">+ <div className="grid auto-rows-[1fr] grid-cols-1 gap-4 xl:grid-cols-3"><MandateCountdown /><ProjectedRenewals activeCerts={tlsActiveCerts} /><ValidityDistribution buckets={stats.validityBuckets} />