mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
security(info): do not render the tenant ServiceAccount token under OIDC
The Info application selects the ServiceAccount token Secret for the
tenantsecrets API, and the use tier can read tenantsecrets, so the token
and the rights bound to its ServiceAccount were readable by every use
member of the tenant.
With OIDC enabled the dashboard signs in with the user's own ID token and
nothing consumes the token, so the Secret is no longer rendered. Removing
it also invalidates tokens that were already read.
Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
(cherry picked from commit 5674d01c95)
This commit is contained in:
1 parent
8f3a23a78f
commit
2537b58156
2 files changed
+43
No files matched your search
@@ -1,3 +1,5 @@
|
||||
{{- $oidcEnabled := index .Values._cluster "oidc-enabled" }}
|
||||
{{- if ne $oidcEnabled "true" }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
@@ -6,3 +8,4 @@ metadata:
|
||||
annotations:
|
||||
kubernetes.io/service-account.name: {{ .Release.Namespace }}
|
||||
type: kubernetes.io/service-account-token
|
||||
{{- end }}
|
||||
@@ -0,0 +1,40 @@
|
||||
suite: info tenant ServiceAccount token
|
||||
templates:
|
||||
- templates/serviceaccount.yaml
|
||||
|
||||
release:
|
||||
name: info
|
||||
namespace: tenant-root
|
||||
|
||||
# The Info application selects this Secret for the tenantsecrets API, and
|
||||
# cozy:tenant:use can read tenantsecrets. Rendering a live ServiceAccount token
|
||||
# under OIDC therefore hands the token, and the rights bound to that
|
||||
# ServiceAccount, to every member of the use tier. Under OIDC the dashboard
|
||||
# signs in with the user's own ID token, so nothing needs the token there.
|
||||
# _cluster.oidc-enabled arrives as the string "true" or "false", never a bool.
|
||||
|
||||
tests:
|
||||
- it: renders no token Secret when OIDC is enabled
|
||||
set:
|
||||
_cluster:
|
||||
oidc-enabled: "true"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
|
||||
- it: renders the token Secret when OIDC is disabled
|
||||
set:
|
||||
_cluster:
|
||||
oidc-enabled: "false"
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- equal:
|
||||
path: type
|
||||
value: kubernetes.io/service-account-token
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: tenant-root
|
||||
- equal:
|
||||
path: metadata.annotations["kubernetes.io/service-account.name"]
|
||||
value: tenant-root
|
||||
Reference in new issue
Block a user