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
chore(kmip): trim comments to the non-obvious parts
bernie-gf619f520d601
diff --git a/backend/src/ee/routes/v1/kmip-server-router.ts b/backend/src/ee/routes/v1/kmip-server-router.tsindex 8dc2b5f98a..f77d78745d 100644--- a/backend/src/ee/routes/v1/kmip-server-router.ts+++ b/backend/src/ee/routes/v1/kmip-server-router.ts@@ -31,9 +31,7 @@ const SanitizedKmipServerSchema = KmipServersSchema.pick({// Cert config lives on the server entity. The daemon's /connect call reads it, rather than// passing it on every launch. TTL is API-only (no UI field) and defaults to 1y.-// ms() throws on unparseable input (including ""), so guard it to return a clean 400.-// The 1h floor catches accidents like "1m" (ms reads it as one minute, not one month) that-// would otherwise have the server reissuing its certificate every few seconds forever.+// The 1h floor catches "1m", which ms() reads as one minute rather than one month.const MIN_TTL_MS = ms(MIN_SERVER_CERT_TTL);const isTtlAtLeastFloor = (val: string) => {try {diff --git a/backend/src/ee/services/kmip/kmip-service.ts b/backend/src/ee/services/kmip/kmip-service.tsindex 21f6cc1352..20589d0640 100644--- a/backend/src/ee/services/kmip/kmip-service.ts+++ b/backend/src/ee/services/kmip/kmip-service.ts@@ -82,8 +82,7 @@ export type TKmipServiceFactory = ReturnType<typeof kmipServiceFactory>;export const MIN_SERVER_CERT_TTL = "1h";-// Throws rather than clamping: a clamp leaves the stored value wrong and the operator never learns-// the certificate they get is not the one they configured.+// Throws rather than clamping, so a wrong stored value surfaces instead of being silently altered.export const assertTtlAtLeastFloor = (ttl: string) => {let parsed: number | undefined;try {@@ -91,8 +90,7 @@ export const assertTtlAtLeastFloor = (ttl: string) => {} catch {parsed = undefined;}- // ms() returns undefined for unparseable input rather than throwing, and NaN comparisons are- // always false, so an explicit finiteness check is what stops garbage reaching certificate issuance.+ // ms() returns undefined rather than throwing, and NaN comparisons are always false.if (!Number.isFinite(parsed)) {throw new BadRequestError({ message: `KMIP server certificate TTL '${ttl}' is not a valid duration.` });}@@ -850,9 +848,7 @@ export const kmipServiceFactory = ({keyAlgorithm,hostnamesOrIps}: TRegisterServerDTO) => {- // Both callers (the enrollment /connect flow and the legacy registration route) land here, so- // the floor is enforced at issuance rather than per route. Sub-hour certificates expire faster- // than the daemon can replace them, which is the "1m" typo for one month.+ // Enforced here rather than per route, since both enrollment paths issue through this.assertTtlAtLeastFloor(ttl);// KMIP servers authenticate via their enrollment-based access token, which is itself the