Skip to content

Commit 6972e57

Browse files
Merge pull request #384 from pierluigilenoci/fix/exclude-client-secret-federated-auth
feat: add config.secretKeys to selectively include secrets
2 parents c8f1449 + 4c02042 commit 6972e57

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed

helm/oauth2-proxy/Chart.yaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: oauth2-proxy
2-
version: 10.0.3
2+
version: 10.1.0
33
apiVersion: v2
44
appVersion: 7.13.0
55
home: https://oauth2-proxy.github.io/oauth2-proxy/
@@ -30,15 +30,10 @@ maintainers:
3030
kubeVersion: ">=1.16.0-0"
3131
annotations:
3232
artifacthub.io/changes: |
33-
- kind: changed
34-
description: Fix error msg which mentioned the old redis.… subchart values
33+
- kind: added
34+
description: Added config.requiredSecretKeys option to selectively include secrets (allows excluding client-secret for federated auth scenarios)
3535
links:
3636
- name: Github PR
37-
url: https://github.com/oauth2-proxy/manifests/pull/386
38-
- kind: fixed
39-
description: Fix image registry priority order - local image.registry now takes precedence over global.imageRegistry
40-
links:
41-
- name: Github PR
42-
url: https://github.com/oauth2-proxy/manifests/pull/383
37+
url: https://github.com/oauth2-proxy/manifests/pull/384
4338
- name: Github Issue
44-
url: https://github.com/oauth2-proxy/manifests/issues/379
39+
url: https://github.com/oauth2-proxy/manifests/issues/376

helm/oauth2-proxy/templates/_helpers.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,13 @@ metricsServer:
164164
{{- end -}}
165165

166166
{{- define "oauth2-proxy.secrets" -}}
167+
{{- if has "cookie-secret" .Values.config.requiredSecretKeys }}
167168
cookie-secret: {{ tpl .Values.config.cookieSecret $ | b64enc | quote }}
169+
{{- end }}
170+
{{- if has "client-secret" .Values.config.requiredSecretKeys }}
168171
client-secret: {{ tpl .Values.config.clientSecret $ | b64enc | quote }}
172+
{{- end }}
173+
{{- if has "client-id" .Values.config.requiredSecretKeys }}
169174
client-id: {{ tpl .Values.config.clientID $ | b64enc | quote }}
175+
{{- end }}
170176
{{- end -}}

helm/oauth2-proxy/templates/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,22 +182,28 @@ spec:
182182
{{- end }}
183183
env:
184184
{{- if .Values.proxyVarsAsSecrets }}
185+
{{- if has "client-id" .Values.config.requiredSecretKeys }}
185186
- name: OAUTH2_PROXY_CLIENT_ID
186187
valueFrom:
187188
secretKeyRef:
188189
name: {{ template "oauth2-proxy.secretName" . }}
189190
key: client-id
191+
{{- end }}
192+
{{- if has "client-secret" .Values.config.requiredSecretKeys }}
190193
- name: OAUTH2_PROXY_CLIENT_SECRET
191194
valueFrom:
192195
secretKeyRef:
193196
name: {{ template "oauth2-proxy.secretName" . }}
194197
key: client-secret
198+
{{- end }}
199+
{{- if has "cookie-secret" .Values.config.requiredSecretKeys }}
195200
- name: OAUTH2_PROXY_COOKIE_SECRET
196201
valueFrom:
197202
secretKeyRef:
198203
name: {{ template "oauth2-proxy.secretName" . }}
199204
key: cookie-secret
200205
{{- end }}
206+
{{- end }}
201207
{{- if eq (default "cookie" .Values.sessionStorage.type) "redis" }}
202208
- name: OAUTH2_PROXY_SESSION_STORE_TYPE
203209
value: "redis"

helm/oauth2-proxy/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ config:
2323
clientID: "XXXXXXX"
2424
# OAuth client secret
2525
clientSecret: "XXXXXXXX"
26+
# List of secret keys to include in the secret and expose as environment variables.
27+
# By default, all three secrets are required. To exclude certain secrets
28+
# (e.g., when using federated token authentication), remove them from this list.
29+
# Example to exclude client-secret:
30+
# requiredSecretKeys:
31+
# - client-id
32+
# - cookie-secret
33+
requiredSecretKeys:
34+
- client-id
35+
- client-secret
36+
- cookie-secret
2637
# Create a new secret with the following command
2738
# openssl rand -base64 32 | head -c 32 | base64
2839
# Use an existing secret for OAuth2 credentials (see secret.yaml for required fields)

0 commit comments

Comments
 (0)