Before version 1.24, Kubernetes automatically generated Secret-based tokens for ServiceAccounts. To distinguish between automatically generated tokens and manually created ones, Kubernetes checks for a reference from the ServiceAccount's secrets field. If the Secret is referenced in the secrets field, it is considered an auto-generated legacy token. These legacy Tokens can be of security concern and should be audited.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: check-serviceaccount-secretsannotations:policies.kyverno.io/title: Check Long-Lived Secrets in ServiceAccountspolicies.kyverno.io/category: Securitypolicies.kyverno.io/severity: mediumkyverno.io/kyverno-version: 1.11.1kyverno.io/kubernetes-version: "1.27"policies.kyverno.io/subject: Secret,ServiceAccountpolicies.kyverno.io/description: Before version 1.24, Kubernetes automatically generated Secret-based tokens for ServiceAccounts. To distinguish between automatically generated tokens and manually created ones, Kubernetes checks for a reference from the ServiceAccount's secrets field. If the Secret is referenced in the secrets field, it is considered an auto-generated legacy token. These legacy Tokens can be of security concern and should be audited.spec:validationFailureAction: Auditbackground: truerules:- name: deny-secretsmatch:any:- resources:kinds:- ServiceAccountvalidate:message: Long-lived API tokens are not allowed.pattern:X(secrets): null
This policy prevents the use of the default project in an Application.
This policy ensures that the name of the ApplicationSet is the same value provided in the project.
This policy ensures that the name of the ApplicationSet is the same value provided in the project.