Skip to content

Commit c0f6ace

Browse files
committed
fix(helm): treat TRUST_PROXY_HEADERS as chart-computed on both deployments
It is inlined on the app container like PII_URL, so it has to be in the $chartComputed lists. It was not, which meant setting the documented app.env.TRUST_PROXY_HEADERS override under externalSecrets.enabled failed template validation and demanded a remoteRefs mapping for a value the container never reads from a Secret. It also wrote the key into the chart-managed Secret. Inline it on the realtime deployment too. @sim/audit runs there and reads this to decide whether a forwarded header may be believed when stamping an audit row's ipAddress, and the chart-managed Secret is shared with realtime via envFrom — so excluding the key from that Secret without inlining it would have quietly left realtime trusting headers the operator declared untrustworthy. Verified by rendering: inline, existingSecret, and ESO modes each emit exactly one entry per pod carrying the same value, the key never reaches the Secret, and ESO no longer demands a remoteRef for it.
1 parent 64bc545 commit c0f6ace

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

helm/sim/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ than enforced.
313313
{{- define "sim.validateExternalSecretCoverage" -}}
314314
{{- if and .Values.externalSecrets .Values.externalSecrets.enabled -}}
315315
{{- $remoteRefs := default (dict) (default (dict) .Values.externalSecrets.remoteRefs).app -}}
316-
{{- $chartComputed := list "DATABASE_URL" "SOCKET_SERVER_URL" "OLLAMA_URL" "PII_URL" -}}
316+
{{- $chartComputed := list "DATABASE_URL" "SOCKET_SERVER_URL" "OLLAMA_URL" "PII_URL" "TRUST_PROXY_HEADERS" -}}
317317
{{- $appEnv := default (dict) .Values.app.env -}}
318318
{{/*
319319
Required-key coverage: these are non-optional at runtime. With ESO enabled

helm/sim/templates/deployment-app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ spec:
121121
and in inline mode (values flow through the chart-managed Secret).
122122
*/}}
123123
{{- if and .Values.app.secrets.existingSecret.enabled (not .Values.externalSecrets.enabled) }}
124-
{{- $chartComputed := list "DATABASE_URL" "SOCKET_SERVER_URL" "OLLAMA_URL" "PII_URL" }}
124+
{{- $chartComputed := list "DATABASE_URL" "SOCKET_SERVER_URL" "OLLAMA_URL" "PII_URL" "TRUST_PROXY_HEADERS" }}
125125
{{- range $key, $value := $appEnv }}
126126
{{- if and (ne (toString $value) "") (ne (toString $value) "<nil>") (not (has $key $chartComputed)) }}
127127
- name: {{ $key }}

helm/sim/templates/deployment-realtime.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ spec:
6262
env:
6363
- name: DATABASE_URL
6464
value: {{ include "sim.databaseUrl" . | quote }}
65+
{{- /*
66+
Inlined for the same reason as on the app pod: @sim/audit runs here
67+
too and reads this to decide whether a forwarded header may be
68+
believed when stamping an audit row's ipAddress. Chart-computed, so
69+
it is excluded from the shared Secret and must be set explicitly on
70+
both deployments.
71+
*/}}
72+
- name: TRUST_PROXY_HEADERS
73+
value: {{ include "sim.trustProxyHeaders" . | quote }}
6574
{{- if .Values.telemetry.enabled }}
6675
{{- $nodeEnv := default (default "production" (index (.Values.realtime.envDefaults | default dict) "NODE_ENV")) (index (.Values.realtime.env | default dict) "NODE_ENV") }}
6776
# OpenTelemetry configuration
@@ -112,7 +121,7 @@ spec:
112121
deployment.
113122
*/}}
114123
{{- if and .Values.app.secrets.existingSecret.enabled (not .Values.externalSecrets.enabled) }}
115-
{{- $chartComputed := list "DATABASE_URL" "SOCKET_SERVER_URL" "OLLAMA_URL" "PII_URL" }}
124+
{{- $chartComputed := list "DATABASE_URL" "SOCKET_SERVER_URL" "OLLAMA_URL" "PII_URL" "TRUST_PROXY_HEADERS" }}
116125
{{- /*
117126
Build the effective realtime env from app.env as the base, then
118127
overlay non-empty realtime.env values. Sprig's `merge` keeps the

helm/sim/templates/secrets-app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ metadata:
1818
{{- include "sim.app.labels" . | nindent 4 }}
1919
type: Opaque
2020
stringData:
21-
{{- $chartComputed := list "DATABASE_URL" "SOCKET_SERVER_URL" "OLLAMA_URL" "PII_URL" }}
21+
{{- $chartComputed := list "DATABASE_URL" "SOCKET_SERVER_URL" "OLLAMA_URL" "PII_URL" "TRUST_PROXY_HEADERS" }}
2222
{{- /*
2323
Intent: app.env is authoritative for shared keys (both pods envFrom this
2424
Secret, so the app container must not be silently overwritten by a

0 commit comments

Comments
 (0)