kube-auth-proxy: accept only target cluster hostname

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen committed 2020-11-18 22:02:20 +02:00
1 parent 3197e3a1fe
commit 025c4d0593
1 file changed
+3 -1
+3 -1
View File
@@ -4,6 +4,7 @@ import { broadcastIpc } from "../common/ipc";
import type { Cluster } from "./cluster"
import { Kubectl } from "./kubectl"
import logger from "./logger"
import * as url from "url"
export interface KubeAuthProxyLog {
data: string;
@@ -30,13 +31,14 @@ export class KubeAuthProxy {
if (this.proxyProcess) {
return;
}
const clusterUrl = url.parse(this.cluster.apiUrl);
const proxyBin = await this.kubectl.getPath()
const args = [
"proxy",
"-p", `${this.port}`,
"--kubeconfig", `${this.cluster.kubeConfigPath}`,
"--context", `${this.cluster.contextName}`,
"--accept-hosts", ".*",
"--accept-hosts", clusterUrl.hostname,
"--reject-paths", "^[^/]"
]
if (process.env.DEBUG_PROXY === "true") {