Interview Prep/DevSecOps/Cloud identity: IRSA, Workload Identity and CI OIDC

A kubeconfig with a static cluster-admin ServiceAccount token is found committed in a public repo

AdvancedTroubleshootingCloud identity: IRSA, Workload Identity and CI OIDC
Answer

Likely causes → A long-lived SA token secret was created for CI and copied into a file for convenience.

Diagnose →

echo "$TOKEN" | cut -d. -f2 | base64 -d 2>/dev/null | jq   # SA name, namespace, secret name
kubectl get clusterrolebinding -o wide | grep <sa>

Search the audit logs for that SA's username (system:serviceaccount:<ns>:<sa>) since the commit date.

Fix → Delete the token Secret (this invalidates the token at once), remove the cluster-admin binding, review audit logs for actions taken, and rotate any secrets the SA could read. Also purge the file from Git history, though rotation is what actually protects you. If the API endpoint is public, restrict it.

Prevent → No long-lived tokens. Use OIDC-based CI auth, a private API endpoint or an authorized network list, and secret scanning with push protection.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Cloud identity: IRSA, Workload Identity and CI OIDC