Skip to content

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

Address greptile comments

Carlos Monastyrski45a35931160d
diff --git a/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.test.ts b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.test.ts
index 7cc4b7c4bf..750fa72c40 100644
--- a/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.test.ts
+++ b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.test.ts
@@ -1,3 +1,5 @@
+import RE2 from "re2";
+
import {
buildCertificateBundle,
buildIntermediateIdentifier,
@@ -78,15 +80,15 @@ describe("Kemp buildIntermediateIdentifier", () => {
const a = buildIntermediateIdentifier(TEST_CA_PEM, "Infisical-ca-{{fingerprint}}");
const b = buildIntermediateIdentifier(TEST_CA_PEM, "Infisical-ca-{{fingerprint}}");
expect(a).toBe(b);
- expect(a).toMatch(/^Infisical-ca-[0-9a-f]{24}$/);
+ expect(new RE2("^Infisical-ca-[0-9a-f]{24}$").test(a)).toBe(true);
expect(buildIntermediateIdentifier("different-content", "Infisical-ca-{{fingerprint}}")).not.toBe(a);
});
test("compiles {{commonName}} from the certificate subject, sanitizing to Kemp-safe characters", () => {
- // CN is "Test CA"; the space is sanitized to a dash.
- expect(buildIntermediateIdentifier(TEST_CA_PEM, "{{commonName}}-{{fingerprint}}")).toMatch(
- /^Test-CA-[0-9a-f]{24}$/
- );
+ // CN is "Test CA", the space is sanitized to a dash.
+ expect(
+ new RE2("^Test-CA-[0-9a-f]{24}$").test(buildIntermediateIdentifier(TEST_CA_PEM, "{{commonName}}-{{fingerprint}}"))
+ ).toBe(true);
});
test("falls back to 'ca' for {{commonName}} when the certificate cannot be parsed", () => {
diff --git a/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.ts b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.ts
index 00f478ea44..befdd61f58 100644
--- a/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.ts
+++ b/backend/src/services/pki-sync/kemp-loadmaster/kemp-loadmaster-pki-sync-fns.ts
@@ -618,13 +618,20 @@ export const kempLoadMasterPkiSyncFactory = ({
}
}
+ const managedCertificateIds = new Set<string>();
+ for (const certData of Object.values(certificateMap)) {
+ if (certData.certificateId) managedCertificateIds.add(certData.certificateId);
+ }
+ const attemptedIdentifiers = new Set(certificatesToUpload.map((entry) => entry.targetIdentifier));
+
const identifiersToRemove = new Set<string>();
if (canRemoveCertificates) {
for (const syncRecord of existingSyncRecords) {
if (
syncRecord.externalIdentifier &&
!activeIdentifiers.has(syncRecord.externalIdentifier) &&
- existingCertNames.has(syncRecord.externalIdentifier)
+ existingCertNames.has(syncRecord.externalIdentifier) &&
+ !(syncRecord.certificateId && managedCertificateIds.has(syncRecord.certificateId))
) {
identifiersToRemove.add(syncRecord.externalIdentifier);
}
@@ -633,7 +640,11 @@ export const kempLoadMasterPkiSyncFactory = ({
if (!certificateNameSchemaHasFreeTextPlaceholder(certificateNameSchema)) {
const managedCertNamePattern = buildManagedCertNamePattern(certificateNameSchema);
for (const certName of existingCertNames) {
- if (managedCertNamePattern.test(certName) && !activeIdentifiers.has(certName)) {
+ if (
+ managedCertNamePattern.test(certName) &&
+ !activeIdentifiers.has(certName) &&
+ !attemptedIdentifiers.has(certName)
+ ) {
identifiersToRemove.add(certName);
}
}
diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/KempLoadMasterPkiSyncDestinationSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/KempLoadMasterPkiSyncDestinationSection.tsx
index 66f408fd69..53f2aac015 100644
--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/KempLoadMasterPkiSyncDestinationSection.tsx
+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncDestinationSection/KempLoadMasterPkiSyncDestinationSection.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable jsx-a11y/label-has-associated-control */
import { TKempLoadMasterPkiSync } from "@app/hooks/api/pkiSyncs/types/kemp-loadmaster-sync";
const GenericFieldLabel = ({ label, children }: { label: string; children: React.ReactNode }) => (
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/KempLoadMasterConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/KempLoadMasterConnectionForm.tsx
index b8b055a213..fc4eddb44b 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/KempLoadMasterConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/KempLoadMasterConnectionForm.tsx
@@ -102,7 +102,7 @@ export const KempLoadMasterConnectionForm = ({ appConnection, onSubmit }: Props)
gatewayId: null,
gatewayPoolId: null,
credentials: {
- sslRejectUnauthorized: false,
+ sslRejectUnauthorized: true,
sslCertificate: undefined
}
}