Skip to content

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

Addressed greptile comments

Carlos Monastyrski14052c5d8a41
diff --git a/backend/src/services/app-connection/winrm/winrm-connection-fns.ts b/backend/src/services/app-connection/winrm/winrm-connection-fns.ts
index 6a843a049f..ed8f7fdaa6 100644
--- a/backend/src/services/app-connection/winrm/winrm-connection-fns.ts
+++ b/backend/src/services/app-connection/winrm/winrm-connection-fns.ts
@@ -5,6 +5,7 @@ import { BadRequestError } from "@app/lib/errors";
import { GatewayProxyProtocol } from "@app/lib/gateway/types";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { callWinRmEndpoint, WinRmRpcEndpoint } from "@app/lib/gateway-v2/winrm-rpc";
+import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import { WinRMConnectionMethod } from "./winrm-connection-enums";
@@ -67,6 +68,8 @@ export const executeWinRMGatewayOperation = async <T>(
});
}
+ await blockLocalAndPrivateIpAddresses(`winrm://${args.credentials.host}:${args.credentials.port}`, true);
+
const connectionDetails = await gatewayV2Service.getPlatformConnectionDetailsByGatewayId({
gatewayId,
targetHost: args.credentials.host,
diff --git a/backend/src/services/pki-sync/pki-sync-export-fns.ts b/backend/src/services/pki-sync/pki-sync-export-fns.ts
index fb76571bff..b8a30db9c7 100644
--- a/backend/src/services/pki-sync/pki-sync-export-fns.ts
+++ b/backend/src/services/pki-sync/pki-sync-export-fns.ts
@@ -49,7 +49,7 @@ export const exportCertificateForSync = ({
privateKey: privateKey ?? "",
password: password ?? "",
alias
- }).then((pfx) => [{ suffix: ".pfx", content: pfx }]);
+ }).then((pfx) => [{ suffix: ".pfx", content: pfx, isPrivateKey: true }]);
}
const files: TExportedCertificateFile[] = [{ suffix: ".pem", content: Buffer.from(certificate, "utf8") }];
diff --git a/backend/src/services/pki-sync/pki-sync-queue.ts b/backend/src/services/pki-sync/pki-sync-queue.ts
index 8a34949a4d..494240ff8a 100644
--- a/backend/src/services/pki-sync/pki-sync-queue.ts
+++ b/backend/src/services/pki-sync/pki-sync-queue.ts
@@ -801,11 +801,6 @@ export const pkiSyncQueueFactory = ({
}
);
- // Untrack the removed certs only after their files are gone, so a failed removal keeps the
- // tracking row (and its paths) for a retry rather than orphaning the files.
- if (certificateIdsToRemove?.length) {
- await certificateSyncDAL.removeCertificates(syncId, certificateIdsToRemove);
- }
isSuccess = true;
} catch (err) {
diff --git a/backend/src/services/pki-sync/pki-sync-service.ts b/backend/src/services/pki-sync/pki-sync-service.ts
index f8bfede0dd..5ac5cb984f 100644
--- a/backend/src/services/pki-sync/pki-sync-service.ts
+++ b/backend/src/services/pki-sync/pki-sync-service.ts
@@ -22,6 +22,7 @@ import { CertificateSyncStatus } from "../certificate-sync/certificate-sync-enum
import { TSyncMetadata } from "../certificate-sync/certificate-sync-schemas";
import { certificateNameSchemaAllowsMultipleCertificates } from "./pki-sync-certificate-name-fns";
import { encryptPkiSyncCredentials } from "./pki-sync-credentials-fns";
+import { PkiSyncExportFormat } from "./pki-sync-export-fns";
import { TPkiSyncDALFactory } from "./pki-sync-dal";
import { PkiSync, PkiSyncStatus } from "./pki-sync-enums";
import { enterprisePkiSyncCheck, getPkiSyncProviderCapabilities, listPkiSyncOptions } from "./pki-sync-fns";
@@ -430,6 +431,14 @@ export const pkiSyncServiceFactory = ({
assertSchemaAllowsCertificateCount(effectiveSyncOptions, existingCount);
}
+ if (
+ effectiveSyncOptions?.exportFormat === PkiSyncExportFormat.Pkcs12 &&
+ !credentials?.exportPassword &&
+ !pkiSync.encryptedCredentials
+ ) {
+ throw new BadRequestError({ message: "A password is required when the export format is PKCS#12" });
+ }
+
const encryptedCredentials = credentials?.exportPassword
? await encryptPkiSyncCredentials({ orgId: actor.orgId, projectId: pkiSync.projectId, credentials, kmsService })
: undefined;