mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 16:26:37 +00:00
fix: allow https on gateway k8s hosts
This commit is contained in:
@@ -104,6 +104,7 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
|||||||
.object({
|
.object({
|
||||||
kubernetesHost: z
|
kubernetesHost: z
|
||||||
.string()
|
.string()
|
||||||
|
.url()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1)
|
.min(1)
|
||||||
.describe(KUBERNETES_AUTH.ATTACH.kubernetesHost)
|
.describe(KUBERNETES_AUTH.ATTACH.kubernetesHost)
|
||||||
@@ -223,6 +224,7 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
|||||||
.object({
|
.object({
|
||||||
kubernetesHost: z
|
kubernetesHost: z
|
||||||
.string()
|
.string()
|
||||||
|
.url()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1)
|
.min(1)
|
||||||
.optional()
|
.optional()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { ForbiddenError } from "@casl/ability";
|
|||||||
import axios, { AxiosError } from "axios";
|
import axios, { AxiosError } from "axios";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import jwt from "jsonwebtoken";
|
import jwt from "jsonwebtoken";
|
||||||
|
import RE2 from "re2";
|
||||||
|
|
||||||
import { IdentityAuthMethod, TIdentityKubernetesAuthsUpdate } from "@app/db/schemas";
|
import { IdentityAuthMethod, TIdentityKubernetesAuthsUpdate } from "@app/db/schemas";
|
||||||
import { TGatewayDALFactory } from "@app/ee/services/gateway/gateway-dal";
|
import { TGatewayDALFactory } from "@app/ee/services/gateway/gateway-dal";
|
||||||
@@ -185,7 +186,13 @@ export const identityKubernetesAuthServiceFactory = ({
|
|||||||
return res.data;
|
return res.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const [k8sHost, k8sPort] = identityKubernetesAuth.kubernetesHost.split(":");
|
let { kubernetesHost } = identityKubernetesAuth;
|
||||||
|
|
||||||
|
if (kubernetesHost.startsWith("https://") || kubernetesHost.startsWith("http://")) {
|
||||||
|
kubernetesHost = kubernetesHost.replace(new RE2("^https?:\\/\\/"), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
const [k8sHost, k8sPort] = kubernetesHost.split(":") ?? [];
|
||||||
|
|
||||||
const data = identityKubernetesAuth.gatewayId
|
const data = identityKubernetesAuth.gatewayId
|
||||||
? await $gatewayProxyWrapper(
|
? await $gatewayProxyWrapper(
|
||||||
|
|||||||
Reference in New Issue
Block a user