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
Address greptile comments
Carlos Monastyrski5e8b4d7855f6
diff --git a/backend/src/db/migrations/20260401124650_certificate-inventory-views.ts b/backend/src/db/migrations/20260401124650_certificate-inventory-views.tsindex e62d5109ab..261954af47 100644--- a/backend/src/db/migrations/20260401124650_certificate-inventory-views.ts+++ b/backend/src/db/migrations/20260401124650_certificate-inventory-views.ts@@ -12,7 +12,7 @@ export async function up(knex: Knex): Promise<void> {t.foreign("projectId").references("id").inTable(TableName.Project).onDelete("CASCADE");t.string("name", 255).notNullable();- t.jsonb("filters").notNullable().defaultTo("{}");+ t.jsonb("filters").notNullable();t.jsonb("columns").nullable();t.uuid("createdByUserId").nullable();diff --git a/backend/src/db/schemas/certificate-inventory-views.ts b/backend/src/db/schemas/certificate-inventory-views.tsindex f63e6b7f96..78b54e1d14 100644--- a/backend/src/db/schemas/certificate-inventory-views.ts+++ b/backend/src/db/schemas/certificate-inventory-views.ts@@ -11,7 +11,7 @@ export const CertificateInventoryViewsSchema = z.object({id: z.string().uuid(),projectId: z.string(),name: z.string(),- filters: z.unknown().default({}),+ filters: z.unknown(),columns: z.unknown().nullable().optional(),createdByUserId: z.string().uuid().nullable().optional(),createdAt: z.date(),diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.tsindex cf1bceb3b7..6c399f62df 100644--- a/backend/src/services/project/project-service.ts+++ b/backend/src/services/project/project-service.ts@@ -1364,7 +1364,11 @@ export const projectServiceFactory = ({const cacheKey = KeyStorePrefixes.CertDashboardStats(projectId);const cached = await keyStore.getItem(cacheKey);if (cached) {- return JSON.parse(cached) as Awaited<ReturnType<typeof certificateDAL.getDashboardStats>>;+ try {+ return JSON.parse(cached) as Awaited<ReturnType<typeof certificateDAL.getDashboardStats>>;+ } catch {+ // stale entry — recompute+ }}const stats = await certificateDAL.getDashboardStats(projectId);@@ -1403,7 +1407,11 @@ export const projectServiceFactory = ({const cacheKey = KeyStorePrefixes.CertActivityTrend(projectId, range);const cached = await keyStore.getItem(cacheKey);if (cached) {- return JSON.parse(cached) as Awaited<ReturnType<typeof certificateDAL.getActivityTrend>>;+ try {+ return JSON.parse(cached) as Awaited<ReturnType<typeof certificateDAL.getActivityTrend>>;+ } catch {+ // stale entry — recompute+ }}const trend = await certificateDAL.getActivityTrend(projectId, daysBack);diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.ts b/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.tsindex 31e9a6ad80..d5e1e5db17 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.ts+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.ts@@ -1,4 +1,6 @@-import { TCertificate } from "@app/hooks/api/certificates/types";+import { TCertificate, TCertificateSource } from "@app/hooks/api/certificates/types";++import { getCertSourceLabel } from "./CertificatesTable.utils";const CSV_COLUMNS = [{ key: "commonName", header: "Common Name" },@@ -17,7 +19,16 @@ const CSV_COLUMNS = [const escapeCSV = (value: string | null | undefined): string => {if (value === null || value === undefined) return "";const str = String(value);- if (str.includes(",") || str.includes('"') || str.includes("\n")) {+ const needsQuoting =+ str.includes(",") ||+ str.includes('"') ||+ str.includes("\n") ||+ str.includes("\r") ||+ str.startsWith("=") ||+ str.startsWith("+") ||+ str.startsWith("-") ||+ str.startsWith("@");+ if (needsQuoting) {return `"${str.replace(/"/g, '""')}"`;}return str;@@ -27,6 +38,9 @@ export const certificatesToCSV = (certificates: TCertificate[]): string => {const header = CSV_COLUMNS.map((col) => col.header).join(",");const rows = certificates.map((cert) =>CSV_COLUMNS.map((col) => {+ if (col.key === "source") {+ return escapeCSV(getCertSourceLabel((cert.source ?? null) as TCertificateSource));+ }const value = cert[col.key as keyof TCertificate];if (value === null || value === undefined) return "";if (typeof value === "object") return escapeCSV(JSON.stringify(value));