Skip to content

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

fix(helm): strict origin validation for config.siteUrl and lint override

ArshBallagan8b1ad080f05b
diff --git a/.github/workflows/helm-release-infisical-nkp.yml b/.github/workflows/helm-release-infisical-nkp.yml
index 5760e2ccbf..2d4366bdc9 100644
--- a/.github/workflows/helm-release-infisical-nkp.yml
+++ b/.github/workflows/helm-release-infisical-nkp.yml
@@ -18,7 +18,7 @@ jobs:
version: v3.17.0
- name: Run helm lint
- run: helm lint helm-charts/infisical-nkp
+ run: helm lint helm-charts/infisical-nkp --set config.siteUrl=https://infisical.example.com
- name: Run helm template
run: helm template infisical helm-charts/infisical-nkp --set config.siteUrl=https://infisical.example.com > /dev/null
diff --git a/helm-charts/infisical-nkp/templates/configmap.yaml b/helm-charts/infisical-nkp/templates/configmap.yaml
index 1a6469be39..97fc440a7d 100644
--- a/helm-charts/infisical-nkp/templates/configmap.yaml
+++ b/helm-charts/infisical-nkp/templates/configmap.yaml
@@ -5,8 +5,8 @@ links, SSO and OAuth redirect URIs, WebAuthn relying party). Fail the install
early with a clear message rather than deploying a silently degraded instance.
*/ -}}
{{- $siteUrl := required "config.siteUrl is required: set it to the external URL users will reach Infisical at, e.g. https://infisical.example.com" .Values.config.siteUrl -}}
-{{- if not (regexMatch "^https?://[^/]+$" $siteUrl) -}}
-{{- fail (printf "config.siteUrl must be an origin of the form http(s)://<hostname> with no path suffix or trailing slash (Infisical cannot be served under a path prefix); got %q" $siteUrl) -}}
+{{- if not (regexMatch "^https?://[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?(\\.[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?)*(:[0-9]{1,5})?$" $siteUrl) -}}
+{{- fail (printf "config.siteUrl must be a bare origin of the form http(s)://<hostname>[:port] with no path, query, fragment or credentials (Infisical cannot be served under a path prefix); got %q" $siteUrl) -}}
{{- end -}}
apiVersion: v1
kind: ConfigMap