Skip to content

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

feat: resolved cert issue with localhost

=36f7e7d81b47
diff --git a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
index 3314d8cab8..34a28c6a68 100644
--- a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
+++ b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
@@ -139,6 +139,11 @@ export const identityKubernetesAuthServiceFactory = ({
tokenReviewerJwt = serviceAccountJwt;
}
+ let { kubernetesHost } = identityKubernetesAuth;
+ if (kubernetesHost.startsWith("https://") || kubernetesHost.startsWith("http://")) {
+ kubernetesHost = new RE2("^https?:\\/\\/").replace(kubernetesHost, "");
+ }
+
const tokenReviewCallback = async (host: string = identityKubernetesAuth.kubernetesHost, port?: number) => {
const baseUrl = port ? `${host}:${port}` : host;
@@ -163,7 +168,8 @@ export const identityKubernetesAuthServiceFactory = ({
// if ca cert, rejectUnauthorized: true
httpsAgent: new https.Agent({
ca: caCert,
- rejectUnauthorized: !!caCert
+ rejectUnauthorized: Boolean(caCert),
+ servername: kubernetesHost
})
}
)
@@ -186,12 +192,6 @@ export const identityKubernetesAuthServiceFactory = ({
return res.data;
};
- let { kubernetesHost } = identityKubernetesAuth;
-
- if (kubernetesHost.startsWith("https://") || kubernetesHost.startsWith("http://")) {
- kubernetesHost = new RE2("^https?:\\/\\/").replace(kubernetesHost, "");
- }
-
const [k8sHost, k8sPort] = kubernetesHost.split(":");
const data = identityKubernetesAuth.gatewayId