Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
add possible env var for hosting
Thiago Araujo da Silva9af3615ebd87
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.tsindex ba487a5cc7..8657534d5a 100644--- a/backend/src/lib/config/env.ts+++ b/backend/src/lib/config/env.ts@@ -412,6 +412,7 @@ const envSchema = zINF_APP_CONNECTION_GITHUB_APP_PRIVATE_KEY: zpStr(z.string().optional()),INF_APP_CONNECTION_GITHUB_APP_SLUG: zpStr(z.string().optional()),INF_APP_CONNECTION_GITHUB_APP_ID: zpStr(z.string().optional()),+ INF_APP_CONNECTION_GITHUB_APP_HOST: zpStr(z.string().optional()),// github radar appINF_APP_CONNECTION_GITHUB_RADAR_APP_CLIENT_ID: zpStr(z.string().optional()),@@ -811,6 +812,11 @@ export const overwriteSchema: {{key: "INF_APP_CONNECTION_GITHUB_APP_PRIVATE_KEY",description: "The Private Key of your GitHub application."+ },+ {+ key: "INF_APP_CONNECTION_GITHUB_APP_HOST",+ description:+ "The hostname of the GitHub instance used by the shared GitHub App (e.g. github.example.com for GitHub Enterprise Server). Defaults to github.com. Must be set when the shared app is registered on a GHES instance."}]},diff --git a/backend/src/services/app-connection/github/github-connection-fns.ts b/backend/src/services/app-connection/github/github-connection-fns.tsindex efc55f8bd4..cbe7c3609b 100644--- a/backend/src/services/app-connection/github/github-connection-fns.ts+++ b/backend/src/services/app-connection/github/github-connection-fns.ts@@ -78,7 +78,8 @@ export const resolveGitHubAppCredentials = async (INF_APP_CONNECTION_GITHUB_APP_SLUG,INF_APP_CONNECTION_GITHUB_APP_CLIENT_ID,INF_APP_CONNECTION_GITHUB_APP_CLIENT_SECRET,- INF_APP_CONNECTION_GITHUB_APP_PRIVATE_KEY+ INF_APP_CONNECTION_GITHUB_APP_PRIVATE_KEY,+ INF_APP_CONNECTION_GITHUB_APP_HOST} = getConfig();if (@@ -93,13 +94,18 @@ export const resolveGitHubAppCredentials = async (});}+ // Bind the shared app to its server-configured host (defaults to github.com).+ // This prevents callers from redirecting the OAuth exchange to an arbitrary host+ // and receiving the shared client secret.+ const sharedAppHost = INF_APP_CONNECTION_GITHUB_APP_HOST ?? null;+return {appId: INF_APP_CONNECTION_GITHUB_APP_ID,slug: INF_APP_CONNECTION_GITHUB_APP_SLUG,clientId: INF_APP_CONNECTION_GITHUB_APP_CLIENT_ID,clientSecret: INF_APP_CONNECTION_GITHUB_APP_CLIENT_SECRET,privateKey: INF_APP_CONNECTION_GITHUB_APP_PRIVATE_KEY,- host: null,+ host: sharedAppHost,instanceType: null};};diff --git a/backend/src/services/github-app/github-app-service.ts b/backend/src/services/github-app/github-app-service.tsindex ac56d900f3..8ab652d3ca 100644--- a/backend/src/services/github-app/github-app-service.ts+++ b/backend/src/services/github-app/github-app-service.ts@@ -592,7 +592,11 @@ export const gitHubAppServiceFactory = ({});- const effectiveHost = gitHubAppId ? (appHost ?? undefined) : host || undefined;+ // For the shared/instance-default app, appHost is always derived from the+ // server-side INF_APP_CONNECTION_GITHUB_APP_HOST env var (null = github.com).+ // Never trust the caller-supplied host for the shared app — the client secret+ // would otherwise be sent to an attacker-controlled server.+ const effectiveHost = appHost ?? undefined;const effectiveInstanceType: "cloud" | "server" = gitHubAppId? (appInstanceType ?? "cloud"): (instanceType ?? "cloud");